mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -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:
parent
0cc74b8c12
commit
a0c2a7bdfe
@ -74,6 +74,11 @@ namespace AssetStudio
|
|||||||
filteredAssetTypesList.Add(ClassIDType.Texture2D);
|
filteredAssetTypesList.Add(ClassIDType.Texture2D);
|
||||||
filteredAssetTypesList.Add(ClassIDType.SpriteAtlas);
|
filteredAssetTypesList.Add(ClassIDType.SpriteAtlas);
|
||||||
}
|
}
|
||||||
|
if (classIDTypes.Contains(ClassIDType.Animator))
|
||||||
|
{
|
||||||
|
filteredAssetTypesList.Add(ClassIDType.AnimatorController);
|
||||||
|
filteredAssetTypesList.Add(ClassIDType.AnimatorOverrideController);
|
||||||
|
}
|
||||||
|
|
||||||
filteredAssetTypesList.UnionWith(classIDTypes);
|
filteredAssetTypesList.UnionWith(classIDTypes);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ namespace AssetStudio
|
|||||||
public List<MonoBehaviour> ParamDisplayInfoList { get; set; }
|
public List<MonoBehaviour> ParamDisplayInfoList { get; set; }
|
||||||
public List<MonoBehaviour> PartDisplayInfoList { get; set; }
|
public List<MonoBehaviour> PartDisplayInfoList { get; set; }
|
||||||
public List<MonoBehaviour> PosePartList { get; set; }
|
public List<MonoBehaviour> PosePartList { get; set; }
|
||||||
|
public List<AnimationClip> ClipMotionList { get; set; }
|
||||||
public GameObject ModelGameObject { get; set; }
|
public GameObject ModelGameObject { get; set; }
|
||||||
|
|
||||||
public CubismModel(GameObject m_GameObject)
|
public CubismModel(GameObject m_GameObject)
|
||||||
@ -26,6 +27,7 @@ namespace AssetStudio
|
|||||||
ParamDisplayInfoList = new List<MonoBehaviour>();
|
ParamDisplayInfoList = new List<MonoBehaviour>();
|
||||||
PartDisplayInfoList = new List<MonoBehaviour>();
|
PartDisplayInfoList = new List<MonoBehaviour>();
|
||||||
PosePartList = new List<MonoBehaviour>();
|
PosePartList = new List<MonoBehaviour>();
|
||||||
|
ClipMotionList = new List<AnimationClip>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -586,6 +586,7 @@ namespace AssetStudioCLI.Options
|
|||||||
o_exportAssetTypes.Value = new List<ClassIDType>
|
o_exportAssetTypes.Value = new List<ClassIDType>
|
||||||
{
|
{
|
||||||
ClassIDType.AnimationClip,
|
ClassIDType.AnimationClip,
|
||||||
|
ClassIDType.Animator,
|
||||||
ClassIDType.MonoBehaviour,
|
ClassIDType.MonoBehaviour,
|
||||||
ClassIDType.Texture2D,
|
ClassIDType.Texture2D,
|
||||||
};
|
};
|
||||||
|
@ -295,6 +295,7 @@ namespace AssetStudioCLI
|
|||||||
if (m_GameObject.CubismModel != null && TryGetCubismMoc(m_GameObject.CubismModel.CubismModelMono, out var mocMono))
|
if (m_GameObject.CubismModel != null && TryGetCubismMoc(m_GameObject.CubismModel.CubismModelMono, out var mocMono))
|
||||||
{
|
{
|
||||||
l2dModelDict[mocMono] = m_GameObject.CubismModel;
|
l2dModelDict[mocMono] = m_GameObject.CubismModel;
|
||||||
|
BindAnimationClips(m_GameObject);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Animator m_Animator:
|
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)
|
private static Transform GetRootTransform(Transform m_Transform)
|
||||||
{
|
{
|
||||||
if (m_Transform == null)
|
if (m_Transform == null)
|
||||||
|
@ -236,6 +236,7 @@ namespace AssetStudioGUI
|
|||||||
if (m_GameObject.CubismModel != null && TryGetCubismMoc(m_GameObject.CubismModel.CubismModelMono, out var mocMono))
|
if (m_GameObject.CubismModel != null && TryGetCubismMoc(m_GameObject.CubismModel.CubismModelMono, out var mocMono))
|
||||||
{
|
{
|
||||||
l2dModelDict[mocMono] = m_GameObject.CubismModel;
|
l2dModelDict[mocMono] = m_GameObject.CubismModel;
|
||||||
|
BindAnimationClips(m_GameObject);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Texture2D m_Texture2D:
|
case Texture2D m_Texture2D:
|
||||||
@ -1075,6 +1076,34 @@ namespace AssetStudioGUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
private static Transform GetRootTransform(Transform m_Transform)
|
||||||
{
|
{
|
||||||
if (m_Transform == null)
|
if (m_Transform == null)
|
||||||
|
@ -75,7 +75,7 @@ namespace CubismLive2DExtractor
|
|||||||
PhysicsMono = Model.PhysicsController;
|
PhysicsMono = Model.PhysicsController;
|
||||||
if (searchFadeMotions && TryGetFadeList(Model.FadeController, out var fadeMono))
|
if (searchFadeMotions && TryGetFadeList(Model.FadeController, out var fadeMono))
|
||||||
{
|
{
|
||||||
FadeMotionLst = selFadeMotionLst = fadeMono;
|
FadeMotionLst = fadeMono;
|
||||||
}
|
}
|
||||||
if (TryGetExpressionList(Model.ExpressionController, out var expressionMono))
|
if (TryGetExpressionList(Model.ExpressionController, out var expressionMono))
|
||||||
{
|
{
|
||||||
@ -107,6 +107,10 @@ namespace CubismLive2DExtractor
|
|||||||
PoseParts = Model.PosePartList;
|
PoseParts = Model.PosePartList;
|
||||||
searchPoseParts = false;
|
searchPoseParts = false;
|
||||||
}
|
}
|
||||||
|
if (Model.ClipMotionList.Count > 0 && selClipMotions == null)
|
||||||
|
{
|
||||||
|
AnimationClips = Model.ClipMotionList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach (var asset in assetGroupKvp.Value)
|
foreach (var asset in assetGroupKvp.Value)
|
||||||
{
|
{
|
||||||
@ -205,6 +209,10 @@ namespace CubismLive2DExtractor
|
|||||||
{
|
{
|
||||||
Texture2Ds = renderTextureSet.ToList();
|
Texture2Ds = renderTextureSet.ToList();
|
||||||
}
|
}
|
||||||
|
if (AnimationClips.Count > 0)
|
||||||
|
{
|
||||||
|
AnimationClips = AnimationClips.Distinct().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExtractCubismModel(string destPath, Live2DMotionMode motionMode, bool forceBezier = false, int parallelTaskCount = 1)
|
public void ExtractCubismModel(string destPath, Live2DMotionMode motionMode, bool forceBezier = false, int parallelTaskCount = 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user