void CreateBoneOverview(GameSkeleton skeleton) { SelectedBone = null; Bones.Clear(); BoneCount = 0; if (skeleton == null) { return; } BoneCount = skeleton.BoneCount; for (int i = 0; i < skeleton.BoneCount; i++) { var parentBoneId = skeleton.GetParentBone(i); if (parentBoneId == -1) { Bones.Add(CreateNode(i, parentBoneId, skeleton.BoneNames[i])); } else { var treeParent = GetParent(Bones, parentBoneId); if (treeParent != null) { treeParent.Children.Add(CreateNode(i, parentBoneId, skeleton.BoneNames[i])); } } } }
SkeletonBoneNode CreateNode(int boneId, int parentBoneId, string boneName) { SkeletonBoneNode item = new SkeletonBoneNode { BoneIndex = boneId, BoneName = boneName, ParentBoneIndex = parentBoneId }; return(item); }