diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 7327b9c08ff..3e63aa61d82 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1912,9 +1912,8 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur first_time = false; PyObjectPlus::ClearDeprecationWarning(); - - PyObject* moduleobj = PyImport_AddModule("__main__"); - return PyModule_GetDict(moduleobj); + + return bpy_namespace_dict_new(NULL); } void exitGamePlayerPythonScripting() @@ -1949,9 +1948,8 @@ PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLev initPySysObjects(maggie); PyObjectPlus::NullDeprecationWarning(); - - PyObject* moduleobj = PyImport_AddModule("__main__"); - return PyModule_GetDict(moduleobj); + + return bpy_namespace_dict_new(NULL); } void exitGamePythonScripting() @@ -1992,7 +1990,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main * initVideoTexture(); /* could be done a lot more nicely, but for now a quick way to get bge.* working */ - PyRun_SimpleString("__import__('sys').modules['bge']=[mod for mod in (type(__builtins__)('bge'), ) if mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')}) is None][0]"); + PyRun_SimpleString("sys = __import__('sys');mod = sys.modules['bge'] = type(sys)('bge');mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')})"); } static struct PyModuleDef Rasterizer_module_def = { |