diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-03 13:15:25 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-03 13:16:30 +0300 |
commit | b4ccec67429b4bd9f738c11627240c07f60d6bd0 (patch) | |
tree | 2813d7c328b1852635d2d3293ebbd209730a1c57 /source/blender | |
parent | a94d582a40ffc06b19f0e4af6ba107c1433fcb1e (diff) |
Fix ID buttons not working in popover menus.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 27 |
1 files 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; - - memset(r_ptr, 0, sizeof(*r_ptr)); - *r_prop = NULL; - - if (!ar) - return; + uiBut *but = UI_context_active_but_get(C); - 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; |