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-05-02 11:58:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-02 12:03:03 +0300
commit2bc9396b551ff15cb3fee3eca91aa6357d71ae33 (patch)
treeaa0010a9696fb9052d640bc2ec7aef24b814cb9c
parent9b21055dfbfb85c85bffd23678616c55de5ddc79 (diff)
UI: disable popovers when panel poll fails
-rw-r--r--source/blender/editors/interface/interface_layout.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index d615bde0f28..347a45c6d2a 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1948,7 +1948,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const
}
/* popover */
-void uiItemPopoverPanel_ptr(uiLayout *layout, bContext *UNUSED(C), PanelType *pt, const char *name, int icon)
+void uiItemPopoverPanel_ptr(uiLayout *layout, bContext *C, PanelType *pt, const char *name, int icon)
{
if (!name) {
name = CTX_IFACE_(pt->translation_context, pt->label);
@@ -1959,6 +1959,9 @@ void uiItemPopoverPanel_ptr(uiLayout *layout, bContext *UNUSED(C), PanelType *pt
uiBut *but = ui_item_menu(layout, name, icon, ui_item_paneltype_func, pt, NULL, NULL, false);
but->type = UI_BTYPE_POPOVER;
+ if (pt->poll && (pt->poll(C, pt) == false)) {
+ but->flag |= UI_BUT_DISABLED;
+ }
}
void uiItemPopoverPanel(