[Bf-blender-cvs] [c42a796] master: Fix: Make it easier to tell if Color Swatches are greyed out or not

Joshua Leung noreply at git.blender.org
Mon Apr 18 14:43:08 CEST 2016


Commit: c42a796e9ff06d365ae2b41cd122e4bce026bf35
Author: Joshua Leung
Date:   Tue Apr 19 00:42:59 2016 +1200
Branches: master
https://developer.blender.org/rBc42a796e9ff06d365ae2b41cd122e4bce026bf35

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.

===================================================================

M	source/blender/editors/interface/interface_widgets.c

===================================================================

diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 841b76c..d1461f1 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);




More information about the Bf-blender-cvs mailing list