예제 #1
0
        public override void OnInspectorGUI()
        {
            #region Init
            blendee = (VertexBlendApplicator)target;
            #endregion

            #region Brush Settings
            GUILayout.Space(4);
            shouldDoBrush   = EditorGUILayout.ToggleLeft("Enable (Tab)", shouldDoBrush);
            displayVertices = EditorGUILayout.ToggleLeft("Display Vertices", displayVertices);
            maxRadius       = EditorGUILayout.FloatField("Radius", maxRadius);
            maxRadius       = Mathf.Abs(maxRadius);
            #endregion

            GUILayout.Space(8);

            doColorBrush = EditorGUILayout.ToggleLeft("Do Color", doColorBrush, (GUIStyle)"ShurikenModuleTitle");
            if (doColorBrush)
            {
                GUILayout.Space(4);
                paintColor = EditorGUILayout.ColorField("Color", paintColor);

                Rect colorShortcuts = EditorGUILayout.GetControlRect();
                Rect swatch         = colorShortcuts;
                swatch.x     += (colorShortcuts.width / 2);
                swatch.width  = 20;
                swatch.height = 20;

                for (int i = 0; i < colorSwatches.Length; i++)
                {
                    EditorGUI.DrawRect(swatch, Colors.BlackChocolate);
                    EditorGUI.DrawRect(swatch.WithPadding(4), colorSwatches[i]);
                    if (EditorGUIExtensions.RightClickOnRect(swatch))
                    {
                        paintColor = colorSwatches[i];
                        Repaint();
                    }

                    swatch.x = swatch.xMax + 2;
                }

                GUILayout.Space(8);
            }

            doHeightBrush = EditorGUILayout.ToggleLeft("Do Height", doHeightBrush, (GUIStyle)"ShurikenModuleTitle");
            if (doHeightBrush)
            {
                GUILayout.Space(4);
                texCoord3.z = EditorGUILayout.Slider("Height", texCoord3.z, -1, 1);
                GUILayout.Space(8);
            }

            doFalloffBrush = EditorGUILayout.ToggleLeft("Do Falloff", doFalloffBrush, (GUIStyle)"ShurikenModuleTitle");
            if (doFalloffBrush)
            {
                GUILayout.Space(4);
                texCoord3.w = EditorGUILayout.Slider("Falloff", texCoord3.w, 0.001f, 1);
                GUILayout.Space(8);
            }
        }
예제 #2
0
 private void OnEnable()
 {
     blendee = (VertexBlendApplicator)target;
     Undo.undoRedoPerformed += OnUndoRedo;
     maxRadius = EditorPrefs.GetFloat("SuperBlend.MaxBrushRadius", 1.0f);
 }