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>
This commit is contained in:
2010-09-30 12:10:18 +00:00
parent d6ee8a0e4d
commit 0dcf67a83a

View File

@@ -2278,6 +2278,9 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
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 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
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);