Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2013-02-18 18:03:26 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-02-18 18:03:26 +0400
commitd7058f12e5f4eeecf32e16e73e08ec3f142729f9 (patch)
tree9c376d52d1642ab765e2582d0d932562729f06c3 /source
parentb187d3375161ee6a0583f0c05181929a6d1f1774 (diff)
Make list_id mandatory when using default UI_UL_list class for a template_list.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/interface/interface_templates.c7
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c4
3 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 434fb58184f..eb74dd1e274 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -832,6 +832,8 @@ void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *te
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);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 8dc51387db7..5805806a9a9 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2478,6 +2478,13 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
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) {
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index d0b21948a41..0ce98e0b364 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -771,8 +771,8 @@ void RNA_api_ui_layout(StructRNA *srna)
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 "