Esempio n. 1
0
        private void OnToolbarGUI(int windowID)
        {
            EditorGUILayout.Space();

            restrictToFace = SabreGUILayout.Toggle(restrictToFace, "Restrict To Face");
            drawingMode    = SabreGUILayout.DrawEnumGrid(drawingMode);

            // radius slider
            EditorGUILayout.BeginHorizontal();
            GUI.color = Color.black;
            GUILayout.Label("Radius");
            GUI.color   = Color.white;
            brushRadius = EditorGUILayout.Slider("", brushRadius, 0.1f, 5f, GUILayout.MaxWidth(128));
            EditorGUILayout.EndHorizontal();

            // opacity slider
            EditorGUILayout.BeginHorizontal();
            GUI.color = Color.black;
            GUILayout.Label("Opacity");
            GUI.color = Color.white;

            switch (drawingMode)
            {
            case DrawingMode.Color:
                colorBrushStrength = EditorGUILayout.Slider("", colorBrushStrength, 0f, 1f, GUILayout.MaxWidth(128));
                break;

            case DrawingMode.R:
                redBrushStrength = EditorGUILayout.Slider("", redBrushStrength, 0f, 1f, GUILayout.MaxWidth(128));
                break;

            case DrawingMode.G:
                greenBrushStrength = EditorGUILayout.Slider("", greenBrushStrength, 0f, 1f, GUILayout.MaxWidth(128));
                break;

            case DrawingMode.B:
                blueBrushStrength = EditorGUILayout.Slider("", blueBrushStrength, 0f, 1f, GUILayout.MaxWidth(128));
                break;

            case DrawingMode.Alpha:
                alphaBrushStrength = EditorGUILayout.Slider("", alphaBrushStrength, 0f, 1f, GUILayout.MaxWidth(128));
                break;
            }
            EditorGUILayout.EndHorizontal();

            switch (drawingMode)
            {
            case DrawingMode.Color:
                // color picker field
                colorBrushColor = SabreGUILayout.ColorField(new GUIContent("Color"), colorBrushColor, false, false, GUILayout.MaxWidth(183));

                // color blending mode
                EditorGUILayout.BeginHorizontal();
                GUI.color = Color.black;
                GUILayout.Label("Blending");
                GUI.color = Color.white;
                colorBrushBlendingMode = (BlendingMode)EditorGUILayout.EnumPopup(colorBrushBlendingMode, GUILayout.MaxWidth(96));
                EditorGUILayout.EndHorizontal();
                break;

            case DrawingMode.R:
                // red color slider
                EditorGUILayout.BeginHorizontal();
                GUI.color = Color.black;
                GUILayout.Label("Red");
                GUI.color     = Color.white;
                redBrushColor = EditorGUILayout.Slider("", redBrushColor, 0f, 1f, GUILayout.MaxWidth(128));
                EditorGUILayout.EndHorizontal();
                break;

            case DrawingMode.G:
                // green color slider
                EditorGUILayout.BeginHorizontal();
                GUI.color = Color.black;
                GUILayout.Label("Green");
                GUI.color       = Color.white;
                greenBrushColor = EditorGUILayout.Slider("", greenBrushColor, 0f, 1f, GUILayout.MaxWidth(128));
                EditorGUILayout.EndHorizontal();
                break;

            case DrawingMode.B:
                // blue color slider
                EditorGUILayout.BeginHorizontal();
                GUI.color = Color.black;
                GUILayout.Label("Blue");
                GUI.color      = Color.white;
                blueBrushColor = EditorGUILayout.Slider("", blueBrushColor, 0f, 1f, GUILayout.MaxWidth(128));
                EditorGUILayout.EndHorizontal();
                break;

            case DrawingMode.Alpha:
                // alpha color slider
                EditorGUILayout.BeginHorizontal();
                GUI.color = Color.black;
                GUILayout.Label("Alpha");
                GUI.color       = Color.white;
                alphaBrushColor = EditorGUILayout.Slider("", alphaBrushColor, 0f, 1f, GUILayout.MaxWidth(128));
                EditorGUILayout.EndHorizontal();
                break;
            }

            // draw color palette:
            DrawToolbarPalette();
        }