[Bf-blender-cvs] [743eca0f316] master: UI: Create button group if none exists
Hans Goudey
noreply at git.blender.org
Sat Oct 3 00:12:04 CEST 2020
Commit: 743eca0f316d1ec2ef16e6066d7cfc5233c92657
Author: Hans Goudey
Date: Fri Oct 2 17:11:44 2020 -0500
Branches: master
https://developer.blender.org/rB743eca0f316d1ec2ef16e6066d7cfc5233c92657
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.
===================================================================
M source/blender/editors/interface/interface.c
M source/blender/editors/interface/interface_button_group.c
===================================================================
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index d06e3fd718d..98e76114956 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -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
diff --git a/source/blender/editors/interface/interface_button_group.c b/source/blender/editors/interface/interface_button_group.c
index e890d0136cb..455a3c6a69c 100644
--- a/source/blender/editors/interface/interface_button_group.c
+++ b/source/blender/editors/interface/interface_button_group.c
@@ -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. */
More information about the Bf-blender-cvs
mailing list