[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17780] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/system/PythonInterpreter.h: when Freestyle would execute style modules, a copy of the Python script would end up in the text editor and pollute the text editor file list .

Maxime Curioni maxime.curioni at gmail.com
Wed Dec 10 19:36:59 CET 2008


Revision: 17780
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17780
Author:   mxcurioni
Date:     2008-12-10 19:36:56 +0100 (Wed, 10 Dec 2008)

Log Message:
-----------
when Freestyle would execute style modules, a copy of the Python script would end up in the text editor and pollute the text editor file list. This is corrected: executed scripts do not leave trails behind.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/system/PythonInterpreter.h

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/system/PythonInterpreter.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/system/PythonInterpreter.h	2008-12-10 17:58:18 UTC (rev 17779)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/system/PythonInterpreter.h	2008-12-10 18:36:56 UTC (rev 17780)
@@ -37,8 +37,12 @@
 
 //soc
 extern "C" {
+#include "BKE_main.h"
+#include "BKE_global.h"
 #include "BKE_text.h"
+#include "BKE_library.h"
 #include "BPY_extern.h"
+#include "BIF_drawtext.h"
 }
 
 class LIB_SYSTEM_EXPORT PythonInterpreter : public Interpreter
@@ -78,7 +82,11 @@
 		cout << fn << " (at line " <<  BPY_Err_getLinenumber() << ")" << endl;
 		return BPY_Err_getLinenumber();
 	}
-
+	
+	// cleaning up
+	unlink_text(text);
+	free_libblock(&G.main->text, text);
+	
 	return 0;
   }
 
@@ -122,6 +130,10 @@
 	
 	BPY_txt_do_python_Text(text);
 	
+	// cleaning up
+	unlink_text(text);
+	free_libblock(&G.main->text, text);
+	
 	//PyRun_SimpleString("from Freestyle import *");
     _initialized = true;
   }





More information about the Bf-blender-cvs mailing list