[Bf-blender-cvs] [bd335f1] master: Fix T47657: Using template_list() with invoke_props_dialog()

Bastien Montagne noreply at git.blender.org
Fri May 6 21:57:55 CEST 2016


Commit: bd335f13fe3d25e8e6bb472acb9c727d1629e582
Author: Bastien Montagne
Date:   Fri May 6 21:56:54 2016 +0200
Branches: master
https://developer.blender.org/rBbd335f13fe3d25e8e6bb472acb9c727d1629e582

Fix T47657: Using template_list() with invoke_props_dialog()

popups have no wm_region in context, using wm_menu here.

Not working perfect, but at least it prevents crash.

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

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 a47d608..a3b04e1 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2947,7 +2947,11 @@ void uiTemplateList(
 	/* We tag the list id with the list type... */
 	BLI_snprintf(ui_list_id, sizeof(ui_list_id), "%s_%s", ui_list_type->idname, list_id ? list_id : "");
 
-	ar = CTX_wm_region(C);
+	/* Allows to work in popups. */
+	ar = CTX_wm_menu(C);
+	if (ar == NULL) {
+		ar = CTX_wm_region(C);
+	}
 	ui_list = BLI_findstring(&ar->ui_lists, ui_list_id, offsetof(uiList, list_id));
 
 	if (!ui_list) {




More information about the Bf-blender-cvs mailing list