[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32214] trunk/blender/source/blender/ editors/interface/interface_widgets.c: Patch #24056: Indicate keyed status of swatches

Joshua Leung aligorith at gmail.com
Thu Sep 30 14:10:18 CEST 2010


Revision: 32214
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32214
Author:   aligorith
Date:     2010-09-30 14:10:18 +0200 (Thu, 30 Sep 2010)

Log Message:
-----------
Patch #24056: Indicate keyed status of swatches
Submitted by: Shane Ambler (sambler) 

<quote>
>From blenderstorm idea# 169 this patch changes the swatch button to display a border showing the keyed status colour
of the colour.

I chose to go with showing the keyed colour in a border around the swatch, insetting the size of the swatch colour to
prevent altering the sizing of the swatch. An un-keyed swatch is not altered visually, only a keyed colour swatch is
changed to have the keyed colour around the outside of the swatch button.

I think a border of 3 pixels is sufficient to make the keyed colour visible without taking too much of the colour area
away.
</quote>

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_widgets.c

Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c	2010-09-30 11:56:39 UTC (rev 32213)
+++ trunk/blender/source/blender/editors/interface/interface_widgets.c	2010-09-30 12:10:18 UTC (rev 32214)
@@ -2278,6 +2278,9 @@
 	rect->xmax -= offs*0.75f;
 }
 
+/* I think 3 is sufficient border to indicate keyed status */
+#define SWATCH_KEYED_BORDER 3
+
 static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
 {
 	uiWidgetBase wtb;
@@ -2302,6 +2305,19 @@
 		
 	ui_get_but_vectorf(but, col);
 	
+	if(state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
+		// draw based on state - colour for keyed etc
+		widgetbase_draw(&wtb, wcol);
+		
+		// inset to draw swatch colour
+		rect->xmin+= SWATCH_KEYED_BORDER;
+		rect->xmax-= SWATCH_KEYED_BORDER;
+		rect->ymin+= SWATCH_KEYED_BORDER;
+		rect->ymax-= SWATCH_KEYED_BORDER;
+		
+		round_box_edges(&wtb, roundboxalign, rect, 5.0f);
+	}
+	
 	if (color_profile)
 		linearrgb_to_srgb_v3_v3(col, col);
 	





More information about the Bf-blender-cvs mailing list