diff options
author | Julian Eisel <julian@blender.org> | 2020-08-07 16:02:07 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-08-07 16:17:52 +0300 |
commit | 68c00e6f8f2612d76f95fb7744cb9cfbfcfacdf8 (patch) | |
tree | 8785ad94ffea2c266ce662b1fcf3f14a9f9fdc3f /source/blender/editors/interface/interface_templates.c | |
parent | 49f088e2d0936ed3b5f08881a14ad83c19951791 (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_templates.c')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8c1d070b5e4..8593e7e3118 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -5512,22 +5512,24 @@ void uiTemplatePalette(uiLayout *layout, } RNA_pointer_create(&palette->id, &RNA_PaletteColor, color, &color_ptr); - uiDefButR(block, - UI_BTYPE_COLOR, - 0, - "", - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - &color_ptr, - "color", - -1, - 0.0, - 1.0, - UI_PALETTE_COLOR, - col_id, - ""); + uiButColor *color_but = (uiButColor *)uiDefButR(block, + UI_BTYPE_COLOR, + 0, + "", + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + &color_ptr, + "color", + -1, + 0.0, + 1.0, + 0.0, + 0.0, + ""); + color_but->is_pallete_color = true; + color_but->palette_color_index = col_id; row_cols++; col_id++; } |