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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-01 16:04:51 +0300
committerPablo Vazquez <venomgfx@gmail.com>2018-06-01 16:11:38 +0300
commit13ca63d2adad0da7b73ed3e38da53363e1de3428 (patch)
treedfd194638d2d51d6ab3377b28eca2f1c77ff4ff4 /source/blender/editors/interface/interface_widgets.c
parent3b05034935c482bd3cf377b03549df8d87af90d9 (diff)
Draw background on pulldown widgets if the header is transparent.
Since the viewport header now supports transparency, text on pulldowns can be hard to read if their color matches the viewport content. Background is drawn using the 'inner' theme color, that was unused until now.
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r--source/blender/editors/interface/interface_widgets.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index e4faac5129e..928ac8c9171 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2626,15 +2626,9 @@ static void widget_state_nothing(uiWidgetType *wt, int UNUSED(state))
}
/* special case, button that calls pulldown */
-static void widget_state_pulldown(uiWidgetType *wt, int state)
+static void widget_state_pulldown(uiWidgetType *wt, int UNUSED(state))
{
wt->wcol = *(wt->wcol_theme);
-
- copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
- copy_v3_v3_char(wt->wcol.outline, wt->wcol.inner);
-
- if (state & UI_ACTIVE)
- copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
}
/* special case, pie menu items */
@@ -3812,10 +3806,23 @@ static void widget_menunodebut(uiWidgetColors *wcol, rcti *rect, int UNUSED(stat
static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
- if (state & UI_ACTIVE) {
+ float back[4];
+ UI_GetThemeColor4fv(TH_BACK, back);
+
+ if ((state & UI_ACTIVE) || (back[3] < 1.0f)) {
uiWidgetBase wtb;
const float rad = wcol->roundness * U.widget_unit;
+ if (state & UI_ACTIVE) {
+ copy_v4_v4_char(wcol->inner, wcol->inner_sel);
+ copy_v3_v3_char(wcol->text, wcol->text_sel);
+ copy_v3_v3_char(wcol->outline, wcol->inner);
+ }
+ else {
+ wcol->inner[3] *= 1.0f - back[3];
+ wcol->outline[3] = 0.0f;
+ }
+
widget_init(&wtb);
/* half rounded */