- [Core] Fix bug with assets parsing.
This commit is contained in:
@@ -38,15 +38,15 @@ namespace AssetStudio
|
||||
|
||||
public class SkeletonMask
|
||||
{
|
||||
public SkeletonMaskElement[] m_Data;
|
||||
public List<SkeletonMaskElement> m_Data;
|
||||
|
||||
public SkeletonMask(ObjectReader reader)
|
||||
{
|
||||
int numElements = reader.ReadInt32();
|
||||
m_Data = new SkeletonMaskElement[numElements];
|
||||
m_Data = new List<SkeletonMaskElement>();
|
||||
for (int i = 0; i < numElements; i++)
|
||||
{
|
||||
m_Data[i] = new SkeletonMaskElement(reader);
|
||||
m_Data.Add(new SkeletonMaskElement(reader));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ namespace AssetStudio
|
||||
|
||||
public class TransitionConstant
|
||||
{
|
||||
public ConditionConstant[] m_ConditionConstantArray;
|
||||
public List<ConditionConstant> m_ConditionConstantArray;
|
||||
public uint m_DestinationState;
|
||||
public uint m_FullPathID;
|
||||
public uint m_ID;
|
||||
@@ -124,10 +124,10 @@ namespace AssetStudio
|
||||
var version = reader.version;
|
||||
|
||||
int numConditions = reader.ReadInt32();
|
||||
m_ConditionConstantArray = new ConditionConstant[numConditions];
|
||||
m_ConditionConstantArray = new List<ConditionConstant>();
|
||||
for (int i = 0; i < numConditions; i++)
|
||||
{
|
||||
m_ConditionConstantArray[i] = new ConditionConstant(reader);
|
||||
m_ConditionConstantArray.Add(new ConditionConstant(reader));
|
||||
}
|
||||
|
||||
m_DestinationState = reader.ReadUInt32();
|
||||
@@ -191,7 +191,7 @@ namespace AssetStudio
|
||||
public float[] m_ChildMagnitudeArray;
|
||||
public Vector2[] m_ChildPairVectorArray;
|
||||
public float[] m_ChildPairAvgMagInvArray;
|
||||
public MotionNeighborList[] m_ChildNeighborListArray;
|
||||
public List<MotionNeighborList> m_ChildNeighborListArray;
|
||||
|
||||
public Blend2dDataConstant(ObjectReader reader)
|
||||
{
|
||||
@@ -201,10 +201,10 @@ namespace AssetStudio
|
||||
m_ChildPairAvgMagInvArray = reader.ReadSingleArray();
|
||||
|
||||
int numNeighbours = reader.ReadInt32();
|
||||
m_ChildNeighborListArray = new MotionNeighborList[numNeighbours];
|
||||
m_ChildNeighborListArray = new List<MotionNeighborList>();
|
||||
for (int i = 0; i < numNeighbours; i++)
|
||||
{
|
||||
m_ChildNeighborListArray[i] = new MotionNeighborList(reader);
|
||||
m_ChildNeighborListArray.Add(new MotionNeighborList(reader));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -303,7 +303,7 @@ namespace AssetStudio
|
||||
|
||||
public class BlendTreeConstant
|
||||
{
|
||||
public BlendTreeNodeConstant[] m_NodeArray;
|
||||
public List<BlendTreeNodeConstant> m_NodeArray;
|
||||
public ValueArrayConstant m_BlendEventArrayConstant;
|
||||
|
||||
public BlendTreeConstant(ObjectReader reader)
|
||||
@@ -311,10 +311,10 @@ namespace AssetStudio
|
||||
var version = reader.version;
|
||||
|
||||
int numNodes = reader.ReadInt32();
|
||||
m_NodeArray = new BlendTreeNodeConstant[numNodes];
|
||||
m_NodeArray = new List<BlendTreeNodeConstant>();
|
||||
for (int i = 0; i < numNodes; i++)
|
||||
{
|
||||
m_NodeArray[i] = new BlendTreeNodeConstant(reader);
|
||||
m_NodeArray.Add(new BlendTreeNodeConstant(reader));
|
||||
}
|
||||
|
||||
if (version[0] < 4 || (version[0] == 4 && version[1] < 5)) //4.5 down
|
||||
@@ -327,10 +327,10 @@ namespace AssetStudio
|
||||
|
||||
public class StateConstant
|
||||
{
|
||||
public TransitionConstant[] m_TransitionConstantArray;
|
||||
public List<TransitionConstant> m_TransitionConstantArray;
|
||||
public int[] m_BlendTreeConstantIndexArray;
|
||||
public LeafInfoConstant[] m_LeafInfoArray;
|
||||
public BlendTreeConstant[] m_BlendTreeConstantArray;
|
||||
public List<LeafInfoConstant> m_LeafInfoArray;
|
||||
public List<BlendTreeConstant> m_BlendTreeConstantArray;
|
||||
public uint m_NameID;
|
||||
public uint m_PathID;
|
||||
public uint m_FullPathID;
|
||||
@@ -350,10 +350,10 @@ namespace AssetStudio
|
||||
var version = reader.version;
|
||||
|
||||
int numTransistions = reader.ReadInt32();
|
||||
m_TransitionConstantArray = new TransitionConstant[numTransistions];
|
||||
m_TransitionConstantArray = new List<TransitionConstant>();
|
||||
for (int i = 0; i < numTransistions; i++)
|
||||
{
|
||||
m_TransitionConstantArray[i] = new TransitionConstant(reader);
|
||||
m_TransitionConstantArray.Add(new TransitionConstant(reader));
|
||||
}
|
||||
|
||||
m_BlendTreeConstantIndexArray = reader.ReadInt32Array();
|
||||
@@ -361,18 +361,18 @@ namespace AssetStudio
|
||||
if (version[0] < 5 || (version[0] == 5 && version[1] < 2)) //5.2 down
|
||||
{
|
||||
int numInfos = reader.ReadInt32();
|
||||
m_LeafInfoArray = new LeafInfoConstant[numInfos];
|
||||
m_LeafInfoArray = new List<LeafInfoConstant>();
|
||||
for (int i = 0; i < numInfos; i++)
|
||||
{
|
||||
m_LeafInfoArray[i] = new LeafInfoConstant(reader);
|
||||
m_LeafInfoArray.Add(new LeafInfoConstant(reader));
|
||||
}
|
||||
}
|
||||
|
||||
int numBlends = reader.ReadInt32();
|
||||
m_BlendTreeConstantArray = new BlendTreeConstant[numBlends];
|
||||
m_BlendTreeConstantArray = new List<BlendTreeConstant>();
|
||||
for (int i = 0; i < numBlends; i++)
|
||||
{
|
||||
m_BlendTreeConstantArray[i] = new BlendTreeConstant(reader);
|
||||
m_BlendTreeConstantArray.Add(new BlendTreeConstant(reader));
|
||||
}
|
||||
|
||||
m_NameID = reader.ReadUInt32();
|
||||
@@ -428,34 +428,34 @@ namespace AssetStudio
|
||||
public class SelectorTransitionConstant
|
||||
{
|
||||
public uint m_Destination;
|
||||
public ConditionConstant[] m_ConditionConstantArray;
|
||||
public List<ConditionConstant> m_ConditionConstantArray;
|
||||
|
||||
public SelectorTransitionConstant(ObjectReader reader)
|
||||
{
|
||||
m_Destination = reader.ReadUInt32();
|
||||
|
||||
int numConditions = reader.ReadInt32();
|
||||
m_ConditionConstantArray = new ConditionConstant[numConditions];
|
||||
m_ConditionConstantArray = new List<ConditionConstant>();
|
||||
for (int i = 0; i < numConditions; i++)
|
||||
{
|
||||
m_ConditionConstantArray[i] = new ConditionConstant(reader);
|
||||
m_ConditionConstantArray.Add(new ConditionConstant(reader));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SelectorStateConstant
|
||||
{
|
||||
public SelectorTransitionConstant[] m_TransitionConstantArray;
|
||||
public List<SelectorTransitionConstant> m_TransitionConstantArray;
|
||||
public uint m_FullPathID;
|
||||
public bool m_isEntry;
|
||||
|
||||
public SelectorStateConstant(ObjectReader reader)
|
||||
{
|
||||
int numTransitions = reader.ReadInt32();
|
||||
m_TransitionConstantArray = new SelectorTransitionConstant[numTransitions];
|
||||
m_TransitionConstantArray = new List<SelectorTransitionConstant>();
|
||||
for (int i = 0; i < numTransitions; i++)
|
||||
{
|
||||
m_TransitionConstantArray[i] = new SelectorTransitionConstant(reader);
|
||||
m_TransitionConstantArray.Add(new SelectorTransitionConstant(reader));
|
||||
}
|
||||
|
||||
m_FullPathID = reader.ReadUInt32();
|
||||
@@ -466,9 +466,9 @@ namespace AssetStudio
|
||||
|
||||
public class StateMachineConstant
|
||||
{
|
||||
public StateConstant[] m_StateConstantArray;
|
||||
public TransitionConstant[] m_AnyStateTransitionConstantArray;
|
||||
public SelectorStateConstant[] m_SelectorStateConstantArray;
|
||||
public List<StateConstant> m_StateConstantArray;
|
||||
public List<TransitionConstant> m_AnyStateTransitionConstantArray;
|
||||
public List<SelectorStateConstant> m_SelectorStateConstantArray;
|
||||
public uint m_DefaultState;
|
||||
public uint m_MotionSetCount;
|
||||
|
||||
@@ -477,26 +477,26 @@ namespace AssetStudio
|
||||
var version = reader.version;
|
||||
|
||||
int numStates = reader.ReadInt32();
|
||||
m_StateConstantArray = new StateConstant[numStates];
|
||||
m_StateConstantArray = new List<StateConstant>();
|
||||
for (int i = 0; i < numStates; i++)
|
||||
{
|
||||
m_StateConstantArray[i] = new StateConstant(reader);
|
||||
m_StateConstantArray.Add(new StateConstant(reader));
|
||||
}
|
||||
|
||||
int numAnyStates = reader.ReadInt32();
|
||||
m_AnyStateTransitionConstantArray = new TransitionConstant[numAnyStates];
|
||||
m_AnyStateTransitionConstantArray = new List<TransitionConstant>();
|
||||
for (int i = 0; i < numAnyStates; i++)
|
||||
{
|
||||
m_AnyStateTransitionConstantArray[i] = new TransitionConstant(reader);
|
||||
m_AnyStateTransitionConstantArray.Add(new TransitionConstant(reader));
|
||||
}
|
||||
|
||||
if (version[0] >= 5) //5.0 and up
|
||||
{
|
||||
int numSelectors = reader.ReadInt32();
|
||||
m_SelectorStateConstantArray = new SelectorStateConstant[numSelectors];
|
||||
m_SelectorStateConstantArray = new List<SelectorStateConstant>();
|
||||
for (int i = 0; i < numSelectors; i++)
|
||||
{
|
||||
m_SelectorStateConstantArray[i] = new SelectorStateConstant(reader);
|
||||
m_SelectorStateConstantArray.Add(new SelectorStateConstant(reader));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,21 +533,11 @@ namespace AssetStudio
|
||||
}
|
||||
else
|
||||
{
|
||||
int numPosValues = reader.ReadInt32();
|
||||
m_PositionValues = new Vector3[numPosValues];
|
||||
for (int i = 0; i < numPosValues; i++)
|
||||
{
|
||||
m_PositionValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up
|
||||
}
|
||||
m_PositionValues = reader.ReadVector3Array();
|
||||
|
||||
m_QuaternionValues = reader.ReadVector4Array();
|
||||
|
||||
int numScaleValues = reader.ReadInt32();
|
||||
m_ScaleValues = new Vector3[numScaleValues];
|
||||
for (int i = 0; i < numScaleValues; i++)
|
||||
{
|
||||
m_ScaleValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up
|
||||
}
|
||||
m_ScaleValues = reader.ReadVector3Array();
|
||||
|
||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up
|
||||
{
|
||||
@@ -562,25 +552,25 @@ namespace AssetStudio
|
||||
|
||||
public class ControllerConstant
|
||||
{
|
||||
public LayerConstant[] m_LayerArray;
|
||||
public StateMachineConstant[] m_StateMachineArray;
|
||||
public List<LayerConstant> m_LayerArray;
|
||||
public List<StateMachineConstant> m_StateMachineArray;
|
||||
public ValueArrayConstant m_Values;
|
||||
public ValueArray m_DefaultValues;
|
||||
|
||||
public ControllerConstant(ObjectReader reader)
|
||||
{
|
||||
int numLayers = reader.ReadInt32();
|
||||
m_LayerArray = new LayerConstant[numLayers];
|
||||
m_LayerArray = new List<LayerConstant>();
|
||||
for (int i = 0; i < numLayers; i++)
|
||||
{
|
||||
m_LayerArray[i] = new LayerConstant(reader);
|
||||
m_LayerArray.Add(new LayerConstant(reader));
|
||||
}
|
||||
|
||||
int numStates = reader.ReadInt32();
|
||||
m_StateMachineArray = new StateMachineConstant[numStates];
|
||||
m_StateMachineArray = new List<StateMachineConstant>();
|
||||
for (int i = 0; i < numStates; i++)
|
||||
{
|
||||
m_StateMachineArray[i] = new StateMachineConstant(reader);
|
||||
m_StateMachineArray.Add(new StateMachineConstant(reader));
|
||||
}
|
||||
|
||||
m_Values = new ValueArrayConstant(reader);
|
||||
@@ -591,7 +581,7 @@ namespace AssetStudio
|
||||
public sealed class AnimatorController : RuntimeAnimatorController
|
||||
{
|
||||
public Dictionary<uint, string> m_TOS;
|
||||
public PPtr<AnimationClip>[] m_AnimationClips;
|
||||
public List<PPtr<AnimationClip>> m_AnimationClips;
|
||||
|
||||
public AnimatorController(ObjectReader reader) : base(reader)
|
||||
{
|
||||
@@ -599,17 +589,17 @@ namespace AssetStudio
|
||||
var m_Controller = new ControllerConstant(reader);
|
||||
|
||||
int tosSize = reader.ReadInt32();
|
||||
m_TOS = new Dictionary<uint, string>(tosSize);
|
||||
m_TOS = new Dictionary<uint, string>();
|
||||
for (int i = 0; i < tosSize; i++)
|
||||
{
|
||||
m_TOS.Add(reader.ReadUInt32(), reader.ReadAlignedString());
|
||||
}
|
||||
|
||||
int numClips = reader.ReadInt32();
|
||||
m_AnimationClips = new PPtr<AnimationClip>[numClips];
|
||||
m_AnimationClips = new List<PPtr<AnimationClip>>();
|
||||
for (int i = 0; i < numClips; i++)
|
||||
{
|
||||
m_AnimationClips[i] = new PPtr<AnimationClip>(reader);
|
||||
m_AnimationClips.Add(new PPtr<AnimationClip>(reader));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user