support loading anims which have invalid bone ids

This commit is contained in:
in0finite 2020-03-22 00:52:58 +01:00
parent ee2922b241
commit e8581c0fee
2 changed files with 10 additions and 2 deletions

View file

@ -58,9 +58,12 @@ namespace SanAndreasUnity.Importing.Conversion
foreach (var bone in animation.Bones)
{
if (-1 == bone.BoneId) // what are these used for ?
if (!frames.HasBoneWithId(bone.BoneId)) // what are these used for ?
{
Debug.LogWarning($"Bone with id {bone.BoneId} does not exist");
continue;
}
var bFrames = bone.Frames;
var frame = frames.GetByBoneId(bone.BoneId);

View file

@ -49,6 +49,11 @@ namespace SanAndreasUnity.Behaviours
return _frames[index];
}
public bool HasBoneWithId(int boneId)
{
return _boneIdDict.ContainsKey(boneId);
}
public Frame GetByBoneId(int boneId)
{
return _boneIdDict[boneId];