Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-23 11:31:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-23 11:31:10 +0300
commitf8a3636374b76f6db31be21beaa0e40857644bc4 (patch)
tree59cc2b172d8bf0e2eb0d838c2ac127029c0b0027 /source/blender/editors/interface/interface.c
parent6cd0484de8c765e5ce0f2072c7b10af0794ce7f8 (diff)
UI: alternate fix for empty context menu
block and layout could be NULL and checking this everywhere wasn't practical. Instead of lazy initializing, add UI_popup_menu_end_or_cancel which cancels empty popup menus.
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 895190ab885..90fb477480a 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -4007,6 +4007,16 @@ int UI_blocklist_min_y_get(ListBase *lb)
return min;
}
+bool UI_block_is_empty(const uiBlock *block)
+{
+ for (const uiBut *but = block->buttons.first; but; but = but->next) {
+ if (!ELEM(but->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE)) {
+ return false;
+ }
+ }
+ return true;
+}
+
void UI_block_direction_set(uiBlock *block, char direction)
{
block->direction = direction;
@@ -4753,4 +4763,3 @@ void UI_exit(void)
ui_resources_free();
ui_but_clipboard_free();
}
-