UI: Create button group if none exists

This makes it unecessary to create a button group when the block
is created, giving more flexibility when creating the first group-- for
example, creating the first button group with special parameters.
This commit is contained in:
Hans Goudey 2020-10-02 17:11:44 -05:00
parent 3eab2248c3
commit 743eca0f31
Notes: blender-bot 2023-04-14 09:18:04 +02:00
Referenced by issue #81211, Fast circular strokes by Paint and Sculpt brushes using mouse are angular.
2 changed files with 3 additions and 3 deletions

View File

@ -3476,7 +3476,6 @@ uiBlock *UI_block_begin(const bContext *C, ARegion *region, const char *name, ch
block->evil_C = (void *)C; /* XXX */
BLI_listbase_clear(&block->button_groups);
ui_block_new_button_group(block);
if (scene) {
/* store display device name, don't lookup for transformations yet

View File

@ -41,10 +41,11 @@ void ui_block_new_button_group(uiBlock *block)
void ui_button_group_add_but(uiBlock *block, uiBut *but)
{
BLI_assert(block != NULL);
if (BLI_listbase_is_empty(&block->button_groups)) {
ui_block_new_button_group(block);
}
uiButtonGroup *current_button_group = block->button_groups.last;
BLI_assert(current_button_group != NULL);
/* We can't use the button directly because adding it to
* this list would mess with its prev and next pointers. */