[Bf-blender-cvs] [387bf726ac0] blender2.8: UI: Editor outline color themable

Dalai Felinto noreply at git.blender.org
Sun Apr 22 22:55:38 CEST 2018


Commit: 387bf726ac0fa47149d72ccaaa0df6fadf90df0f
Author: Dalai Felinto
Date:   Sun Apr 22 22:55:05 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB387bf726ac0fa47149d72ccaaa0df6fadf90df0f

UI: Editor outline color themable

Note: Not bothering with doversion, re-using 280, 10 bump.

===================================================================

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

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 3747ecbdb48..d83fd76536e 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -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()
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 49c9cffdd54..2fc9b2946fb 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -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,
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 31d9f08fdd8..1bc834a121c 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -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);
 		}
 	}
 
diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c
index 6bb3bbe7405..fde60ee1960 100644
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@ -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);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 4bb796c84f1..ba6d022e556 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -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;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 9ff2ee4fe4b..45843bc2b1c 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -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");



More information about the Bf-blender-cvs mailing list