//----------------------------------------------------------------------- ////////////////////////////////////////////////////////////////////////// // PUBLIC METHODS ////////////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------- public void AddBone(AnimationBone bone) { if (boneList.Count == 0) rootBone = bone; boneList.Add(bone); boneIndexByName.Add(bone.GetName(), boneList.Count - 1); }
//----------------------------------------------------------------------- ////////////////////////////////////////////////////////////////////////// // PUBLIC METHODS ////////////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------- public AnimationBone CreateChildBone(string name) { AnimationBone bone = new AnimationBone(name, skeleton); bone.parent = this; children.Add(bone); skeleton.AddBone(bone); return bone; }
private static void CreateChildBones(SerializableBone parentBoneContent, AnimationBone parentBone) { foreach (SerializableBone childBoneContent in parentBoneContent.children) { AnimationBone childBond = parentBone.CreateChildBone(childBoneContent.name); childBond.SetLocalTransform(ref childBoneContent.matrixLocalTransform); CreateChildBones(childBoneContent, childBond); } }
//----------------------------------------------------------------------- public void RemoveBone(AnimationBone bone) { boneList.Remove(bone); boneIndexByName.Clear(); for (int i = 0; i < boneList.Count; i++) { boneIndexByName.Add(boneList[i].GetName(), i); } }
private static AnimationSkeleton CreateSkeleton(SerializableSkeleton skeletonContent) { AnimationSkeleton skeleton = new AnimationSkeleton(); SerializableBone rootContent = skeletonContent.rootBone; AnimationBone root = new AnimationBone(rootContent.name, skeleton); root.SetLocalTransform(rootContent.matrixLocalTransform); skeleton.AddBone(root); CreateChildBones(rootContent, root); return skeleton; }