private void ParameterEventControlGUILayout(AnimatorParameterEvent target) { Rect controlRect = EditorGUILayout.GetControlRect(); EditorGUI.BeginChangeCheck(); switch (target.Type) { case AnimatorControllerParameterType.Trigger: Rect triggerRect = EditorGUI.IndentedRect(controlRect); triggerRect.x--; if (GUI.Button(triggerRect, "", EditorStyles.radioButton)) { GUI.changed = true; } break; case AnimatorControllerParameterType.Bool: target.VCE.Value = EditorGUI.Toggle(controlRect, GUIContent.none, (bool)target.VCE.Value); break; case AnimatorControllerParameterType.Int: target.VCE.Value = EditorGUI.IntField(controlRect, GUIContent.none, (int)target.VCE.Value); break; case AnimatorControllerParameterType.Float: target.VCE.Value = EditorGUI.FloatField(controlRect, GUIContent.none, (float)target.VCE.Value); break; } if (EditorGUI.EndChangeCheck()) { target.VCE.Trigger(); } }
private void ParameterEventGUILayout(AnimatorParameterEvent target, ref ValueChangeEventMastersEditor mastersEditor) { bool inspectMasters = (mastersEditor != null); EditorGUILayout.BeginHorizontal(); inspectMasters = EditorGUILayout.Foldout(inspectMasters, target.name, true); ParameterEventControlGUILayout(target); EditorGUILayout.EndHorizontal(); if (inspectMasters) { Rect position = EditorGUILayout.GetControlRect(); bool changeCheck = false; if (mastersEditor == null || mastersEditor.target != target.VCE) { mastersEditor = new ValueChangeEventMastersEditor(target.VCE); } mastersEditor.OnGUI(position, ref changeCheck); GUILayout.Space(mastersEditor.GetHeight()); } else if (mastersEditor != null) { mastersEditor = null; } }