protected void ApplyTemplate()
        {
            Undo.RegisterCompleteObjectUndo(this, "Apply Template");

            HumanTemplate humanTemplate = OpenHumanTemplate();

            if (humanTemplate == null)
            {
                return;
            }

            for (int i = 0; i < m_Bones.Length; i++)
            {
                string boneName = humanTemplate.Find(m_Bones[i].humanBoneName);
                if (boneName.Length > 0)
                {
                    Transform transform = modelBones.Keys.FirstOrDefault(f => AvatarMappingEditor.MatchName(f.name, boneName));
                    m_Bones[i].bone = transform;
                }
                else
                {
                    m_Bones[i].bone = null;
                }
                m_Bones[i].Serialize(m_HumanBoneArray);
            }

            ValidateMapping();
            SceneView.RepaintAll();
        }
Exemple #2
0
        protected void ApplyTemplate()
        {
            Undo.RegisterCompleteObjectUndo(this, "Apply Template");
            HumanTemplate humanTemplate = this.OpenHumanTemplate();

            if (humanTemplate == null)
            {
                return;
            }
            for (int i = 0; i < this.m_Bones.Length; i++)
            {
                string boneName = humanTemplate.Find(this.m_Bones[i].humanBoneName);
                if (boneName.Length > 0)
                {
                    Transform bone = base.modelBones.Keys.FirstOrDefault((Transform f) => AvatarMappingEditor.MatchName(f.name, boneName));
                    this.m_Bones[i].bone = bone;
                }
                else
                {
                    this.m_Bones[i].bone = null;
                }
                this.m_Bones[i].Serialize(base.serializedObject);
            }
            this.ValidateMapping();
            SceneView.RepaintAll();
        }