[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32296] trunk/blender/source: - use own string conversion function over PyUnicode_FromString when converting the argv

Campbell Barton ideasman42 at gmail.com
Mon Oct 4 03:18:58 CEST 2010


Revision: 32296
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32296
Author:   campbellbarton
Date:     2010-10-04 03:18:47 +0200 (Mon, 04 Oct 2010)

Log Message:
-----------
- use own string conversion function over PyUnicode_FromString when converting the argv
- report errors when files dont load when given from the command line but not running in background mode.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/report.c
    trunk/blender/source/blender/python/intern/bpy_interface.c
    trunk/blender/source/creator/creator.c

Modified: trunk/blender/source/blender/blenkernel/intern/report.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/report.c	2010-10-04 00:40:48 UTC (rev 32295)
+++ trunk/blender/source/blender/blenkernel/intern/report.c	2010-10-04 01:18:47 UTC (rev 32296)
@@ -127,6 +127,7 @@
 		va_start(args, format);
 		vprintf(format, args);
 		va_end(args);
+		fprintf(stdout, "\n"); /* otherise each report needs to include a \n */
 		fflush(stdout); /* this ensures the message is printed before a crash */
 	}
 

Modified: trunk/blender/source/blender/python/intern/bpy_interface.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_interface.c	2010-10-04 00:40:48 UTC (rev 32295)
+++ trunk/blender/source/blender/python/intern/bpy_interface.c	2010-10-04 01:18:47 UTC (rev 32296)
@@ -213,25 +213,10 @@
 	/* sigh, why do python guys not have a char** version anymore? :( */
 	{
 		int i;
-#if 0
 		PyObject *py_argv= PyList_New(argc);
 		for (i=0; i<argc; i++)
-			PyList_SET_ITEM(py_argv, i, PyUnicode_FromString(argv[i]));
+			PyList_SET_ITEM(py_argv, i, PyC_UnicodeFromByte(argv[i])); /* should fix bug #20021 - utf path name problems, by replacing PyUnicode_FromString */
 
-#else	// should fix bug #20021 - utf path name problems
-		PyObject *py_argv= PyList_New(0);
-		for (i=0; i<argc; i++) {
-			PyObject *item= PyUnicode_Decode(argv[i], strlen(argv[i]), Py_FileSystemDefaultEncoding, NULL);
-			if(item==NULL) { // should never happen
-				PyErr_Print();
-				PyErr_Clear();
-			}
-			else {
-				PyList_Append(py_argv, item);
-				Py_DECREF(item);
-			}
-		}
-#endif
 		PySys_SetObject("argv", py_argv);
 		Py_DECREF(py_argv);
 	}

Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c	2010-10-04 00:40:48 UTC (rev 32295)
+++ trunk/blender/source/creator/creator.c	2010-10-04 01:18:47 UTC (rev 32296)
@@ -897,7 +897,10 @@
 	} else {
 		/* we are not running in background mode here, but start blender in UI mode with
 		   a file - this should do everything a 'load file' does */
-		WM_read_file(C, filename, NULL);
+		ReportList reports;
+		BKE_reports_init(&reports, RPT_PRINT);
+		WM_read_file(C, filename, &reports);
+		BKE_reports_clear(&reports);
 	}
 
 	G.file_loaded = 1;





More information about the Bf-blender-cvs mailing list