mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-27 22:00:23 -04:00
Improve Live2D export
This commit is contained in:
parent
67a74fd395
commit
c2d3b8c5f9
@ -1,8 +1,5 @@
|
|||||||
////
|
////
|
||||||
// Based on UnityLive2DExtractorMod by aelurum
|
// Based on UnityLive2DExtractor by Perfare
|
||||||
// https://github.com/aelurum/UnityLive2DExtractor
|
|
||||||
//
|
|
||||||
// Original version - by Perfare
|
|
||||||
// https://github.com/Perfare/UnityLive2DExtractor
|
// https://github.com/Perfare/UnityLive2DExtractor
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -164,11 +161,15 @@ namespace CubismLive2DExtractor
|
|||||||
File.WriteAllText($"{destMotionPath}{animName}.motion3.json", JsonConvert.SerializeObject(motionJson, Formatting.Indented, new MyJsonConverter()));
|
File.WriteAllText($"{destMotionPath}{animName}.motion3.json", JsonConvert.SerializeObject(motionJson, Formatting.Indented, new MyJsonConverter()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (gameObjects.Count > 0) //motion from AnimationClip
|
if (motions.Count == 0 && gameObjects.Count > 0) //motion from AnimationClip
|
||||||
{
|
{
|
||||||
var exportMethod = motionMode == Live2DMotionMode.AnimationClip
|
var exportMethod = "AnimationClip";
|
||||||
? "AnimationClip"
|
if (motionMode == Live2DMotionMode.MonoBehaviour)
|
||||||
: "AnimationClip (no Fade motions found)";
|
{
|
||||||
|
exportMethod = fadeMotionList.Count > 0
|
||||||
|
? exportMethod + " (unable to export motion using Fade motion method)"
|
||||||
|
: exportMethod + " (no Fade motions found)";
|
||||||
|
}
|
||||||
Logger.Debug($"Motion export method: {exportMethod}");
|
Logger.Debug($"Motion export method: {exportMethod}");
|
||||||
var rootTransform = gameObjects[0].m_Transform;
|
var rootTransform = gameObjects[0].m_Transform;
|
||||||
while (rootTransform.m_Father.TryGet(out var m_Father))
|
while (rootTransform.m_Father.TryGet(out var m_Father))
|
||||||
@ -236,22 +237,22 @@ namespace CubismLive2DExtractor
|
|||||||
//group
|
//group
|
||||||
var groups = new List<CubismModel3Json.SerializableGroup>();
|
var groups = new List<CubismModel3Json.SerializableGroup>();
|
||||||
|
|
||||||
//Try looking for group IDs among the gameObjects
|
//Try looking for group IDs among the parameter names manually
|
||||||
if (eyeBlinkParameters.Count == 0)
|
if (eyeBlinkParameters.Count == 0)
|
||||||
{
|
{
|
||||||
eyeBlinkParameters = gameObjects.Where(x =>
|
eyeBlinkParameters = parameterNames.Where(x =>
|
||||||
x.m_Name.ToLower().Contains("eye")
|
x.ToLower().Contains("eye")
|
||||||
&& x.m_Name.ToLower().Contains("open")
|
&& x.ToLower().Contains("open")
|
||||||
&& (x.m_Name.ToLower().Contains('l') || x.m_Name.ToLower().Contains('r'))
|
&& (x.ToLower().Contains('l') || x.ToLower().Contains('r'))
|
||||||
).Select(x => x.m_Name).ToHashSet();
|
).ToHashSet();
|
||||||
}
|
}
|
||||||
if (lipSyncParameters.Count == 0)
|
if (lipSyncParameters.Count == 0)
|
||||||
{
|
{
|
||||||
lipSyncParameters = gameObjects.Where(x =>
|
lipSyncParameters = parameterNames.Where(x =>
|
||||||
x.m_Name.ToLower().Contains("mouth")
|
x.ToLower().Contains("mouth")
|
||||||
&& x.m_Name.ToLower().Contains("open")
|
&& x.ToLower().Contains("open")
|
||||||
&& x.m_Name.ToLower().Contains('y')
|
&& x.ToLower().Contains('y')
|
||||||
).Select(x => x.m_Name).ToHashSet();
|
).ToHashSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
groups.Add(new CubismModel3Json.SerializableGroup
|
groups.Add(new CubismModel3Json.SerializableGroup
|
||||||
|
Loading…
Reference in New Issue
Block a user