[Bf-blender-cvs] [d5408e0] temp-menu_shadow_theme_color: Setup temp branch for review of D754
julianeisel
noreply at git.blender.org
Tue Jan 6 21:54:17 CET 2015
Commit: d5408e03f481160ba24337eee4b7dfba0395717c
Author: julianeisel
Date: Tue Jan 6 21:52:22 2015 +0100
Branches: temp-menu_shadow_theme_color
https://developer.blender.org/rBd5408e03f481160ba24337eee4b7dfba0395717c
Setup temp branch for review of D754
D754: Add theme option to control the color of menu shadows
===================================================================
M release/scripts/startup/bl_ui/space_userpref.py
M source/blender/editors/include/UI_resources.h
M source/blender/editors/interface/interface_draw.c
M source/blender/editors/interface/interface_widgets.c
M source/blender/editors/interface/resources.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 10394e5..bd36d3d 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -753,13 +753,15 @@ class USERPREF_PT_theme(Panel):
padding = subsplit.split(percentage=0.15)
colsub = padding.column()
colsub = padding.column()
- colsub.row().prop(ui, "menu_shadow_fac")
+ colsub.row().prop(ui, "menu_shadow")
+
subsplit = row.split(percentage=0.85)
padding = subsplit.split(percentage=0.15)
colsub = padding.column()
colsub = padding.column()
+ colsub.row().prop(ui, "menu_shadow_fac")
colsub.row().prop(ui, "menu_shadow_width")
row = col.row()
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index d289e90..a4be1e6 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -274,6 +274,8 @@ enum {
TH_WIDGET_EMBOSS,
+ TH_MENU_SHADOW,
+
TH_AXIS_X, /* X/Y/Z Axis */
TH_AXIS_Y,
TH_AXIS_Z,
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index bcd9b9a..33b05fb 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1738,6 +1738,8 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx,
void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select))
{
+
+ unsigned char scolor[3];
int i;
float rad;
float a;
@@ -1761,10 +1763,12 @@ void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha
a = i * aspect;
}
+ UI_GetThemeColor3ubv(TH_MENU_SHADOW, scolor);
calpha = dalpha;
for (; i--; a -= aspect) {
- /* alpha ranges from 2 to 20 or so */
- glColor4f(0.0f, 0.0f, 0.0f, calpha);
+ /* alpha ranges from 2 to 20 or so, use colors from menu shadow theme */
+ glColor4ub(scolor[0], scolor[1], scolor[2], (calpha * 255.0f));
+ //glColor4ub(255, 0, 0, (calpha * 255.0f));
calpha += dalpha;
UI_draw_roundbox_gl_mode(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax - 10.0f + a, rad + a);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 04a886b..da98030 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2124,7 +2124,7 @@ static void widget_softshadow(const rcti *rect, int roundboxalign, const float r
round_box_shadow_edges(wtb.outer_v, &rect1, radin, UI_CNR_ALL, (float)step);
- glColor4f(0.0f, 0.0f, 0.0f, alphastep * (1.0f - expfac));
+ glColor4ub(btheme->tui.menu_shadow[0], btheme->tui.menu_shadow[1], btheme->tui.menu_shadow[2], (alphastep * (1.0f - expfac)) * 255.0f);
widget_verts_to_quad_strip(&wtb, totvert, quad_strip);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index aa5b257..34390ce 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -645,6 +645,9 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_WIDGET_EMBOSS:
cp = btheme->tui.widget_emboss; break;
+ case TH_MENU_SHADOW:
+ cp = btheme->tui.menu_shadow; break;
+
case TH_AXIS_X:
cp = btheme->tui.xaxis; break;
case TH_AXIS_Y:
@@ -845,6 +848,8 @@ void ui_theme_init_default(void)
rgba_char_args_set_fl(btheme->tui.widget_emboss, 1.0f, 1.0f, 1.0f, 0.02f);
+ rgba_char_args_set(btheme->tui.menu_shadow, 0, 0, 0, 255);
+
rgba_char_args_set(btheme->tui.xaxis, 220, 0, 0, 255);
rgba_char_args_set(btheme->tui.yaxis, 0, 220, 0, 255);
rgba_char_args_set(btheme->tui.zaxis, 0, 0, 220, 255);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 11807ba..d81f745 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -117,6 +117,7 @@ typedef struct uiStyle {
short panelouter;
short pad;
+
} uiStyle;
typedef struct uiWidgetColors {
@@ -170,9 +171,10 @@ typedef struct ThemeUI {
char widget_emboss[4];
- /* fac: 0 - 1 for blend factor, width in pixels */
+ /* menu shadows: fac: 0 - 1 for blend factor, width: size of shadow in pixels, shadow: color of shadow */
float menu_shadow_fac;
short menu_shadow_width;
+ char menu_shadow[4];
short pad[3];
@@ -362,6 +364,7 @@ typedef struct bTheme {
char name[32];
ThemeUI tui;
+ int pad0;
/* Individual Spacetypes */
/* note: ensure UI_THEMESPACE_END is updated when adding */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index fa0e1db..164579f 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1034,6 +1034,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0f, 24.0f);
RNA_def_property_update(prop, 0, "rna_userdef_update");
+ prop = RNA_def_property(srna, "menu_shadow", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "menu_shadow");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Shadow Color", "Color of menu shadows");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
prop = RNA_def_property(srna, "icon_file", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "iconfile");
RNA_def_property_ui_text(prop, "Icon File", "");
More information about the Bf-blender-cvs
mailing list