Example #1
0
        //-----------------------------------------------------------------------
        //////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //////////////////////////////////////////////////////////////////////////
        //-----------------------------------------------------------------------
        public void AddBone(AnimationBone bone)
        {
            if (boneList.Count == 0)
                rootBone = bone;

            boneList.Add(bone);
            boneIndexByName.Add(bone.GetName(), boneList.Count - 1);
        }
Example #2
0
        //-----------------------------------------------------------------------
        //////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //////////////////////////////////////////////////////////////////////////
        //-----------------------------------------------------------------------
        public AnimationBone CreateChildBone(string name)
        {
            AnimationBone bone = new AnimationBone(name, skeleton);
            bone.parent = this;
            children.Add(bone);
            skeleton.AddBone(bone);

            return bone;
        }
Example #3
0
        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);
            }
        }
Example #4
0
        //-----------------------------------------------------------------------
        public void RemoveBone(AnimationBone bone)
        {
            boneList.Remove(bone);
            boneIndexByName.Clear();

            for (int i = 0; i < boneList.Count; i++)
            {
                boneIndexByName.Add(boneList[i].GetName(), i);
            }
        }
Example #5
0
        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;
        }