remove reload() from builtins since python3 no longer uses this.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 22 Dec 2010 21:39:48 +0000 (21:39 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 22 Dec 2010 21:39:48 +0000 (21:39 +0000)
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.

14 files changed:
doc/python_api/sphinx_doc_gen.py
release/scripts/io/netrender/__init__.py
release/scripts/modules/bpy/utils.py
release/scripts/op/animsys_update.py
release/scripts/op/io_anim_bvh/__init__.py
release/scripts/op/io_mesh_ply/__init__.py
release/scripts/op/io_scene_3ds/__init__.py
release/scripts/op/io_scene_fbx/__init__.py
release/scripts/op/io_scene_obj/__init__.py
release/scripts/op/io_scene_x3d/__init__.py
release/scripts/op/io_shape_mdd/__init__.py
release/scripts/op/nla.py
release/scripts/ui/space_view3d.py
source/blender/python/intern/bpy_interface.c

index ae0bb43d1bcaadecf2cb2f3c168446f0cb991121..48dce92bee394710f6f1b7918e12b139b0ac9113 100644 (file)
@@ -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'])
index 2ee57708fe09a58f223ece15be5c2393a5ba95b2..2fc9e78c0976708c7e35f07b5c9103fce68bd342 100644 (file)
 
 # 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
index 54acc4874d15073da177f68543315c936892a267..e979c75f95e8d49256b46770ca06fee68eae3425 100644 (file)
@@ -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
index 41ad65b1d71b4e041d898462c1b5e708d4dcb508..24a56c7a1e1e0f22e7efd19dbdf844cb0cb7c075 100644 (file)
@@ -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'}
 
index d32fdfad0ce8028b0a77477cb306943be04ee467..ec56f76b11f288e4b8fc7bdaf369474416a56f52 100644 (file)
@@ -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
index 73ac15167ae00995f877453dabcabf375bd241f6..b7004be98c21fb867148645708b207b1b8520d1e 100644 (file)
@@ -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
index da5807b5c4a7a1c57e7fac08ec758a599357ddd7..51cec065ac0dd4945150e498d3269ea6db13cac4 100644 (file)
 
 # 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
index d2c809cab0beb9f56afe70d6b7478433bede5145..baf7e78014a1c54b28dd3ac60912b3085ff3a8ea 100644 (file)
@@ -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
index f2825d4e33e8d7e833cf0f1671e26d8b43bc51c7..8a35bb81dd9dcb19e5dd793be62f3d0c04126870 100644 (file)
 
 # 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
index a33c5c05dfdc1c090bf7e3efdb00e1a94c653ab8..545c90a9a2a16bfdf8fa49a8ccd146f3b20118af 100644 (file)
@@ -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
index dc4f6513d61e38bfc935c2b530420a9bf6d8bcf4..1cd1ff5dce1b3050383b1a895e7169d7d64ffde8 100644 (file)
 
 # 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
index e5a6375e2eb509c35d8f27675c8cbff2da73e772..acea7d53572d3b31f5c18d781acd85f6119d94fb 100644 (file)
@@ -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
index edc0f3ddd65a85eaece8201541119c6c4a3ed8cd..c3ef572d5c401e2bc1e91a0752de8b9cd177e37d 100644 (file)
@@ -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:
index 7b31f77a0c9511e6e374b2cff535cd7f03191c20..2c615a52860c3a29aeb0753eae124909ec71139e 100644 (file)
@@ -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();