Ejemplo n.º 1
0
        /// <summary>
        /// add a pose, if a pose with same name presents, overwrite it;
        ///
        /// `joints' are the joints belonging to the pose
        /// </summary>
        public void AddPose(string poseName, Transform[] joints, Transform animRoot)
        {
            DelPose(poseName); //del existing same name pose first if there is one

            PoseDesc newDesc = new PoseDesc();

            newDesc.m_PoseName = poseName;
            var data = newDesc.m_PoseData = new PoseDataDict();

            for (int idx = 0; idx < joints.Length; ++idx)
            {
                Transform j = joints[idx];

                XformData trData = new XformData();
                trData.CopyFrom(j);

                string boneTrPath = AnimationUtility.CalculateTransformPath(j, animRoot);

                if (!data.ContainsKey(boneTrPath))
                {
                    data.Add(boneTrPath, trData);
                }
                else
                {
                    Dbg.LogWarn("PoseSet.AddPose: Found duplicate bone transform path: {0}", boneTrPath);
                }
            }

            m_Poses.Add(newDesc);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// get pose data by the name
 /// if not found, return null
 /// </summary>
 public PoseDesc GetPose(string poseName)
 {
     for (int idx = 0; idx < m_Poses.Count; ++idx)
     {
         PoseDesc desc = m_Poses[idx];
         if (desc.m_PoseName == poseName)
         {
             return(desc);
         }
     }
     return(null);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// find out if there's the pose
        /// </summary>
        public bool HasPose(string poseName)
        {
            for (int idx = 0; idx < m_Poses.Count; ++idx)
            {
                PoseDesc desc = m_Poses[idx];
                if (desc.m_PoseName == poseName)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
        public bool DelPose(string poseName)
        {
            for (int idx = 0; idx < m_Poses.Count; ++idx)
            {
                PoseDesc desc = m_Poses[idx];
                if (desc.m_PoseName == poseName)
                {
                    m_Poses.RemoveAt(idx);
                    return(true);
                }
            }

            return(false);
        }