mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 15:02:54 +08:00
Fix for broken player peds animating
This commit is contained in:
parent
4a00d67658
commit
b65d250774
@ -916,6 +916,7 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
|
|
||||||
public Dictionary<ushort, Bone> BonesMap { get; set; }//for convienience finding bones by tag
|
public Dictionary<ushort, Bone> BonesMap { get; set; }//for convienience finding bones by tag
|
||||||
|
public Bone[] BonesSorted { get; set; } //sometimes bones aren't in parent>child order in the files! (eg player chars)
|
||||||
|
|
||||||
|
|
||||||
public Matrix3_s[] BoneTransforms; //for rendering
|
public Matrix3_s[] BoneTransforms; //for rendering
|
||||||
@ -1116,10 +1117,12 @@ namespace CodeWalker.GameFiles
|
|||||||
BonesMap = new Dictionary<ushort, Bone>();
|
BonesMap = new Dictionary<ushort, Bone>();
|
||||||
if (Bones?.Items != null)
|
if (Bones?.Items != null)
|
||||||
{
|
{
|
||||||
|
var bonesSorted = new List<Bone>();
|
||||||
for (int i = 0; i < Bones.Items.Length; i++)
|
for (int i = 0; i < Bones.Items.Length; i++)
|
||||||
{
|
{
|
||||||
var bone = Bones.Items[i];
|
var bone = Bones.Items[i];
|
||||||
BonesMap[bone.Tag] = bone;
|
BonesMap[bone.Tag] = bone;
|
||||||
|
bonesSorted.Add(bone);
|
||||||
|
|
||||||
bone.UpdateAnimTransform();
|
bone.UpdateAnimTransform();
|
||||||
bone.AbsTransform = bone.AnimTransform;
|
bone.AbsTransform = bone.AnimTransform;
|
||||||
@ -1128,6 +1131,8 @@ namespace CodeWalker.GameFiles
|
|||||||
bone.UpdateSkinTransform();
|
bone.UpdateSkinTransform();
|
||||||
bone.TransformUnk = (i < (Transformations?.Length ?? 0)) ? Transformations[i].Column4 : Vector4.Zero;//still dont know what this is
|
bone.TransformUnk = (i < (Transformations?.Length ?? 0)) ? Transformations[i].Column4 : Vector4.Zero;//still dont know what this is
|
||||||
}
|
}
|
||||||
|
bonesSorted.Sort((a, b) => a.Index.CompareTo(b.Index));
|
||||||
|
BonesSorted = bonesSorted.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ namespace CodeWalker.Rendering
|
|||||||
|
|
||||||
var dwbl = this.Key;
|
var dwbl = this.Key;
|
||||||
var skel = Skeleton;
|
var skel = Skeleton;
|
||||||
var bones = skel?.Bones?.Items;
|
var bones = skel?.BonesSorted;//.Bones?.Items;//
|
||||||
if (bones == null)
|
if (bones == null)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
|
@ -3551,6 +3551,7 @@ namespace CodeWalker.Rendering
|
|||||||
dskel.BonesMap[srcbone.Tag] = srcbone;
|
dskel.BonesMap[srcbone.Tag] = srcbone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dskel.BonesSorted = skel.BonesSorted;//this is pretty hacky. TODO: try and fix all this! animate only the frag skeleton!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user