mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-14 23:04:52 +08:00
Fix for bones on peds drawables with existing skeletons. Also included code to use geometry-specific bone matrices where boneIds array is used, but commented out since it never seems necessary (leaving in for reference)
This commit is contained in:
+19
-1
@@ -1197,7 +1197,25 @@ namespace CodeWalker.Peds
|
||||
var skel = SelectedPed.Yft?.Fragment?.Drawable?.Skeleton;
|
||||
if (skel != null)
|
||||
{
|
||||
drawable.Skeleton = skel;//force the drawable to use this skeleton.
|
||||
if (drawable.Skeleton == null)
|
||||
{
|
||||
drawable.Skeleton = skel;//force the drawable to use this skeleton.
|
||||
}
|
||||
else if (drawable.Skeleton != skel)
|
||||
{
|
||||
var dskel = drawable.Skeleton; //put the bones of the fragment into the drawable. drawable's bones in this case seem messed up!
|
||||
for (int b = 0; b < skel.Bones.Count; b++)
|
||||
{
|
||||
var srcbone = skel.Bones[b];
|
||||
var dstbone = srcbone;
|
||||
if (dskel.BonesMap.TryGetValue(srcbone.Tag, out dstbone))
|
||||
{
|
||||
if (srcbone == dstbone) break; //bone reassignment already done!
|
||||
dskel.Bones[dstbone.Index] = srcbone;
|
||||
dskel.BonesMap[srcbone.Tag] = srcbone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user