forked from bartvdbraak/blender
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.
This commit is contained in:
parent
2aafadd4ac
commit
c42a796e9f
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user