Exemple #1
0
 /// <summary>
 /// Ensures the bone exists in the skeleton.
 /// </summary>
 /// <param name="umaTransform">UMA transform.</param>
 public virtual void EnsureBone(UMATransform umaTransform)
 {
     if (boneHashData.ContainsKey(umaTransform.hash) == false)
     {
         AddBone(umaTransform);
     }
 }
Exemple #2
0
        /// <summary>
        /// Adds the transform into the skeleton.
        /// </summary>
        /// <param name="transform">Transform.</param>
        public virtual void AddBone(UMATransform transform)
        {
            var      go      = new GameObject(transform.name);
            BoneData newBone = new BoneData()
            {
                accessedFrame      = -1,
                parentBoneNameHash = transform.parent,
                boneNameHash       = transform.hash,
                boneTransform      = go.transform,
                umaTransform       = transform.Duplicate(),
            };

            if (!boneHashData.ContainsKey(transform.hash))
            {
                boneHashData.Add(transform.hash, newBone);
#if UNITY_EDITOR
                boneHashDataBackup.Add(newBone);
#endif
            }
            else
            {
                if (Debug.isDebugBuild)
                {
                    Debug.LogError("AddBone: " + transform.name + " already exists in the dictionary! Consider renaming those bones. For example, `Items` under each hand bone can become `LeftItems` and `RightItems`.");
                }
            }
        }
Exemple #3
0
 public void Assign(UMATransform other)
 {
     hash     = other.hash;
     name     = other.name;
     parent   = other.parent;
     position = other.position;
     rotation = other.rotation;
     scale    = other.scale;
 }
Exemple #4
0
        /// <summary>
        /// Ensures the bone exists in the skeleton.
        /// </summary>
        /// <param name="umaTransform">UMA transform.</param>
        public virtual void EnsureBone(UMATransform umaTransform)
        {
            BoneData res;

            if (boneHashData.TryGetValue(umaTransform.hash, out res))
            {
                res.accessedFrame = -1;
                //res.umaTransform.Assign(umaTransform);
            }
            else
            {
                AddBone(umaTransform);
            }
        }
Exemple #5
0
        /// <summary>
        /// Adds the transform into the skeleton.
        /// </summary>
        /// <param name="transform">Transform.</param>
        public virtual void AddBone(UMATransform transform)
        {
            var      go      = new GameObject(transform.name);
            BoneData newBone = new BoneData()
            {
                accessedFrame      = -1,
                parentBoneNameHash = transform.parent,
                boneNameHash       = transform.hash,
                boneTransform      = go.transform,
                umaTransform       = transform.Duplicate(),
            };

            boneHashDataBackup.Add(newBone);
            boneHashData.Add(transform.hash, newBone);
        }
Exemple #6
0
        /// <summary>
        /// Adds the transform into the skeleton.
        /// </summary>
        /// <param name="transform">Transform.</param>
        public virtual void AddBone(UMATransform transform)
        {
            var      go      = new GameObject(transform.name);
            BoneData newBone = new BoneData()
            {
                accessedFrame      = -1,
                parentBoneNameHash = transform.parent,
                boneNameHash       = transform.hash,
                boneTransform      = go.transform,
                umaTransform       = transform.Duplicate(),
            };

            if (!boneHashData.ContainsKey(transform.hash))
            {
                boneHashData.Add(transform.hash, newBone);
#if UNITY_EDITOR
                boneHashDataBackup.Add(newBone);
#endif
            }
            else
            {
                Debug.LogError("AddBone: " + transform.name + " already exists in the dictionary!");
            }
        }