// public method #endregion "public method" #region "private method" // private method private void _DrawShapeKeyData(ShapeKeyMorphSO morph, int keyIdx) { ShapeKeyDataDiff keyData = morph.GetShapeKeyDataDiff(keyIdx); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Weight:", GUILayout.Width(50f)); float newWeight = keyData.weight; if (EUtil.FloatField("weight" + keyIdx, ref newWeight)) //only true when use enter to confirm { morph.SetShapeKeyWeight(keyIdx, newWeight); //this will ensure all keys are sorted } if (EUtil.Button(EditorRes.texSample, "Sample current mesh status as shape key", EditorRes.styleBtnMorphProc, GUILayout.Width(20f))) { morph.SetMeshCurrentDataToShapeKey(keyIdx); } if (EUtil.Button(EditorRes.texApplyToMesh, "Apply this shape key to mesh", EditorRes.styleBtnMorphProc, GUILayout.Width(20f))) { Undo.RecordObject(m_MorphProc, "MorphProc Inspector"); m_MorphProc.ResetToBasisShape(); m_MorphProc.ApplyOnlyMorphAt(m_MorphIdx, keyData.weight); } if (EUtil.Button(EditorRes.texDelete, "Delete this shape key from this morph", EditorRes.styleBtnMorphProc, GUILayout.Width(20f))) { if (morph.ShapeKeyCnt == 1) { EditorUtility.DisplayDialog("Only one shape key", "Cannot delete shape key when there's no others", "Got it"); } else { morph.DelShapeKeyDataDiff(keyIdx); } } } EditorGUILayout.EndHorizontal(); }