diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-09-30 16:10:18 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-09-30 16:10:18 +0400 |
commit | 0dcf67a83a03d01fd9a68044c280925fc4b96521 (patch) | |
tree | 056bf54ca0e2d15b495c3e093bddb4453e385905 /source/blender | |
parent | d6ee8a0e4d10f3a5479ce2c94b403b2f59e5c523 (diff) |
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>
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 08ce130a300..b892ce1ca6d 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -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); |