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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-01-24 06:38:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-24 06:38:34 +0300
commitdaa09a4a60086017e75c50c6de0b27fa51232e29 (patch)
treecaa1a8c16bce7f1a4b89f5b9410e1868acc0f814 /source/blender/makesrna/intern
parent0097997911b8ed428e65f3fc7e46464575e71160 (diff)
Raise an exception when registering classes with ID names which are too long. (related to bug ), found while looking into bug [#25776].
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/rna_animation.c2
-rw-r--r--source/blender/makesrna/intern/rna_render.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui.c6
-rw-r--r--source/blender/makesrna/intern/rna_wm.c14
4 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index a28017e50f6..9bed1b5cd5a 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -458,7 +458,7 @@ static void rna_def_keyingset_info(BlenderRNA *brna)
prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
/* Name */
prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 5d1fc51a70f..6344ddca06e 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -271,7 +271,7 @@ static void rna_def_render_engine(BlenderRNA *brna)
prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->name");
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 183c9aea5e2..35186b91901 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -646,7 +646,7 @@ static void rna_def_panel(BlenderRNA *brna)
/* registration */
prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
RNA_def_property_ui_text(prop, "ID Name", "If this is set, the panel gets a custom ID, otherwise it takes the name of the class used to define the panel. For example, if the class name is \"OBJECT_PT_hello\", and bl_idname is not set by the script, then bl_idname = \"OBJECT_PT_hello\"");
prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
@@ -708,7 +708,7 @@ static void rna_def_header(BlenderRNA *brna)
/* registration */
prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
RNA_def_property_ui_text(prop, "ID Name", "If this is set, the header gets a custom ID, otherwise it takes the name of the class used to define the panel. For example, if the class name is \"OBJECT_HT_hello\", and bl_idname is not set by the script, then bl_idname = \"OBJECT_HT_hello\"");
prop= RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
@@ -758,7 +758,7 @@ static void rna_def_menu(BlenderRNA *brna)
/* registration */
prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
RNA_def_property_ui_text(prop, "ID Name", "If this is set, the menu gets a custom ID, otherwise it takes the name of the class used to define the panel. For example, if the class name is \"OBJECT_MT_hello\", and bl_idname is not set by the script, then bl_idname = \"OBJECT_MT_hello\"");
prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index a7870243afc..6ef173113fd 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -867,6 +867,14 @@ static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void *
return NULL;
}
+ /* sanity check on name
+ * foo.bar */
+// {
+// char *ch;
+// for(ch=identifier)
+
+// }
+
/* check if we have registered this operator type before, and remove it */
{
wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE);
@@ -1121,10 +1129,10 @@ static void rna_def_operator(BlenderRNA *brna)
/* Registration */
prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
+ RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME-3); /* else it uses the pointer size!. -3 because '.' -> '_OT_' */
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
RNA_def_struct_name_property(srna, prop);
prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
@@ -1185,7 +1193,7 @@ static void rna_def_macro_operator(BlenderRNA *brna)
RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
RNA_def_struct_name_property(srna, prop);
prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);