[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54630] trunk/blender: Make list_id mandatory when using default UI_UL_list class for a template_list .
Bastien Montagne
montagne29 at wanadoo.fr
Mon Feb 18 15:03:26 CET 2013
Revision: 54630
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54630
Author: mont29
Date: 2013-02-18 14:03:26 +0000 (Mon, 18 Feb 2013)
Log Message:
-----------
Make list_id mandatory when using default UI_UL_list class for a template_list.
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/__init__.py
trunk/blender/source/blender/editors/include/UI_interface.h
trunk/blender/source/blender/editors/interface/interface_templates.c
trunk/blender/source/blender/makesrna/intern/rna_ui_api.c
Modified: trunk/blender/release/scripts/startup/bl_ui/__init__.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/__init__.py 2013-02-18 13:51:01 UTC (rev 54629)
+++ trunk/blender/release/scripts/startup/bl_ui/__init__.py 2013-02-18 14:03:26 UTC (rev 54630)
@@ -137,6 +137,7 @@
# Define a default UIList, when a list does not need any custom drawing...
+# Keep in sync with its #defined name in UI_interface.h
class UI_UL_list(bpy.types.UIList):
pass
Modified: trunk/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_interface.h 2013-02-18 13:51:01 UTC (rev 54629)
+++ trunk/blender/source/blender/editors/include/UI_interface.h 2013-02-18 14:03:26 UTC (rev 54630)
@@ -832,6 +832,8 @@
void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);
void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr);
+/* Default UIList class name, keep in sync with its declaration in bl_ui/__init__.py */
+#define UI_UL_DEFAULT_CLASS_NAME "UI_UL_list"
void uiTemplateList(uiLayout *layout, struct bContext *C, const char *listtype_name, const char *list_id,
struct PointerRNA *dataptr, const char *propname, struct PointerRNA *active_dataptr,
const char *active_propname, int rows, int maxrows, int layout_type);
Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c 2013-02-18 13:51:01 UTC (rev 54629)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c 2013-02-18 14:03:26 UTC (rev 54630)
@@ -2478,6 +2478,13 @@
int min, max;
/* validate arguments */
+ /* Forbid default UI_UL_DEFAULT_CLASS_NAME list class without a custom list_id! */
+ if (!strcmp(UI_UL_DEFAULT_CLASS_NAME, listtype_name) && !(list_id && list_id[0])) {
+ RNA_warning("template_list using default '" UI_UL_DEFAULT_CLASS_NAME
+ "' UIList class must provide a custom list_id");
+ return;
+ }
+
block = uiLayoutGetBlock(layout);
if (!active_dataptr->data) {
Modified: trunk/blender/source/blender/makesrna/intern/rna_ui_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_ui_api.c 2013-02-18 13:51:01 UTC (rev 54629)
+++ trunk/blender/source/blender/makesrna/intern/rna_ui_api.c 2013-02-18 14:03:26 UTC (rev 54630)
@@ -771,8 +771,8 @@
parm = RNA_def_string(func, "listtype_name", "", 0, "", "Identifier of the list type to use");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_string(func, "list_id", "", 0, "",
- "Identifier of this list widget (should be systematically used with default UI_UL_list "
- "class). "
+ "Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME
+ "\" class). "
"If this is set, the uilist gets a custom ID, otherwise it takes the "
"name of the class used to define the uilist (for example, if the "
"class name is \"OBJECT_UL_vgroups\", and list_id is not set by the "
More information about the Bf-blender-cvs
mailing list