Skip to content

Commit 9f918d0

Browse files
committed
Fix export of selected Live2D motions
1 parent 81cd6d7 commit 9f918d0

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

AssetStudioGUI/AssetStudioGUIForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2319,7 +2319,7 @@ private void exportSelectedL2DWithFadeList_Click(object sender, EventArgs e)
23192319

23202320
private void ExportSelectedL2DModels(ExportL2DFilter l2dExportMode)
23212321
{
2322-
if (exportableAssets.Count == 0)
2322+
if (Studio.exportableAssets.Count == 0)
23232323
{
23242324
Logger.Info("No exportable assets loaded");
23252325
return;

AssetStudioUtility/CubismLive2DExtractor/Live2DExtractor.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ public sealed class Live2DExtractor
4141
private HashSet<string> EyeBlinkParameters { get; set; }
4242
private HashSet<string> LipSyncParameters { get; set; }
4343

44-
public Live2DExtractor(KeyValuePair<MonoBehaviour, List<Object>> assetGroupKvp, List<AnimationClip> inClipMotions = null, List<MonoBehaviour> inFadeMotions = null, MonoBehaviour inFadeMotionLst = null)
44+
public Live2DExtractor(KeyValuePair<MonoBehaviour, List<Object>> assetGroupKvp, List<AnimationClip> selClipMotions = null, List<MonoBehaviour> selFadeMotions = null, MonoBehaviour selFadeMotionLst = null)
4545
{
4646
Expressions = new List<MonoBehaviour>();
47-
FadeMotions = inFadeMotions ?? new List<MonoBehaviour>();
48-
AnimationClips = inClipMotions ?? new List<AnimationClip>();
47+
FadeMotions = selFadeMotions ?? new List<MonoBehaviour>();
48+
AnimationClips = selClipMotions ?? new List<AnimationClip>();
49+
FadeMotionLst = selFadeMotionLst;
4950
Texture2Ds = new List<Texture2D>();
5051
EyeBlinkParameters = new HashSet<string>();
5152
LipSyncParameters = new HashSet<string>();
5253
ParameterNames = new HashSet<string>();
5354
PartNames = new HashSet<string>();
54-
FadeMotionLst = inFadeMotionLst;
5555
ParametersCdi = new List<MonoBehaviour>();
5656
PartsCdi = new List<MonoBehaviour>();
5757
PoseParts = new List<MonoBehaviour>();
@@ -61,6 +61,10 @@ public Live2DExtractor(KeyValuePair<MonoBehaviour, List<Object>> assetGroupKvp,
6161
var searchModelParamCdi = true;
6262
var searchModelPartCdi = true;
6363
var searchPoseParts = true;
64+
var searchFadeMotions =
65+
selClipMotions == null
66+
&& selFadeMotions == null
67+
&& selFadeMotionLst == null;
6468

6569
Logger.Debug("Sorting model assets..");
6670

@@ -69,9 +73,9 @@ public Live2DExtractor(KeyValuePair<MonoBehaviour, List<Object>> assetGroupKvp,
6973
{
7074
Model = model;
7175
PhysicsMono = Model.PhysicsController;
72-
if (inFadeMotionLst == null && TryGetFadeList(Model.FadeController, out var fadeMono))
76+
if (searchFadeMotions && TryGetFadeList(Model.FadeController, out var fadeMono))
7377
{
74-
FadeMotionLst = inFadeMotionLst = fadeMono;
78+
FadeMotionLst = selFadeMotionLst = fadeMono;
7579
}
7680
if (TryGetExpressionList(Model.ExpressionController, out var expressionMono))
7781
{
@@ -122,13 +126,13 @@ public Live2DExtractor(KeyValuePair<MonoBehaviour, List<Object>> assetGroupKvp,
122126
Expressions.Add(m_MonoBehaviour);
123127
break;
124128
case "CubismFadeMotionData":
125-
if (inFadeMotions == null && inFadeMotionLst == null)
129+
if (searchFadeMotions)
126130
{
127131
FadeMotions.Add(m_MonoBehaviour);
128132
}
129133
break;
130134
case "CubismFadeMotionList":
131-
if (inFadeMotions == null && inFadeMotionLst == null)
135+
if (searchFadeMotions)
132136
{
133137
FadeMotionLst = m_MonoBehaviour;
134138
}
@@ -187,7 +191,7 @@ public Live2DExtractor(KeyValuePair<MonoBehaviour, List<Object>> assetGroupKvp,
187191
}
188192
break;
189193
case AnimationClip m_AnimationClip:
190-
if (inClipMotions == null)
194+
if (selClipMotions == null)
191195
{
192196
AnimationClips.Add(m_AnimationClip);
193197
}

0 commit comments

Comments
 (0)