[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34474] trunk/blender/source/blender: fix for error in last commit.

Campbell Barton ideasman42 at gmail.com
Mon Jan 24 05:00:03 CET 2011


Revision: 34474
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34474
Author:   campbellbarton
Date:     2011-01-24 04:00:02 +0000 (Mon, 24 Jan 2011)
Log Message:
-----------
fix for error in last commit. string length isn't stored for most idname values, so set manually.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_screen.h
    trunk/blender/source/blender/makesrna/intern/rna_animation.c
    trunk/blender/source/blender/makesrna/intern/rna_render.c
    trunk/blender/source/blender/makesrna/intern/rna_ui.c
    trunk/blender/source/blender/makesrna/intern/rna_wm.c
    trunk/blender/source/blender/python/intern/bpy_rna.c

Modified: trunk/blender/source/blender/blenkernel/BKE_screen.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_screen.h	2011-01-24 03:38:34 UTC (rev 34473)
+++ trunk/blender/source/blender/blenkernel/BKE_screen.h	2011-01-24 04:00:02 UTC (rev 34474)
@@ -48,6 +48,7 @@
 struct wmKeyConfig;
 struct uiLayout;
 struct uiMenuItem;
+struct View3D;
 
 #include "RNA_types.h"
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_animation.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_animation.c	2011-01-24 03:38:34 UTC (rev 34473)
+++ trunk/blender/source/blender/makesrna/intern/rna_animation.c	2011-01-24 04:00:02 UTC (rev 34474)
@@ -458,6 +458,7 @@
 		
 	prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "idname");
+	RNA_def_property_string_maxlength(prop, sizeof(((KeyingSetInfo *)NULL)->idname)); /* TODO, should be able to calculate this automatic! */
 	RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
 		
 	/* Name */

Modified: trunk/blender/source/blender/makesrna/intern/rna_render.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_render.c	2011-01-24 03:38:34 UTC (rev 34473)
+++ trunk/blender/source/blender/makesrna/intern/rna_render.c	2011-01-24 04:00:02 UTC (rev 34474)
@@ -271,6 +271,7 @@
 
 	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, sizeof(((RenderEngineType *)NULL)->idname)); /* TODO, should be able to calculate this automatic! */
 	RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
 
 	prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);

Modified: trunk/blender/source/blender/makesrna/intern/rna_ui.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_ui.c	2011-01-24 03:38:34 UTC (rev 34473)
+++ trunk/blender/source/blender/makesrna/intern/rna_ui.c	2011-01-24 04:00:02 UTC (rev 34474)
@@ -26,6 +26,8 @@
 
 #include "DNA_screen_types.h"
 
+#include "BKE_screen.h"
+
 #include "RNA_define.h"
 
 #include "rna_internal.h"
@@ -646,6 +648,7 @@
 	/* 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, sizeof(((PanelType *)NULL)->idname)); /* TODO, should be able to calculate this automatic! */
 	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\"");
 	
@@ -708,6 +711,7 @@
 	/* 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, sizeof(((HeaderType *)NULL)->idname)); /* TODO, should be able to calculate this automatic! */
 	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\"");
 
@@ -758,6 +762,7 @@
 	/* 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, sizeof(((MenuType *)NULL)->idname)); /* TODO, should be able to calculate this automatic! */
 	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\"");
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_wm.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_wm.c	2011-01-24 03:38:34 UTC (rev 34473)
+++ trunk/blender/source/blender/makesrna/intern/rna_wm.c	2011-01-24 04:00:02 UTC (rev 34474)
@@ -1190,7 +1190,7 @@
 	/* 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! */
 	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|PROP_NEVER_CLAMP);

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2011-01-24 03:38:34 UTC (rev 34473)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2011-01-24 04:00:02 UTC (rev 34474)
@@ -1096,7 +1096,7 @@
 					if(RNA_property_flag(prop) & PROP_NEVER_CLAMP) {
 						int param_size_max= RNA_property_string_maxlength(prop);
 						if(param_size > param_size_max) {
-							PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s only supports a string of length %d, found %d", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), param_size, param_size_max);
+							PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s only supports a string of length %d, found %d", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), param_size_max, param_size);
 							return -1;
 						}
 #ifdef USE_STRING_COERCE




More information about the Bf-blender-cvs mailing list