diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-04-18 15:42:59 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-04-18 15:42:59 +0300 |
commit | c42a796e9ff06d365ae2b41cd122e4bce026bf35 (patch) | |
tree | fa89b93ab91b60c3bd8d3db6adfd20e921ca87cf /source/blender/editors | |
parent | 2aafadd4acbd6741f4ba0a98dda7b59ef9eb951d (diff) |
Fix: Make it easier to tell if Color Swatches are greyed out or not
This commit makes disabled/inactive color swatches look more obviously disabled
by halving their alpha values. It is necessary because the results of
ui_widget_color_disabled() (which is usually used when disabling widgets)
get overwritten by the color filling code here.
To avoid confusion, the checkerboard background (when the color genuinely has
alpha) will still only show in those cases. That is, when disabled, color swatches
won't show the checkerboard unless the color actually has an alpha component if it
wasn't disabled.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 841b76c676b..d1461f1acec 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -3042,6 +3042,15 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat wcol->shaded = 0; wcol->alpha_check = (wcol->inner[3] < 255); + + if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) { + /* Now we reduce alpha of the inner color (i.e. the color shown) + * so that this setting can look greyed out, while retaining + * the checkboard (for transparent values). This is needed + * here as the effects of ui_widget_color_disabled() are overwritten. + */ + wcol->inner[3] /= 2; + } widgetbase_draw(&wtb, wcol); |