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
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2011-03-22 11:35:56 +0300
committerMitchell Stokes <mogurijin@gmail.com>2011-03-22 11:35:56 +0300
commit481b4842cf1f1feae8b0c777eb56275400047074 (patch)
treeb4a4f01a6922723eb80898516949b88f59c78f6c /source/gameengine/Ketsji/KX_PythonInit.cpp
parent91e4a1bdf8c1b7cee7ac5c508775bcd3180b94b6 (diff)
Blenderplayer: Fixing import issues. Using PyImport_ExtendInittab() for the Blender modules allows them to be imported in the Blenderplayer.
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp36
1 files changed, 11 insertions, 25 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index ad3f4b06323..d274b3e4eac 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1917,6 +1917,15 @@ static void restorePySysObjects(void)
// PyObject_Print(sys_path, stderr, 0);
}
+// Copied from bpy_interface.c
+static struct _inittab bpy_internal_modules[]= {
+ {"mathutils", BPyInit_mathutils},
+ {"bgl", BPyInit_bgl},
+ {"blf", BPyInit_blf},
+ {"aud", AUD_initPython},
+ {NULL, NULL}
+};
+
/**
* Python is not initialised.
*/
@@ -1957,6 +1966,8 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
bpy_import_main_set(maggie);
initPySysObjects(maggie);
+
+ PyImport_ExtendInittab(bpy_internal_modules);
first_time = false;
@@ -2045,11 +2056,6 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *
initGameKeys();
initPythonConstraintBinding();
- initMathutils();
- initGeometry();
- initBGL();
- initBLF();
- AUD_initPython();
initVideoTexture();
/* could be done a lot more nicely, but for now a quick way to get bge.* working */
@@ -2358,26 +2364,6 @@ PyObject* initGameKeys()
return d;
}
-PyObject* initMathutils()
-{
- return BPyInit_mathutils();
-}
-
-PyObject* initGeometry()
-{
- return BPyInit_mathutils_geometry();
-}
-
-PyObject* initBGL()
-{
- return BPyInit_bgl();
-}
-
-PyObject* initBLF()
-{
- return BPyInit_blf();
-}
-
// utility function for loading and saving the globalDict
int saveGamePythonConfig( char **marshal_buffer)
{