forked from bartvdbraak/blender
Blenderplayer: Fixing import issues. Using PyImport_ExtendInittab() for the Blender modules allows them to be imported in the Blenderplayer.
This commit is contained in:
parent
91e4a1bdf8
commit
481b4842cf
@ -1917,6 +1917,15 @@ static void restorePySysObjects(void)
|
|||||||
// PyObject_Print(sys_path, stderr, 0);
|
// 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.
|
* Python is not initialised.
|
||||||
*/
|
*/
|
||||||
@ -1957,6 +1966,8 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
|
|||||||
bpy_import_main_set(maggie);
|
bpy_import_main_set(maggie);
|
||||||
|
|
||||||
initPySysObjects(maggie);
|
initPySysObjects(maggie);
|
||||||
|
|
||||||
|
PyImport_ExtendInittab(bpy_internal_modules);
|
||||||
|
|
||||||
first_time = false;
|
first_time = false;
|
||||||
|
|
||||||
@ -2045,11 +2056,6 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *
|
|||||||
|
|
||||||
initGameKeys();
|
initGameKeys();
|
||||||
initPythonConstraintBinding();
|
initPythonConstraintBinding();
|
||||||
initMathutils();
|
|
||||||
initGeometry();
|
|
||||||
initBGL();
|
|
||||||
initBLF();
|
|
||||||
AUD_initPython();
|
|
||||||
initVideoTexture();
|
initVideoTexture();
|
||||||
|
|
||||||
/* could be done a lot more nicely, but for now a quick way to get bge.* working */
|
/* 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;
|
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
|
// utility function for loading and saving the globalDict
|
||||||
int saveGamePythonConfig( char **marshal_buffer)
|
int saveGamePythonConfig( char **marshal_buffer)
|
||||||
{
|
{
|
||||||
|
@ -49,10 +49,6 @@ PyObject* initGameLogic(class KX_KetsjiEngine *engine, class KX_Scene* ketsjisce
|
|||||||
PyObject* initGameKeys();
|
PyObject* initGameKeys();
|
||||||
PyObject* initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* canvas);
|
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* 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);
|
PyObject* initVideoTexture(void);
|
||||||
void exitGamePlayerPythonScripting();
|
void exitGamePlayerPythonScripting();
|
||||||
PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie);
|
PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie);
|
||||||
|
Loading…
Reference in New Issue
Block a user