Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Williamson <jonathan@cgcookie.com>2014-10-27 20:11:55 +0300
committerJonathan Williamson <jonathan@cgcookie.com>2014-10-27 20:14:00 +0300
commit6c2ce7a3828e92083dfdad85eb683f4d27ed852b (patch)
treed5ed160856a0a1dac8baa100bf5cb2288b2bcd2d /source/blender
parent9a98fad2e02af95774ae9ed83ad60c8b41c2a03c (diff)
Add Theme Option for UI Emboss
This adds a theme option for the embossing of UI widgets. By doing this users have much greater flexibility for creating nice themes. Previously many themes (particularly dark ones) looked quite bad due to the very obvious emboss. This made simpler, flat-style themes very challenging. Closes T42228 Reviewed by @campbellbarton
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/include/UI_resources.h2
-rw-r--r--source/blender/editors/interface/interface_widgets.c16
-rw-r--r--source/blender/editors/interface/resources.c12
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c6
5 files changed, 34 insertions, 6 deletions
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 5b61e76f514..8e37e871501 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -266,6 +266,8 @@ enum {
TH_NLA_SOUND,
TH_NLA_SOUND_SEL,
+ TH_EMBOSS,
+
TH_AXIS_X, /* X/Y/Z Axis */
TH_AXIS_Y,
TH_AXIS_Z,
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index b7e61400cfa..46c2da902fe 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -746,6 +746,8 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glEnableClientState(GL_VERTEX_ARRAY);
for (j = 0; j < WIDGET_AA_JITTER; j++) {
+ unsigned char emboss[4];
+
glTranslatef(jit[j][0], jit[j][1], 0.0f);
/* outline */
@@ -753,13 +755,17 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glVertexPointer(2, GL_FLOAT, 0, quad_strip);
glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert * 2 + 2);
-
+
/* emboss bottom shadow */
- if (wtb->emboss) {
- glColor4f(1.0f, 1.0f, 1.0f, 0.02f);
+ UI_GetThemeColor4ubv(TH_EMBOSS, emboss);
- glVertexPointer(2, GL_FLOAT, 0, quad_strip_emboss);
- glDrawArrays(GL_QUAD_STRIP, 0, wtb->halfwayvert * 2);
+ if (wtb->emboss) {
+ UI_GetThemeColor4ubv(TH_EMBOSS, emboss);
+ if (emboss[3]) {
+ glColor4ubv(emboss);
+ glVertexPointer(2, GL_FLOAT, 0, quad_strip_emboss);
+ glDrawArrays(GL_QUAD_STRIP, 0, wtb->halfwayvert * 2);
+ }
}
glTranslatef(-jit[j][0], -jit[j][1], 0.0f);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index bcd85333709..5dc9ee0264e 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -619,6 +619,9 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp = ts->nla_sound_sel;
break;
+ case TH_EMBOSS:
+ cp = btheme->tui.emboss; break;
+
case TH_AXIS_X:
cp = btheme->tui.xaxis; break;
case TH_AXIS_Y:
@@ -815,6 +818,8 @@ void ui_theme_init_default(void)
btheme->tui.panel.show_header = false;
rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
+ rgba_char_args_set_fl(btheme->tui.emboss, 1.0f, 1.0f, 1.0f, 0.02f);
+
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);
@@ -2491,6 +2496,13 @@ void init_userdef_do_versions(void)
}
}
+ if (U.versionfile < 272 || (U.versionfile == 272 && U.subversionfile < 2)) {
+ bTheme *btheme;
+ for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+ rgba_char_args_set_fl(btheme->tui.emboss, 1.0f, 1.0f, 1.0f, 0.02f);
+ }
+ }
+
if (U.pixelsize == 0.0f)
U.pixelsize = 1.0f;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 769e2573aa4..d8653e1f5fe 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -168,11 +168,13 @@ typedef struct ThemeUI {
uiPanelColors panel; /* depricated, but we keep it for do_versions (2.66.1) */
+ char emboss[4];
+
/* fac: 0 - 1 for blend factor, width in pixels */
float menu_shadow_fac;
short menu_shadow_width;
- short pad;
+ short pad[3];
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 1bad9570893..a23c3ea8534 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1018,6 +1018,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Icon Alpha", "Transparency of icons in the interface, to reduce contrast");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+ prop = RNA_def_property(srna, "emboss", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "emboss");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Emboss", "");
+ 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");