UI: Editor outline color themable
authorDalai Felinto <dfelinto@gmail.com>
Sun, 22 Apr 2018 20:55:05 +0000 (22:55 +0200)
committerDalai Felinto <dfelinto@gmail.com>
Sun, 22 Apr 2018 20:55:18 +0000 (22:55 +0200)
Note: Not bothering with doversion, re-using 280, 10 bump.

release/scripts/startup/bl_ui/space_userpref.py
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/resources.c
source/blender/editors/screen/screen_draw.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c

index 3747ecbdb48766ee0fa522a12e0e6ab4778c69d9..d83fd76536e93bf02d84fe8c81b4e1bd27d684f2 100644 (file)
@@ -896,28 +896,15 @@ class USERPREF_PT_theme(Panel):
             colsub = padding.column()
             colsub = padding.column()
             colsub.row().prop(ui, "menu_shadow_fac")
-
-            subsplit = row.split(percentage=0.85)
-
-            padding = subsplit.split(percentage=0.15)
-            colsub = padding.column()
-            colsub = padding.column()
-            colsub.row().prop(ui, "menu_shadow_width")
-
-            row = col.row()
-
-            subsplit = row.split(percentage=0.95)
-
-            padding = subsplit.split(percentage=0.15)
-            colsub = padding.column()
-            colsub = padding.column()
             colsub.row().prop(ui, "icon_alpha")
+            colsub.row().prop(ui, "editor_outline")
 
             subsplit = row.split(percentage=0.85)
 
             padding = subsplit.split(percentage=0.15)
             colsub = padding.column()
             colsub = padding.column()
+            colsub.row().prop(ui, "menu_shadow_width")
             colsub.row().prop(ui, "widget_emboss")
 
             col.separator()
index 49c9cffdd54863f4740a146e26e98521588f3f13..2fc9b2946fb0b0246acead72096bf8df22a7a7b4 100644 (file)
@@ -275,6 +275,8 @@ typedef enum ThemeColorID {
        
        TH_WIDGET_EMBOSS,
 
+       TH_EDITOR_OUTLINE,
+
        TH_AXIS_X,              /* X/Y/Z Axis */
        TH_AXIS_Y,
        TH_AXIS_Z,
index 31d9f08fdd88eeec16def99db6f8866661ee9857..1bc834a121c4bb138d6da42ce432d25bc4b09739 100644 (file)
@@ -658,6 +658,9 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
                                case TH_WIDGET_EMBOSS:
                                        cp = btheme->tui.widget_emboss; break;
 
+                               case TH_EDITOR_OUTLINE:
+                                       cp = btheme->tui.editor_outline;
+                                       break;
                                case TH_AXIS_X:
                                        cp = btheme->tui.xaxis; break;
                                case TH_AXIS_Y:
@@ -881,6 +884,7 @@ void ui_theme_init_default(void)
        btheme->tui.iconfile[0] = 0;
        rgba_char_args_set(btheme->tui.wcol_tooltip.text, 255, 255, 255, 255);
        rgba_char_args_set_fl(btheme->tui.widget_emboss, 1.0f, 1.0f, 1.0f, 0.02f);
+       rgba_char_args_set_fl(btheme->tui.editor_outline, 0.25f, 0.25f, 0.25f, 1.0f);
 
        rgba_char_args_set(btheme->tui.xaxis, 220,   0,   0, 255);
        rgba_char_args_set(btheme->tui.yaxis,   0, 220,   0, 255);
@@ -2977,6 +2981,7 @@ void init_userdef_do_versions(void)
                        btheme->tui.wcol_progress.roundness = 0.25f;
                        btheme->tui.wcol_list_item.roundness = 0.2f;
                        btheme->tui.wcol_pie_menu.roundness = 0.5f;
+                       rgba_char_args_set_fl(btheme->tui.editor_outline, 0.25f, 0.25f, 0.25f, 1.0f);
                }
        }
 
index 6bb3bbe7405cad88f1f78d1f6aaee37510d0948e..fde60ee19601a05e65ad1b083534ca72f236074e 100644 (file)
@@ -34,6 +34,7 @@
 #include "WM_types.h"
 
 #include "UI_interface.h"
+#include "UI_resources.h"
 
 #include "screen_intern.h"
 
@@ -212,15 +213,13 @@ static void draw_join_shape(ScrArea *sa, char dir, unsigned int pos)
        }
 }
 
-/* This color is used for the internal area embossing and their round corners. */
-float edge_colors[4] = {0.25f, 0.25f, 0.25f, 1.0f};
-
 #define CORNER_RESOLUTION 10
 static void drawscredge_corner_geometry(
         int sizex, int sizey,
         int corner_x, int corner_y,
         int center_x, int center_y,
-        double angle_offset)
+        double angle_offset,
+        const float *color)
 {
        const int radius = ABS(corner_x - center_x);
        const int line_thickness = U.pixelsize;
@@ -272,7 +271,8 @@ static void drawscredge_corner_geometry(
                tri_array[i + 1][0] = x;
                tri_array[i + 1][1] = y;
        }
-       UI_draw_anti_fan(tri_array, CORNER_RESOLUTION + 1, edge_colors);
+
+       UI_draw_anti_fan(tri_array, CORNER_RESOLUTION + 1, color);
 }
 
 #undef CORNER_RESOLUTION
@@ -280,6 +280,8 @@ static void drawscredge_corner_geometry(
 static void drawscredge_corner(ScrArea *sa, int sizex, int sizey)
 {
        int size = 10 * U.pixelsize;
+       float color[4] = {0};
+       UI_GetThemeColor4fv(TH_EDITOR_OUTLINE, color);
 
        /* Bottom-Left. */
        drawscredge_corner_geometry(sizex, sizey,
@@ -287,7 +289,8 @@ static void drawscredge_corner(ScrArea *sa, int sizex, int sizey)
                                                    sa->v1->vec.y,
                                                    sa->v1->vec.x + size,
                                                    sa->v1->vec.y + size,
-                                   M_PI_2 * 2.0f);
+                                   M_PI_2 * 2.0f,
+                                   color);
 
        /* Top-Left. */
        drawscredge_corner_geometry(sizex, sizey,
@@ -295,7 +298,8 @@ static void drawscredge_corner(ScrArea *sa, int sizex, int sizey)
                                    sa->v2->vec.y,
                                    sa->v2->vec.x + size,
                                    sa->v2->vec.y - size,
-                                   M_PI_2);
+                                   M_PI_2,
+                                   color);
 
        /* Top-Right. */
        drawscredge_corner_geometry(sizex, sizey,
@@ -303,7 +307,8 @@ static void drawscredge_corner(ScrArea *sa, int sizex, int sizey)
                                    sa->v3->vec.y,
                                    sa->v3->vec.x - size,
                                    sa->v3->vec.y - size,
-                                   0.0f);
+                                   0.0f,
+                                   color);
 
        /* Bottom-Right. */
        drawscredge_corner_geometry(sizex, sizey,
@@ -311,7 +316,8 @@ static void drawscredge_corner(ScrArea *sa, int sizex, int sizey)
                                    sa->v4->vec.y,
                                    sa->v4->vec.x - size,
                                    sa->v4->vec.y + size,
-                                   M_PI_2 * 3.0f);
+                                   M_PI_2 * 3.0f,
+                                   color);
 
        /* Wrap up the corners with a nice embossing. */
        rcti rect = sa->totrct;
@@ -319,7 +325,7 @@ static void drawscredge_corner(ScrArea *sa, int sizex, int sizey)
        unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
        immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 
-       immUniformColor4fv(edge_colors);
+       immUniformColor4fv(color);
        immBeginAtMost(GWN_PRIM_LINES, 8);
 
        /* Right. */
@@ -441,7 +447,7 @@ void ED_screen_draw_edges(wmWindow *win)
        if (U.pixelsize > 1.0f) {
                /* FIXME: doesn't our glLineWidth already scale by U.pixelsize? */
                glLineWidth((2.0f * U.pixelsize) - 1);
-               immUniformColor3fv(edge_colors);
+               immUniformThemeColor(TH_EDITOR_OUTLINE);
 
                for (sa = screen->areabase.first; sa; sa = sa->next) {
                        drawscredge_area(sa, winsize_x, winsize_y, pos);
@@ -449,7 +455,7 @@ void ED_screen_draw_edges(wmWindow *win)
        }
 
        glLineWidth(1);
-       immUniformColor3fv(edge_colors);
+       immUniformThemeColor(TH_EDITOR_OUTLINE);
 
        for (sa = screen->areabase.first; sa; sa = sa->next) {
                drawscredge_area(sa, winsize_x, winsize_y, pos);
index 4bb796c84f1c6ae7d8e1a3508f94dd3df0ca8647..ba6d022e556f7e1e265fa62744a5b50c340a42f1 100644 (file)
@@ -180,7 +180,8 @@ typedef struct ThemeUI {
        float menu_shadow_fac;
        short menu_shadow_width;
        
-       short pad[3];
+       char editor_outline[4];
+       short pad[1];
        
        char iconfile[256];     // FILE_MAXFILE length
        float icon_alpha;
index 9ff2ee4fe4b0e563da79efefb5b16623dba5620e..45843bc2b1c36d3bbc3681bbab2a478d8892b442 100644 (file)
@@ -1078,6 +1078,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Widget Emboss", "Color of the 1px shadow line underlying widgets");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
+       prop = RNA_def_property(srna, "editor_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "editor_outline");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Editor Outline", "Color of the outline of the editors and their round corners");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+
        /* axis */
        prop = RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_COLOR_GAMMA);
        RNA_def_property_float_sdna(prop, NULL, "xaxis");