mirror of
https://github.com/aelurum/AssetStudio.git
synced 2026-11-17 03:38:48 -05:00
Improve detection of Live2D models. Close #122
- Added an alternative way of model detection when a MonoScript asset is not loaded. - Fixed model detection regression after the https://github.com/aelurum/AssetStudio/commit/0066d673f45cfd07bbca4343e2fdf27660698c17
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using AssetStudio;
|
||||
using AssetStudio.Addons.CubismLive2D;
|
||||
using CubismLive2DExtractor.CubismJsonConverters;
|
||||
using CubismLive2DExtractor.CubismUnityClasses;
|
||||
using System;
|
||||
@@ -13,21 +14,6 @@ namespace CubismLive2DExtractor
|
||||
{
|
||||
public static readonly JsonSerializerOptions CubismJsonOptions;
|
||||
|
||||
public enum CubismMonoBehaviourType
|
||||
{
|
||||
FadeController,
|
||||
FadeMotionList,
|
||||
FadeMotion,
|
||||
ExpressionController,
|
||||
ExpressionList,
|
||||
Expression,
|
||||
Physics,
|
||||
DisplayInfo,
|
||||
PosePart,
|
||||
Model,
|
||||
RenderTexture,
|
||||
}
|
||||
|
||||
static CubismParsers()
|
||||
{
|
||||
CubismJsonOptions = new JsonSerializerOptions
|
||||
@@ -151,7 +137,7 @@ namespace CubismLive2DExtractor
|
||||
return JsonSerializer.Serialize(physicsJson, physicsOptions);
|
||||
}
|
||||
|
||||
public static OrderedDictionary ParseMonoBehaviour(MonoBehaviour m_MonoBehaviour, CubismMonoBehaviourType cubismMonoBehaviourType, AssemblyLoader assemblyLoader)
|
||||
public static OrderedDictionary ParseMonoBehaviour(MonoBehaviour m_MonoBehaviour, CubismHelpers.CubismMonoBehaviourType cubismMonoBehaviourType, AssemblyLoader assemblyLoader)
|
||||
{
|
||||
var orderedDict = m_MonoBehaviour.ToType();
|
||||
if (orderedDict != null)
|
||||
@@ -161,37 +147,37 @@ namespace CubismLive2DExtractor
|
||||
var m_Type = m_MonoBehaviour.ConvertToTypeTree(assemblyLoader);
|
||||
switch (cubismMonoBehaviourType)
|
||||
{
|
||||
case CubismMonoBehaviourType.FadeController:
|
||||
case CubismHelpers.CubismMonoBehaviourType.FadeController:
|
||||
fieldName = "cubismfademotionlist";
|
||||
break;
|
||||
case CubismMonoBehaviourType.FadeMotionList:
|
||||
case CubismHelpers.CubismMonoBehaviourType.FadeMotionList:
|
||||
fieldName = "cubismfademotionobjects";
|
||||
break;
|
||||
case CubismMonoBehaviourType.FadeMotion:
|
||||
case CubismHelpers.CubismMonoBehaviourType.FadeMotion:
|
||||
fieldName = "parameterids";
|
||||
break;
|
||||
case CubismMonoBehaviourType.ExpressionController:
|
||||
case CubismHelpers.CubismMonoBehaviourType.ExpressionController:
|
||||
fieldName = "expressionslist";
|
||||
break;
|
||||
case CubismMonoBehaviourType.ExpressionList:
|
||||
case CubismHelpers.CubismMonoBehaviourType.ExpressionList:
|
||||
fieldName = "cubismexpressionobjects";
|
||||
break;
|
||||
case CubismMonoBehaviourType.Expression:
|
||||
case CubismHelpers.CubismMonoBehaviourType.Expression:
|
||||
fieldName = "parameters";
|
||||
break;
|
||||
case CubismMonoBehaviourType.Physics:
|
||||
case CubismHelpers.CubismMonoBehaviourType.Physics:
|
||||
fieldName = "_rig";
|
||||
break;
|
||||
case CubismMonoBehaviourType.DisplayInfo:
|
||||
case CubismHelpers.CubismMonoBehaviourType.DisplayInfo:
|
||||
fieldName = "name";
|
||||
break;
|
||||
case CubismMonoBehaviourType.PosePart:
|
||||
case CubismHelpers.CubismMonoBehaviourType.PosePart:
|
||||
fieldName = "groupindex";
|
||||
break;
|
||||
case CubismMonoBehaviourType.Model:
|
||||
case CubismHelpers.CubismMonoBehaviourType.ModelPPtr:
|
||||
fieldName = "_moc";
|
||||
break;
|
||||
case CubismMonoBehaviourType.RenderTexture:
|
||||
case CubismHelpers.CubismMonoBehaviourType.RenderTexture:
|
||||
fieldName = "_maintexture";
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user