diff options
author | Julian Eisel <julian@blender.org> | 2020-08-07 16:16:26 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-08-07 16:17:52 +0300 |
commit | 076a93b855e89fd915779da5991132bc956aa0f4 (patch) | |
tree | fc644fb87df0cefe4b2b18741e87c64d4c58b403 /source/blender/editors/interface/interface.c | |
parent | 9f475db6c984c4333ebca3ba1749831ca1bff04e (diff) |
UI Code Quality: Use derived struct for progessbar buttons
For the main rationale behind this design, see 03b122e2a18df. 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.c')
-rw-r--r-- | source/blender/editors/interface/interface.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 0d8f682ea51..a84ca33a7d7 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -820,10 +820,10 @@ static bool ui_but_update_from_old_block(const bContext *C, oldbut->hardmax = but->hardmax; } - /* Selectively copy a1, a2 since their use differs across all button types - * (and we'll probably split these out later) */ - if (ELEM(oldbut->type, UI_BTYPE_PROGRESS_BAR)) { - oldbut->a1 = but->a1; + if (oldbut->type == UI_BTYPE_PROGRESS_BAR) { + uiButProgressbar *progress_oldbut = (uiButProgressbar *)oldbut; + uiButProgressbar *progress_but = (uiButProgressbar *)but; + progress_oldbut->progress = progress_but->progress; } if (!BLI_listbase_is_empty(&block->butstore)) { @@ -3789,6 +3789,10 @@ static void ui_but_alloc_info(const eButType type, alloc_size = sizeof(uiButSearch); alloc_str = "uiButSearch"; break; + case UI_BTYPE_PROGRESS_BAR: + alloc_size = sizeof(uiButProgressbar); + alloc_str = "uiButProgressbar"; + break; default: alloc_size = sizeof(uiBut); alloc_str = "uiBut"; |