Skip to content

Commit

Permalink
Fixed Perfare#308
Browse files Browse the repository at this point in the history
  • Loading branch information
Perfare committed Nov 14, 2018
1 parent c0a5a7a commit b93866d
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions AssetStudio/Classes/AnimationClip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ public class GenericBinding
public uint path;
public uint attribute;
public PPtr script;
public int typeID;
public ClassIDType typeID;
public byte customType;
public byte isPPtrCurve;

Expand All @@ -774,11 +774,11 @@ public GenericBinding(ObjectReader reader)
script = reader.ReadPPtr();
if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up
{
typeID = reader.ReadInt32();
typeID = (ClassIDType)reader.ReadInt32();
}
else
{
typeID = reader.ReadUInt16();
typeID = (ClassIDType)reader.ReadUInt16();
}
customType = reader.ReadByte();
isPPtrCurve = reader.ReadByte();
Expand Down Expand Up @@ -813,7 +813,27 @@ public GenericBinding FindBinding(int index)
int curves = 0;
foreach (var b in genericBindings)
{
curves += b.attribute == 2 ? 4 : b.attribute <= 4 ? 3 : 1;
if (b.typeID == ClassIDType.Transform)
{
switch (b.attribute)
{
case 1: //kBindTransformPosition
case 3: //kBindTransformScale
case 4: //kBindTransformEuler
curves += 3;
break;
case 2: //kBindTransformRotation
curves += 4;
break;
default:
curves += 1;
break;
}
}
else
{
curves += 1;
}
if (curves > index)
{
return b;
Expand Down

0 comments on commit b93866d

Please sign in to comment.