Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-08-07 16:02:07 +0300
committerJulian Eisel <julian@blender.org>2020-08-07 16:17:52 +0300
commit68c00e6f8f2612d76f95fb7744cb9cfbfcfacdf8 (patch)
tree8785ad94ffea2c266ce662b1fcf3f14a9f9fdc3f /source/blender/editors/interface/interface_widgets.c
parent49f088e2d0936ed3b5f08881a14ad83c19951791 (diff)
UI Code Quality: Use derived struct for color buttons
For the main rationale behind this design, see 03b122e2a18df. Further, this removes users of `uiBut.a1`/`uiBut.a2`, which is a very ugly design choice (hard to reason about). Part of Part of T74432.
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r--source/blender/editors/interface/interface_widgets.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 01f89a8bdb1..5d342e928f9 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -3768,6 +3768,8 @@ static void widget_numslider(
static void widget_swatch(
uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
+ BLI_assert(but->type == UI_BTYPE_COLOR);
+ uiButColor *color_but = (uiButColor *)but;
uiWidgetBase wtb;
float rad, col[4];
@@ -3822,8 +3824,8 @@ static void widget_swatch(
}
widgetbase_draw_ex(&wtb, wcol, show_alpha_checkers);
- if (but->a1 == UI_PALETTE_COLOR &&
- ((Palette *)but->rnapoin.owner_id)->active_color == (int)but->a2) {
+ if (color_but->is_pallete_color &&
+ ((Palette *)but->rnapoin.owner_id)->active_color == color_but->palette_color_index) {
float width = rect->xmax - rect->xmin;
float height = rect->ymax - rect->ymin;
/* find color luminance and change it slightly */