mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-18 03:24:15 -04:00
Improve integration with Live2D assets
- Added container-independent method for searching AnimationClip assets (However, it's not really universal, so it can't completely replace the container-dependent method)
This commit is contained in:
@ -586,6 +586,7 @@ namespace AssetStudioCLI.Options
|
||||
o_exportAssetTypes.Value = new List<ClassIDType>
|
||||
{
|
||||
ClassIDType.AnimationClip,
|
||||
ClassIDType.Animator,
|
||||
ClassIDType.MonoBehaviour,
|
||||
ClassIDType.Texture2D,
|
||||
};
|
||||
|
@ -295,6 +295,7 @@ namespace AssetStudioCLI
|
||||
if (m_GameObject.CubismModel != null && TryGetCubismMoc(m_GameObject.CubismModel.CubismModelMono, out var mocMono))
|
||||
{
|
||||
l2dModelDict[mocMono] = m_GameObject.CubismModel;
|
||||
BindAnimationClips(m_GameObject);
|
||||
}
|
||||
break;
|
||||
case Animator m_Animator:
|
||||
@ -940,6 +941,34 @@ namespace AssetStudioCLI
|
||||
}
|
||||
}
|
||||
|
||||
private static void BindAnimationClips(GameObject gameObject)
|
||||
{
|
||||
if (gameObject.m_Animator == null || gameObject.m_Animator.m_Controller.IsNull)
|
||||
return;
|
||||
|
||||
if (!gameObject.m_Animator.m_Controller.TryGet(out var controller))
|
||||
return;
|
||||
|
||||
AnimatorController animatorController;
|
||||
if (controller is AnimatorOverrideController overrideController)
|
||||
{
|
||||
if (!overrideController.m_Controller.TryGet(out animatorController))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
animatorController = (AnimatorController)controller;
|
||||
}
|
||||
|
||||
foreach (var clipPptr in animatorController.m_AnimationClips)
|
||||
{
|
||||
if (clipPptr.TryGet(out var m_AnimationClip))
|
||||
{
|
||||
gameObject.CubismModel.ClipMotionList.Add(m_AnimationClip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Transform GetRootTransform(Transform m_Transform)
|
||||
{
|
||||
if (m_Transform == null)
|
||||
|
Reference in New Issue
Block a user