remove reload() from builtins since python3 no longer uses this.
use imp.reload now. Should use import hooks but for now replace imp.reload with our own reload as the builtin reload was replaced before.
This commit is contained in:
@@ -51,7 +51,6 @@ import os
|
||||
import inspect
|
||||
import bpy
|
||||
import rna_info
|
||||
reload(rna_info)
|
||||
|
||||
# lame, python wont give some access
|
||||
ClassMethodDescriptorType = type(dict.__dict__['fromkeys'])
|
||||
|
||||
@@ -20,17 +20,18 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "init_data" in locals():
|
||||
reload(model)
|
||||
reload(operators)
|
||||
reload(client)
|
||||
reload(slave)
|
||||
reload(master)
|
||||
reload(master_html)
|
||||
reload(utils)
|
||||
reload(balancing)
|
||||
reload(ui)
|
||||
reload(repath)
|
||||
reload(versioning)
|
||||
import imp
|
||||
imp.reload(model)
|
||||
imp.reload(operators)
|
||||
imp.reload(client)
|
||||
imp.reload(slave)
|
||||
imp.reload(master)
|
||||
imp.reload(master_html)
|
||||
imp.reload(utils)
|
||||
imp.reload(balancing)
|
||||
imp.reload(ui)
|
||||
imp.reload(repath)
|
||||
imp.reload(versioning)
|
||||
else:
|
||||
from netrender import model
|
||||
from netrender import operators
|
||||
|
||||
@@ -140,6 +140,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
traceback.print_exc()
|
||||
|
||||
def test_reload(mod):
|
||||
import imp
|
||||
# reloading this causes internal errors
|
||||
# because the classes from this module are stored internally
|
||||
# possibly to refresh internal references too but for now, best not to.
|
||||
@@ -147,7 +148,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
return mod
|
||||
|
||||
try:
|
||||
return reload(mod)
|
||||
return imp.reload(mod)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
@@ -365,6 +366,7 @@ def addon_enable(module_name, default_set=True):
|
||||
import os
|
||||
import sys
|
||||
import bpy_types as _bpy_types
|
||||
import imp
|
||||
|
||||
|
||||
_bpy_types._register_immediate = False
|
||||
@@ -385,7 +387,7 @@ def addon_enable(module_name, default_set=True):
|
||||
print("module changed on disk:", mod.__file__, "reloading...")
|
||||
|
||||
try:
|
||||
reload(mod)
|
||||
imp.reload(mod)
|
||||
except:
|
||||
handle_error()
|
||||
del sys.modules[module_name]
|
||||
@@ -477,7 +479,8 @@ def addon_reset_all(reload_scripts=False):
|
||||
"""
|
||||
Sets the addon state based on the user preferences.
|
||||
"""
|
||||
|
||||
import imp
|
||||
|
||||
# RELEASE SCRIPTS: official scripts distributed in Blender releases
|
||||
paths = script_paths("addons")
|
||||
|
||||
@@ -496,7 +499,7 @@ def addon_reset_all(reload_scripts=False):
|
||||
if reload_scripts:
|
||||
mod = _sys.modules.get(mod_name)
|
||||
if mod:
|
||||
reload(mod)
|
||||
imp.reload(mod)
|
||||
|
||||
if is_enabled == is_loaded:
|
||||
pass
|
||||
|
||||
@@ -692,7 +692,6 @@ class UpdateAnimData(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
import animsys_refactor
|
||||
reload(animsys_refactor)
|
||||
animsys_refactor.update_data_paths(data_path_update)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
from imp import reload
|
||||
import imp
|
||||
if "import_bvh" in locals():
|
||||
reload(import_bvh)
|
||||
imp.reload(import_bvh)
|
||||
|
||||
|
||||
import bpy
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
from imp import reload
|
||||
import imp
|
||||
if "export_ply" in locals():
|
||||
reload(export_ply)
|
||||
imp.reload(export_ply)
|
||||
|
||||
|
||||
import bpy
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
from imp import reload
|
||||
import imp
|
||||
if "import_3ds" in locals():
|
||||
reload(import_3ds)
|
||||
imp.reload(import_3ds)
|
||||
if "export_3ds" in locals():
|
||||
reload(export_3ds)
|
||||
imp.reload(export_3ds)
|
||||
|
||||
|
||||
import bpy
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
from imp import reload
|
||||
import imp
|
||||
if "export_fbx" in locals():
|
||||
reload(export_fbx)
|
||||
imp.reload(export_fbx)
|
||||
|
||||
|
||||
import bpy
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
from imp import reload
|
||||
import imp
|
||||
if "import_obj" in locals():
|
||||
reload(import_obj)
|
||||
imp.reload(import_obj)
|
||||
if "export_obj" in locals():
|
||||
reload(export_obj)
|
||||
imp.reload(export_obj)
|
||||
|
||||
|
||||
import bpy
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
from imp import reload
|
||||
import imp
|
||||
if "export_x3d" in locals():
|
||||
reload(export_x3d)
|
||||
imp.reload(export_x3d)
|
||||
|
||||
|
||||
import bpy
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
from imp import reload
|
||||
import imp
|
||||
if "import_mdd" in locals():
|
||||
reload(import_mdd)
|
||||
imp.reload(import_mdd)
|
||||
if "export_mdd" in locals():
|
||||
reload(export_mdd)
|
||||
imp.reload(export_mdd)
|
||||
|
||||
|
||||
import bpy
|
||||
|
||||
@@ -75,8 +75,6 @@ def pose_info():
|
||||
|
||||
|
||||
def bake(frame_start, frame_end, step=1, only_selected=False):
|
||||
# import nla; reload(nla); nla.bake()
|
||||
|
||||
scene = bpy.context.scene
|
||||
obj = bpy.context.object
|
||||
pose = obj.pose
|
||||
|
||||
@@ -2290,7 +2290,6 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
|
||||
|
||||
def draw(self, context):
|
||||
import rna_prop_ui
|
||||
# reload(rna_prop_ui)
|
||||
member = __class__._active_context_member(context)
|
||||
|
||||
if member:
|
||||
|
||||
@@ -252,11 +252,24 @@ void BPY_start_python( int argc, char **argv )
|
||||
|
||||
{ /* 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, "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 {
|
||||
BKE_assert(!"unable to load 'imp' module.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pyrna_alloc_types();
|
||||
|
||||
Reference in New Issue
Block a user