Reset ped model to T pose when no animatino selected

This commit is contained in:
dexy 2019-11-08 18:58:56 +11:00
parent 8bea5281f0
commit 629ee125a5
3 changed files with 26 additions and 6 deletions

View File

@ -937,9 +937,14 @@ namespace CodeWalker.GameFiles
//SkinTransform = Matrix.Identity;//(for testing)
}
public void ResetAnimTransform()
{
AnimRotation = Rotation;
AnimTranslation = Translation;
AnimScale = Scale;
UpdateAnimTransform();
UpdateSkinTransform();
}
public static uint ElfHash_Uppercased(string str)
{

View File

@ -358,7 +358,15 @@ namespace CodeWalker.Rendering
}
public void ResetBoneTransforms()
{
if (Bones == null) return;
foreach (var bone in Bones)
{
bone.ResetAnimTransform();
}
UpdateBoneTransforms();
}
private void UpdateBoneTransforms()
{
if (Bones == null) return;
@ -390,6 +398,8 @@ namespace CodeWalker.Rendering
UpdateAnim(ClipMapEntry); //animate skeleton/models
}
UpdateBoneTransforms();
foreach (var model in HDModels)
{
if (model == null) continue;
@ -534,8 +544,6 @@ namespace CodeWalker.Rendering
}
UpdateBoneTransforms();
}
private void UpdateAnimUV(ClipMapEntry cme, RenderableGeometry rgeom = null)
{

View File

@ -2512,6 +2512,13 @@ namespace CodeWalker.Rendering
rndbl.ClipDict = animClip.Clip?.Ycd;
rndbl.HasAnims = true;
}
else if ((arche == null) && (rndbl.ClipMapEntry != null))
{
rndbl.ClipMapEntry = null;
rndbl.ClipDict = null;
rndbl.HasAnims = false;
rndbl.ResetBoneTransforms();
}
return RenderRenderable(rndbl, arche, entity);
}