[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35762] trunk/blender/source/gameengine/ Ketsji/KX_PythonInit.cpp: fix for blenderplayer using un-initialized mathutils types.

Campbell Barton ideasman42 at gmail.com
Fri Mar 25 01:34:28 CET 2011


Revision: 35762
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35762
Author:   campbellbarton
Date:     2011-03-25 00:34:28 +0000 (Fri, 25 Mar 2011)
Log Message:
-----------
fix for blenderplayer using un-initialized mathutils types.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp	2011-03-25 00:32:38 UTC (rev 35761)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp	2011-03-25 00:34:28 UTC (rev 35762)
@@ -1918,7 +1918,7 @@
 }
 
 // Copied from bpy_interface.c
-static struct _inittab bpy_internal_modules[]= {
+static struct _inittab bge_internal_modules[]= {
 	{"mathutils", BPyInit_mathutils},
 	{"bgl", BPyInit_bgl},
 	{"blf", BPyInit_blf},
@@ -1945,6 +1945,10 @@
 #endif
 	Py_NoSiteFlag=1;
 	Py_FrozenFlag=1;
+
+	/* must run before python initializes */
+	PyImport_ExtendInittab(bge_internal_modules);
+
 	Py_Initialize();
 	
 	if(argv && first_time) { /* browser plugins dont currently set this */
@@ -1961,13 +1965,18 @@
 	}
 	
 	setSandbox(level);
+
+	/* mathutils types are used by the BGE even if we dont import them */
+	{
+		PyObject *mod= PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0);
+		Py_DECREF(mod);
+	}
+
 	initPyTypes();
 	
 	bpy_import_main_set(maggie);
 	
 	initPySysObjects(maggie);
-
-	PyImport_ExtendInittab(bpy_internal_modules);
 	
 	first_time = false;
 	




More information about the Bf-blender-cvs mailing list