Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-25 03:34:28 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-25 03:34:28 +0300
commitfcc5b5c48c127b0b4567434e8ce5c30dc91ae1e3 (patch)
treef28e4014d12bcaede5ea11c75af12e6dbc5af57f /source
parent737ca9ad5fa11ce188c8c3f6508e6f33180b0d16 (diff)
fix for blenderplayer using un-initialized mathutils types.
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index d274b3e4eac..0be0fa3c7dc 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1918,7 +1918,7 @@ static void restorePySysObjects(void)
}
// 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 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
#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 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
}
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;