mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-26 13:50:21 -04:00
A small refactoring for Live2D motion export
This commit is contained in:
parent
cc21d4fa4d
commit
a8bb6c714b
@ -289,9 +289,11 @@ namespace CubismLive2DExtractor
|
|||||||
var destMotionPath = Path.Combine(destPath, "motions") + Path.DirectorySeparatorChar;
|
var destMotionPath = Path.Combine(destPath, "motions") + Path.DirectorySeparatorChar;
|
||||||
var motionFps = 0f;
|
var motionFps = 0f;
|
||||||
|
|
||||||
if (motionMode == Live2DMotionMode.MonoBehaviour && FadeMotionLst != null) //Fade motions from Fade Motion List
|
if (motionMode == Live2DMotionMode.MonoBehaviour) //Fade motions from MonoBehaviour
|
||||||
{
|
{
|
||||||
Logger.Debug("Motion export method: MonoBehaviour (Fade motion)");
|
if (FadeMotionLst != null) //Fade motions from fadeMotionList
|
||||||
|
{
|
||||||
|
Logger.Debug("Parsing fade motion list..");
|
||||||
var fadeMotionLstDict = ParseMonoBehaviour(FadeMotionLst, CubismMonoBehaviourType.FadeMotionList, Assembly);
|
var fadeMotionLstDict = ParseMonoBehaviour(FadeMotionLst, CubismMonoBehaviourType.FadeMotionList, Assembly);
|
||||||
if (fadeMotionLstDict != null)
|
if (fadeMotionLstDict != null)
|
||||||
{
|
{
|
||||||
@ -312,32 +314,35 @@ namespace CubismLive2DExtractor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (motionMode == Live2DMotionMode.MonoBehaviour && FadeMotions.Count > 0) //motion from MonoBehaviour
|
|
||||||
|
if (FadeMotions.Count > 0)
|
||||||
{
|
{
|
||||||
|
Logger.Debug("Motion export method: MonoBehaviour (Fade motion)");
|
||||||
ExportFadeMotions(destMotionPath, forceBezier, motions, ref motionFps);
|
ExportFadeMotions(destMotionPath, forceBezier, motions, ref motionFps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (motions.Count == 0) //motion from AnimationClip
|
|
||||||
{
|
|
||||||
CubismMotion3Converter converter = null;
|
|
||||||
var exportMethod = "AnimationClip";
|
|
||||||
if (motionMode != Live2DMotionMode.AnimationClipV1) //AnimationClipV2
|
|
||||||
{
|
|
||||||
exportMethod += "V2";
|
|
||||||
converter = new CubismMotion3Converter(AnimationClips, PartNames, ParameterNames);
|
|
||||||
}
|
}
|
||||||
else if (Model?.ModelGameObject != null) //AnimationClipV1
|
|
||||||
|
if (motions.Count == 0) //motions from AnimationClip
|
||||||
{
|
{
|
||||||
|
CubismMotion3Converter converter;
|
||||||
|
var exportMethod = "AnimationClip";
|
||||||
|
switch (motionMode)
|
||||||
|
{
|
||||||
|
case Live2DMotionMode.AnimationClipV1 when Model?.ModelGameObject != null:
|
||||||
exportMethod += "V1";
|
exportMethod += "V1";
|
||||||
converter = new CubismMotion3Converter(Model.ModelGameObject, AnimationClips);
|
converter = new CubismMotion3Converter(Model.ModelGameObject, AnimationClips);
|
||||||
}
|
break;
|
||||||
|
default: //AnimationClipV2
|
||||||
|
exportMethod += "V2";
|
||||||
if (motionMode == Live2DMotionMode.MonoBehaviour)
|
if (motionMode == Live2DMotionMode.MonoBehaviour)
|
||||||
{
|
{
|
||||||
exportMethod = FadeMotions.Count > 0
|
exportMethod = FadeMotions.Count > 0
|
||||||
? exportMethod + " (unable to export motions using Fade motion method)"
|
? exportMethod + " (unable to export motions using Fade motion method)"
|
||||||
: exportMethod + " (no Fade motions found)";
|
: exportMethod + " (no Fade motions found)";
|
||||||
}
|
}
|
||||||
|
converter = new CubismMotion3Converter(AnimationClips, PartNames, ParameterNames);
|
||||||
|
break;
|
||||||
|
}
|
||||||
Logger.Debug($"Motion export method: {exportMethod}");
|
Logger.Debug($"Motion export method: {exportMethod}");
|
||||||
|
|
||||||
ExportClipMotions(destMotionPath, converter, forceBezier, motions, ref motionFps);
|
ExportClipMotions(destMotionPath, converter, forceBezier, motions, ref motionFps);
|
||||||
|
Loading…
Reference in New Issue
Block a user