Revision: 35686
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35686
Author:   moguri
Date:     2011-03-22 08:35:56 +0000 (Tue, 22 Mar 2011)
Log Message:
-----------
Blenderplayer: Fixing import issues. Using PyImport_ExtendInittab() for the 
Blender modules allows them to be imported in the Blenderplayer.

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

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp    2011-03-22 
08:30:07 UTC (rev 35685)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp    2011-03-22 
08:35:56 UTC (rev 35686)
@@ -1917,6 +1917,15 @@
 //     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 @@
        bpy_import_main_set(maggie);
        
        initPySysObjects(maggie);
+
+       PyImport_ExtendInittab(bpy_internal_modules);
        
        first_time = false;
        
@@ -2045,11 +2056,6 @@
 
        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 @@
        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)
 {

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.h      2011-03-22 
08:30:07 UTC (rev 35685)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonInit.h      2011-03-22 
08:35:56 UTC (rev 35686)
@@ -49,10 +49,6 @@
 PyObject*      initGameKeys();
 PyObject*      initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* 
canvas);
 PyObject*      initGamePlayerPythonScripting(const STR_String& progname, 
TPythonSecurityLevel level, struct Main *maggie, int argc, char** argv);
-PyObject*      initMathutils();
-PyObject*      initGeometry();
-PyObject*      initBGL();
-PyObject*      initBLF();
 PyObject*      initVideoTexture(void); 
 void           exitGamePlayerPythonScripting();
 PyObject*      initGamePythonScripting(const STR_String& progname, 
TPythonSecurityLevel level, struct Main *maggie);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to