Example #1
0
        public void SetMeshAnimationData(MeshData m,AnimationData d)
        {
            _meshData = m;
            _meshAnimationData = d;

            MeshJoints.Clear();
            foreach (var joint in d.Bones)
            {
                MeshJoints.Add(joint.Name,joint);
            }

            LinkedJoints.Clear();

            var jointOrder = new List<JointType>
            {
                JointType.HipCenter,
                JointType.HipLeft,
                JointType.KneeLeft,
                JointType.AnkleLeft,
                JointType.FootLeft,
                JointType.HipRight,
                JointType.KneeRight,
                JointType.AnkleRight,
                JointType.FootRight,
                JointType.Spine,
                JointType.ShoulderCenter,
                JointType.Head,
                JointType.ShoulderLeft,
                JointType.ElbowLeft,
                JointType.WristLeft,
                JointType.HandLeft,
                JointType.ShoulderRight,
                JointType.ElbowRight,
                JointType.WristRight,
                JointType.HandRight
            };

            foreach (var j in jointOrder)
                LinkedJoints.Add(j, new AnimationJoint());

            RaisePropertyChanged("LinkedJoints");
            RaisePropertyChanged("MeshJoints");


            #if (DEBUG)
            {
                Load("Resources/Links/KnightLinks.xml");
            }
            #endif
        }
Example #2
0
        private void Load(string file)
        {
            var root = XElement.Load(file);

            foreach (var x in root.Elements())
            {
                JointType kiJoint;
                Enum.TryParse(x.Element("KinectJoint").Value, out kiJoint);
                var meshJoint = x.Element("MeshJoint").Value;

                if (!meshJoint.Equals("Not Set"))
                {
                    if (MeshJoints.ContainsKey(meshJoint))
                        LinkedJoints[kiJoint] = MeshJoints[meshJoint];
                }
                else
                {
                    LinkedJoints[kiJoint] = new AnimationJoint();
                }
            }
        }