示例#1
0
            // public method

            #endregion "public method"

            #region "private method"

            private void _DrawDeformEntry(MorphProc proc, int deformIdx, bool isBasis = true)
            {
                ShapeKeyMorphSO deform = (ShapeKeyMorphSO)m_propDeforms.GetArrayElementAtIndex(deformIdx).objectReferenceValue;

                EditorGUILayout.BeginHorizontal();
                {
                    float newWeight = 0f;

                    // weight
                    if (isBasis)
                    {
                        EUtil.PushGUIEnable(false);
                    }

                    EditorGUI.BeginChangeCheck();
                    newWeight = EditorGUILayout.FloatField(deform.name, m_propAnimWeights[deformIdx].floatValue);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_propAnimWeights[deformIdx].floatValue = Mathf.Clamp(newWeight, 0, 100f);
                    }

                    if (isBasis)
                    {
                        EUtil.PopGUIEnable();
                    }

                    // after weight
                    if (isBasis)
                    { //the basis
                        GUILayout.Space(20f);
                        if (EUtil.Button("R", "Reset as Basis", Color.green, GUILayout.Width(42f)))
                        {
                            Undo.RecordObject(proc, "MorphProc Inspector");
                            proc.ResetToBasisShape();
                        }
                    }
                    else
                    {
                        if (GUILayout.Button(new GUIContent(m_texDetail, "Edit details of this deform"), m_styleBtn, GUILayout.Width(20f)))
                        {
                            var e = (BaseMorphSOEditor)Editor.CreateEditor(deform);
                            e.m_MorphProcEditor = this;
                            e.m_MorphProc       = proc;
                            e.m_MorphIdx        = deformIdx;
                            EditorEditorWindow.OpenWindowWithEditor(e);
                        }

                        if (GUILayout.Button(new GUIContent(m_texApply, "Apply only this deform 100%"), m_styleBtn, GUILayout.Width(20f)))
                        {
                            Undo.RecordObject(proc, "MorphProc Inspector");
                            proc.ApplyOnlyMorphAt(deformIdx);
                        }

                        if (GUILayout.Button(new GUIContent(m_texDelete, "Delete this deform"), m_styleBtn, GUILayout.Width(20f)))
                        {
                            if (EditorUtility.DisplayDialog("To be or not to be", "Are you sure to delete this Morph?", "Go Ahead", "No No No"))
                            {
                                Undo.RecordObject(proc, "MorphProc Inspector");
                                proc.RemoveShapeKeyMorphAt(deformIdx);
                            }
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();
            }