bugfix [#23148] "ImportError: __import__ not found" on changing Render FPS
The BGE was getting the namespace dict directly from __main__ which conflicts with my recent fix to get the pickle module working which to overwrote the __main__ module on script execution. Simple fix is to have the BGE and Blender use the same method of getting namespaces. Renamed CreateGlobalDictionary() to bpy_namespace_dict_new() and moved into bpy_internal_import.c pickle still wont work in the BGE since we make a copy of __main__ namespace but for speed would rather not have to replace the __main__ module many times per second.
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user