fix [#26667] Can't import scripts when using blenderplayer
- move import override initialization to bpy_internal_import.c so the player and blender can both call. - remove ineffectual & unused sandboxing code.
This commit is contained in:
@@ -272,27 +272,7 @@ void BPY_python_start(int argc, const char **argv)
|
||||
/* bpy.* and lets us import it */
|
||||
BPy_init_modules();
|
||||
|
||||
{ /* our own import and reload functions */
|
||||
PyObject *item;
|
||||
PyObject *mod;
|
||||
//PyObject *m= PyImport_AddModule("__builtin__");
|
||||
//PyObject *d= PyModule_GetDict(m);
|
||||
PyObject *d= PyEval_GetBuiltins();
|
||||
// PyDict_SetItemString(d, "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
|
||||
PyDict_SetItemString(d, "__import__", item=PyCFunction_New(&bpy_import_meth, NULL)); Py_DECREF(item);
|
||||
|
||||
/* move reload here
|
||||
* XXX, use import hooks */
|
||||
mod= PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
|
||||
if(mod) {
|
||||
PyDict_SetItemString(PyModule_GetDict(mod), "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
|
||||
Py_DECREF(mod);
|
||||
}
|
||||
else {
|
||||
BLI_assert(!"unable to load 'imp' module.");
|
||||
}
|
||||
|
||||
}
|
||||
bpy_import_init(PyEval_GetBuiltins());
|
||||
|
||||
pyrna_alloc_types();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user