diff options
author | Julian Eisel <julian@blender.org> | 2020-08-07 18:42:13 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-08-07 18:46:58 +0300 |
commit | dcff28e1e7a8b1be9bb6acec24af7ca6f6468e77 (patch) | |
tree | 33b588ed6c5688a377a2a7d2421e6715c1612217 /source/blender/editors/interface/interface_intern.h | |
parent | 60b42ef117b66cca61468be45aab54b9bb1217e0 (diff) |
UI Code Quality: Use derived struct for HSV Cube buttons
For the main rationale behind this design, see 49f088e2d093. Further,
this removes users of uiBut.a1, which is a very ugly design
choice (hard to reason about).
Part of T74432.
Diffstat (limited to 'source/blender/editors/interface/interface_intern.h')
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 41110883729..6718db39e61 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -172,7 +172,6 @@ struct uiBut { /** * For #uiBut.type: - * - UI_BTYPE_HSVCUBE: Use UI_GRAD_* values. * - UI_BTYPE_NUM: Use to store RNA 'step' value, for dragging and click-step. * - UI_BTYPE_LABEL: Use `(a1 == 1.0f)` to use a2 as a blending factor (imaginative!). * - UI_BTYPE_SCROLL: Use as scroll size. @@ -328,6 +327,12 @@ typedef struct uiButProgressbar { float progress; } uiButProgressbar; +typedef struct uiButHSVCube { + uiBut but; + + eButGradientType gradient_type; +} uiButHSVCube; + /** * Additional, superimposed icon for a button, invoking an operator. */ @@ -535,7 +540,7 @@ extern void ui_hsvcircle_vals_from_pos( extern void ui_hsvcircle_pos_from_vals( const ColorPicker *cpicker, const rcti *rect, const float *hsv, float *xpos, float *ypos); extern void ui_hsvcube_pos_from_vals( - const struct uiBut *but, const rcti *rect, const float *hsv, float *xp, float *yp); + const struct uiButHSVCube *hsv_but, const rcti *rect, const float *hsv, float *xp, float *yp); extern void ui_but_string_get_ex(uiBut *but, char *str, @@ -777,7 +782,10 @@ extern void ui_draw_aligned_panel(struct uiStyle *style, extern void ui_draw_dropshadow( const rctf *rct, float radius, float aspect, float alpha, int select); -void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, const float alpha); +void ui_draw_gradient(const rcti *rect, + const float hsv[3], + const eButGradientType type, + const float alpha); void ui_draw_but_TAB_outline(const rcti *rect, float rad, |