コード例 #1
0
    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;
        }
    }
コード例 #2
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        ValueChangeEvent target = ValueChangeEventID.FindValueChangeEvent(property.serializedObject.targetObject as Component, property.name);

        if (target == null)
        {
            EditorGUI.LabelField(position, "(" + property.type + ")");
            return;
        }

        if (changeCheck == true)
        {
            changeCheck = false;
            target.Trigger();
            EditorUtility.SetDirty(property.serializedObject.targetObject as Component);
        }

        if (target.inspectorHighlight)
        {
            highlightProperty         = true;
            highlightStartTime        = Time.realtimeSinceStartup;
            target.inspectorHighlight = false;
        }

        if (highlightProperty == true)
        {
            HighlightFade(position, property);
        }

        Rect controlRect = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

        EditorGUI.BeginProperty(position, label, property);

        int indent = EditorGUI.indentLevel;

        EditorGUI.indentLevel = 0;

        SerializedProperty valueProperty     = property.FindPropertyRelative("value");
        SerializedProperty enumNamesProperty = property.FindPropertyRelative("enumNames");

        if (valueProperty != null)
        {
            ValueGUI(controlRect, valueProperty, enumNamesProperty);
        }
        else
        {
            TriggerGUI(controlRect);
        }

        Rect arrowRect = position;

        arrowRect.height = EditorGUIUtility.singleLineHeight;
        arrowRect.width  = position.width - controlRect.width;
        if (target.MasterCount == 0)
        {
            target.inspectorUnfold = EditorGUI.Foldout(arrowRect, target.inspectorUnfold, GUIContent.none, true, GUIStyle.none);
        }
        else
        {
            target.inspectorUnfold = EditorGUI.Foldout(arrowRect, target.inspectorUnfold, GUIContent.none, true);
        }

        if (target.inspectorUnfold)
        {
            if (mastersEditor == null || mastersEditor.target != target)
            {
                mastersEditor = new ValueChangeEventMastersEditor(target);
            }
            position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
            mastersEditor.OnGUI(position, ref changeCheck);
        }
        else if (mastersEditor != null)
        {
            mastersEditor = null;
        }

        EditorGUI.indentLevel = indent;
        EditorGUI.EndProperty();
    }