[Bf-blender-cvs] [b4ccec67429] blender2.8: Fix ID buttons not working in popover menus.

Brecht Van Lommel noreply at git.blender.org
Tue Jul 3 12:29:24 CEST 2018


Commit: b4ccec67429b4bd9f738c11627240c07f60d6bd0
Author: Brecht Van Lommel
Date:   Tue Jul 3 12:15:25 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb4ccec67429b4bd9f738c11627240c07f60d6bd0

Fix ID buttons not working in popover menus.

===================================================================

M	source/blender/editors/interface/interface_templates.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list