Beispiel #1
0
        protected sealed override void Editor_OnInspectorGUI()
        {
            // Edit Button

            _rect       = EditorGUILayout.GetControlRect(true, _editButtonHeight);
            _rect.x    += EditorGUIUtility.labelWidth;
            _rect.width = _editButtonWidth;

            EditorGUI.BeginChangeCheck();
            EditorKit.RecordAndSetGUIContentColor(EditorKit.defaultContentColor);
            bool edit = GUI.Toggle(_rect, _currentEditing == this, EditorAssets.editTexture, EditorKit.buttonStyle);

            EditorKit.RestoreGUIContentColor();
            if (EditorGUI.EndChangeCheck())
            {
                SetCurrentEditing(edit ? this : null);
            }

            // Edit Label

            _rect.x     = _rect.xMax + _horizontalInterval;
            _rect.width = 128f;
            EditorGUI.LabelField(_rect, "Edit Path", middleLeftLabel);

            // Circular

            editor.DrawToggleLayout(circular, value => circular = value, "Circular");

            // World Scale

            EditorGUI.BeginChangeCheck();
            float scale = EditorGUILayout.FloatField(_worldScaleContent, worldScale);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(this, editor.undoString);
                worldScale = scale;
                EditorUtility.SetDirty(this);
            }

            // Length Error

            editor.DrawFloatFieldLayout(lengthError, value => lengthError = value, "Length Error");

            // Length

            if (isSamplesValid)
            {
                EditorGUILayout.FloatField("Length", length);
            }
            else
            {
                _rect = EditorGUILayout.GetControlRect();
                EditorGUI.LabelField(_rect, "Length");
                _rect.xMin += EditorGUIUtility.labelWidth;

                // Calculate Button

                if (GUI.Button(_rect, "Calculate", EditorStyles.miniButton))
                {
                    Undo.RecordObject(this, editor.undoString);
                    ValidateSamples();
                    EditorUtility.SetDirty(this);
                }
            }

            // Always Visible Button
            _alwaysVisible = EditorKit.IndentedToggle("Always Visible", _alwaysVisible);
        }