mirror of
https://github.com/simtactics/niotso.git
synced 2025-03-15 08:11:22 +00:00
Fixed writing to Skeleton.Bones[-1] when FindBone() returns -1 because, say, PELVISPOLY does not exist
This commit is contained in:
parent
e3f6880ed2
commit
6df7a494a1
1 changed files with 17 additions and 14 deletions
|
@ -217,20 +217,23 @@ void AdvanceFrame(Skeleton_t& Skeleton, Animation_t& Animation){
|
|||
static unsigned Frame = 0;
|
||||
|
||||
for(unsigned i=0; i<Animation.MotionsCount; i++){
|
||||
Bone_t& Bone = Skeleton.Bones[FindBone(Skeleton, Animation.Motions[i].BoneName, Skeleton.BoneCount)];
|
||||
|
||||
if(Animation.Motions[i].HasTranslation){
|
||||
Translation_t& Translation = Animation.Motions[i].Translations[Frame];
|
||||
Bone.Translation.x = Translation.x;
|
||||
Bone.Translation.y = Translation.y;
|
||||
Bone.Translation.z = Translation.z;
|
||||
}
|
||||
if(Animation.Motions[i].HasRotation){
|
||||
Rotation_t& Rotation = Animation.Motions[i].Rotations[Frame];
|
||||
Bone.Rotation.x = Rotation.x;
|
||||
Bone.Rotation.y = Rotation.y;
|
||||
Bone.Rotation.z = Rotation.z;
|
||||
Bone.Rotation.w = Rotation.w;
|
||||
unsigned BoneIndex = FindBone(Skeleton, Animation.Motions[i].BoneName, Skeleton.BoneCount);
|
||||
if(BoneIndex != (unsigned)-1){
|
||||
Bone_t& Bone = Skeleton.Bones[BoneIndex];
|
||||
|
||||
if(Animation.Motions[i].HasTranslation){
|
||||
Translation_t& Translation = Animation.Motions[i].Translations[Frame];
|
||||
Bone.Translation.x = Translation.x;
|
||||
Bone.Translation.y = Translation.y;
|
||||
Bone.Translation.z = Translation.z;
|
||||
}
|
||||
if(Animation.Motions[i].HasRotation){
|
||||
Rotation_t& Rotation = Animation.Motions[i].Rotations[Frame];
|
||||
Bone.Rotation.x = Rotation.x;
|
||||
Bone.Rotation.y = Rotation.y;
|
||||
Bone.Rotation.z = Rotation.z;
|
||||
Bone.Rotation.w = Rotation.w;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue