Ejemplo n.º 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);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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;
        }