From b4ccec67429b4bd9f738c11627240c07f60d6bd0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 3 Jul 2018 12:15:25 +0200 Subject: [PATCH] Fix ID buttons not working in popover menus. --- .../editors/interface/interface_templates.c | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 271eef051c6..a14d12492ec 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -394,32 +394,15 @@ void UI_context_active_but_prop_get_templateID( PointerRNA *r_ptr, PropertyRNA **r_prop) { TemplateID *template_ui; - ARegion *ar = CTX_wm_region(C); - uiBlock *block; - uiBut *but; + uiBut *but = UI_context_active_but_get(C); - memset(r_ptr, 0, sizeof(*r_ptr)); - *r_prop = NULL; - - if (!ar) - return; - - for (block = ar->uiblocks.first; block; block = block->next) { - for (but = block->buttons.first; but; but = but->next) { - /* find the button before the active one */ - if ((but->flag & (UI_BUT_LAST_ACTIVE | UI_ACTIVE))) { - if (but->func_argN) { - template_ui = but->func_argN; - *r_ptr = template_ui->ptr; - *r_prop = template_ui->prop; - return; - } - } - } + if (but && but->func_argN) { + template_ui = but->func_argN; + *r_ptr = template_ui->ptr; + *r_prop = template_ui->prop; } } - static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) { TemplateID *template_ui = (TemplateID *)arg_litem;