[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32803] trunk/blender/source/blender: bugfix [#24462] UV Layouts saved as PNG results in two files (one is 0 KB, other has corrupted filename)

Campbell Barton ideasman42 at gmail.com
Mon Nov 1 02:46:26 CET 2010


Revision: 32803
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32803
Author:   campbellbarton
Date:     2010-11-01 02:46:26 +0100 (Mon, 01 Nov 2010)

Log Message:
-----------
bugfix [#24462] UV Layouts saved as PNG results in two files (one is 0 KB, other has corrupted filename)

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/path_util.c
    trunk/blender/source/blender/makesrna/RNA_define.h
    trunk/blender/source/blender/makesrna/intern/rna_define.c
    trunk/blender/source/blender/makesrna/intern/rna_scene_api.c

Modified: trunk/blender/source/blender/blenlib/intern/path_util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/path_util.c	2010-11-01 01:45:40 UTC (rev 32802)
+++ trunk/blender/source/blender/blenlib/intern/path_util.c	2010-11-01 01:46:26 UTC (rev 32803)
@@ -543,9 +543,20 @@
 		ensure_digits(path, digits);
 
 	if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
-		char tmp[FILE_MAX], format[64];
+		char tmp[FILE_MAX];
+#if 0	// neat but breaks on non ascii strings.
+		char format[64];
 		sprintf(format, "%%.%ds%%.%dd%%s", ch_sta, ch_end-ch_sta); /* example result: "%.12s%.5d%s" */
 		sprintf(tmp, format, path, frame, path+ch_end);
+#else
+		char format[8];
+		char *p;
+		sprintf(format, "%%.%dd", ch_end-ch_sta); /* example result: "%.5d" */
+		memcpy(tmp, path, sizeof(char) * ch_sta);
+		p= tmp + ch_sta;
+		p += sprintf(p, format, frame);
+		memcpy(p, path + ch_end, strlen(path + ch_end));
+#endif
 		strcpy(path, tmp);
 		return 1;
 	}

Modified: trunk/blender/source/blender/makesrna/RNA_define.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_define.h	2010-11-01 01:45:40 UTC (rev 32802)
+++ trunk/blender/source/blender/makesrna/RNA_define.h	2010-11-01 01:46:26 UTC (rev 32803)
@@ -132,6 +132,7 @@
 
 void RNA_def_property_flag(PropertyRNA *prop, int flag);
 void RNA_def_property_clear_flag(PropertyRNA *prop, int flag);
+void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype);
 void RNA_def_property_array(PropertyRNA *prop, int length);
 void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, int length[]);
 void RNA_def_property_range(PropertyRNA *prop, double min, double max);

Modified: trunk/blender/source/blender/makesrna/intern/rna_define.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_define.c	2010-11-01 01:45:40 UTC (rev 32802)
+++ trunk/blender/source/blender/makesrna/intern/rna_define.c	2010-11-01 01:46:26 UTC (rev 32803)
@@ -1005,6 +1005,11 @@
 	prop->flag &= ~flag;
 }
 
+void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
+{
+	prop->subtype= subtype;
+}
+
 void RNA_def_property_array(PropertyRNA *prop, int length)
 {
 	StructRNA *srna= DefRNA.laststruct;

Modified: trunk/blender/source/blender/makesrna/intern/rna_scene_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene_api.c	2010-11-01 01:45:40 UTC (rev 32802)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene_api.c	2010-11-01 01:46:26 UTC (rev 32803)
@@ -96,8 +96,9 @@
 	func= RNA_def_function(srna, "frame_path", "rna_SceneRender_get_frame_path");
 	RNA_def_function_ui_description(func, "Return the absolute path to the filename to be written for a given frame.");
 	parm= RNA_def_int(func, "frame", INT_MIN, INT_MIN, INT_MAX, "", "Frame number to use, if unset the current frame will be used.", MINAFRAME, MAXFRAME);
-	parm= RNA_def_string(func, "name", "", FILE_MAX, "File Name", "the resulting filename from the scenes render settings.");
+	parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "the resulting filepath from the scenes render settings.");
 	RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */
+	RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
 	RNA_def_function_output(func, parm);
 }
 





More information about the Bf-blender-cvs mailing list