/// <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); } }
/// <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`."); } } }
public void Assign(UMATransform other) { hash = other.hash; name = other.name; parent = other.parent; position = other.position; rotation = other.rotation; scale = other.scale; }
/// <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); } }
/// <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); }
/// <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!"); } }