public static ObservableCollection <AnimatedBone> CreateFromSkeleton(AnimationFile file, List <int> boneIndexUsedByModel = null) { var output = new ObservableCollection <AnimatedBone>(); foreach (var boneInfo in file.Bones) { var parent = FindBoneInList(boneInfo.ParentId, output); var newNode = new AnimatedBone() { BoneIndex = boneInfo.Id, Name = boneInfo.Name }; if (boneIndexUsedByModel == null) { newNode.IsUsedByCurrentModel = true; } else { newNode.IsUsedByCurrentModel = boneIndexUsedByModel.Contains((byte)boneInfo.Id); } if (parent == null) { output.Add(newNode); } else { parent.Children.Add(newNode); } } return(output); }
static void RecusrivlyBuildMappingList(AnimatedBone bone, List <IndexRemapping> output) { if (bone.MappedBoneIndex != -1) { var mapping = new IndexRemapping((byte)bone.BoneIndex, (byte)bone.MappedBoneIndex); output.Add(mapping); } foreach (var child in bone.Children) { RecusrivlyBuildMappingList(child, output); } }