diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-23 00:41:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-23 00:41:21 +0300 |
commit | 1efbaf92ae58278c0b5675b35f3a0970265cb895 (patch) | |
tree | 3112322307935c6be5f2020810e1b68cbcabefc0 | |
parent | d6026d486e5b8349f513774e7e9ebadbfe029091 (diff) |
use imp.reload() rather then reload().
-rw-r--r-- | add_mesh_BoltFactory/__init__.py | 13 | ||||
-rw-r--r-- | add_mesh_extras.py | 2 | ||||
-rw-r--r-- | io_coat3D/__init__.py | 15 | ||||
-rw-r--r-- | io_convert_image_to_mesh_img/__init__.py | 32 | ||||
-rw-r--r-- | io_mesh_raw/__init__.py | 21 | ||||
-rw-r--r-- | io_mesh_stl/__init__.py | 20 | ||||
-rw-r--r-- | object_fracture/__init__.py | 18 | ||||
-rw-r--r-- | render_povray/__init__.py | 5 | ||||
-rw-r--r-- | rigify/__init__.py | 11 | ||||
-rw-r--r-- | rigify/rigs/biped/arm/__init__.py | 8 | ||||
-rw-r--r-- | rigify/rigs/biped/leg/__init__.py | 8 | ||||
-rw-r--r-- | rigify/ui.py | 4 | ||||
-rw-r--r-- | rigify/utils.py | 4 | ||||
-rw-r--r-- | space_view3d_math_vis/__init__.py | 7 |
14 files changed, 78 insertions, 90 deletions
diff --git a/add_mesh_BoltFactory/__init__.py b/add_mesh_BoltFactory/__init__.py index c69ae5f3..784faa0c 100644 --- a/add_mesh_BoltFactory/__init__.py +++ b/add_mesh_BoltFactory/__init__.py @@ -29,16 +29,13 @@ bl_addon_info = { "func=detail&aid=22842&group_id=153&atid=468", "category": "Add Mesh"} -import bpy - -try: - init_data - - reload(Boltfactory) -except: +if "bpy" in locals(): + import imp + imp.reload(Boltfactory) +else: from add_mesh_BoltFactory import Boltfactory -init_data = True +import bpy ################################################################################ ##### REGISTER ##### diff --git a/add_mesh_extras.py b/add_mesh_extras.py index 02e87070..6892b9cf 100644 --- a/add_mesh_extras.py +++ b/add_mesh_extras.py @@ -635,7 +635,7 @@ class INFO_MT_mesh_extras_add(bpy.types.Menu): layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("mesh.primitive_sqorus_add", text="Sqorus") - layout.operator("mesh.primitive_wedge_add", + layout.operator("mesh.primitive_wedge_add") layout.operator("mesh.primitive_star_add", text="Star") layout.operator("mesh.primitive_trapezohedron_add", diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py index 53694a1e..92efcc67 100644 --- a/io_coat3D/__init__.py +++ b/io_coat3D/__init__.py @@ -32,16 +32,17 @@ bl_addon_info = { "category": "Import/Export"} +if "bpy" in locals(): + import imp + imp.reload(coat) + imp.reload(tex) +else: + from . import coat + from . import tex -#if "bpy" in locals(): Don't know if this is important -# reload(render) -# reload(ui) - -#else: import bpy from bpy.props import * -from io_coat3D import coat -from io_coat3D import tex + def register(): diff --git a/io_convert_image_to_mesh_img/__init__.py b/io_convert_image_to_mesh_img/__init__.py index 000cda06..853ca151 100644 --- a/io_convert_image_to_mesh_img/__init__.py +++ b/io_convert_image_to_mesh_img/__init__.py @@ -39,17 +39,18 @@ bl_addon_info = { "func=detail&aid=24897&group_id=153&atid=467", "category": "Import/Export"} + +if "bpy" in locals(): + import imp + imp.reload(import_img) +else: + from . import import_img + + import bpy from bpy.props import * from io_utils import ImportHelper -try: - init_data - reload( io_convert_image_to_mesh_img.import_img ) -except: - import io_convert_image_to_mesh_img.import_img - -init_data = True class ImportHiRISEIMGDTM(bpy.types.Operator, ImportHelper): '''Import a HiRISE DTM formatted as a PDS IMG file''' @@ -59,14 +60,13 @@ class ImportHiRISEIMGDTM(bpy.types.Operator, ImportHelper): filename_ext = ".IMG" filter_glob = StringProperty(default="*.IMG", options={'HIDDEN'}) - scale = FloatProperty( - name="Scale", - description="Scale the IMG by this value", - min=0.0001, - max=10.0, - soft_min=0.001, - soft_max=100.0, - default=0.01) + scale = FloatProperty(name="Scale", + description="Scale the IMG by this value", + min=0.0001, + max=10.0, + soft_min=0.001, + soft_max=100.0, + default=0.01) bin_mode = EnumProperty(items=( ('NONE', "None", "Don't bin the image"), @@ -79,7 +79,7 @@ class ImportHiRISEIMGDTM(bpy.types.Operator, ImportHelper): name="Binning", description="Import Binning.", default='BIN12-FAST' - ) + ) #red_material = BoolProperty(name="Mars Red Mesh", # description="Set the mesh as a 'Mars' red value", diff --git a/io_mesh_raw/__init__.py b/io_mesh_raw/__init__.py index d52a5808..4cb44a86 100644 --- a/io_mesh_raw/__init__.py +++ b/io_mesh_raw/__init__.py @@ -31,27 +31,22 @@ bl_addon_info = { "func=detail&aid=21733&group_id=153&atid=469", "category": "Import/Export"} -import bpy - +if "bpy" in locals(): + import imp + imp.reload(import_raw) + imp.reload(export_raw) +else: + from . import import_raw + from . import export_raw -try: - init_data - reload(import_raw) - reload(export_raw) -except: - from io_mesh_raw import import_raw - from io_mesh_raw import export_raw - -init_data = True +import bpy def menu_import(self, context): - from io_mesh_raw import import_raw self.layout.operator(import_raw.RawImporter.bl_idname, text="Raw Faces (.raw)").filepath = "*.raw" def menu_export(self, context): - from io_mesh_raw import export_raw import os default_path = os.path.splitext(bpy.data.filepath)[0] + ".raw" self.layout.operator(export_raw.RawExporter.bl_idname, text="Raw Faces (.raw)").filepath = default_path diff --git a/io_mesh_stl/__init__.py b/io_mesh_stl/__init__.py index a96f1a75..22b5dbd3 100644 --- a/io_mesh_stl/__init__.py +++ b/io_mesh_stl/__init__.py @@ -46,6 +46,14 @@ Import: - Does not handle endien """ +if "bpy" in locals(): + import imp + imp.reload(stl_utils) + imp.reload(blender_utils) +else: + from . import stl_utils + from . import blender_utils + import itertools import os @@ -54,18 +62,6 @@ from bpy.props import * from io_utils import ExportHelper, ImportHelper -try: - init_data - - reload(stl_utils) - reload(blender_utils) -except: - from io_mesh_stl import stl_utils - from io_mesh_stl import blender_utils - -init_data = True - - class StlImporter(bpy.types.Operator, ImportHelper): ''' Load STL triangle mesh data diff --git a/object_fracture/__init__.py b/object_fracture/__init__.py index 72ca3d2e..77269c7f 100644 --- a/object_fracture/__init__.py +++ b/object_fracture/__init__.py @@ -32,18 +32,16 @@ bl_addon_info = { "category": "Object"} -import bpy +if "bpy" in locals(): + import imp + imp.reload(fracture_ops) + imp.reload(fracture_setup) +else: + from . import fracture_ops + from . import fracture_setup -try: - init_data - - reload(fracture_ops) - reload(fracture_setup) -except: - from object_fracture import fracture_ops - from object_fracture import fracture_setup +import bpy -init_data = True class INFO_MT_add_fracture_objects(bpy.types.Menu): bl_idname = "INFO_MT_add_fracture_objects" diff --git a/render_povray/__init__.py b/render_povray/__init__.py index 1d042749..9d1e73b8 100644 --- a/render_povray/__init__.py +++ b/render_povray/__init__.py @@ -33,8 +33,9 @@ bl_addon_info = { if "bpy" in locals(): - reload(ui) - reload(render) + import imp + imp.reload(ui) + imp.reload(render) else: import bpy diff --git a/rigify/__init__.py b/rigify/__init__.py index 2db7c808..8565a67d 100644 --- a/rigify/__init__.py +++ b/rigify/__init__.py @@ -28,12 +28,13 @@ bl_addon_info = { "category": "Rigging"} if "bpy" in locals(): - reload(generate) - reload(ui) - reload(utils) - reload(metarig_menu) + import imp + imp.reload(generate) + imp.reload(ui) + imp.reload(utils) + imp.reload(metarig_menu) else: - from rigify import generate, ui, utils, metarig_menu + from . import generate, ui, utils, metarig_menu import bpy import bpy_types diff --git a/rigify/rigs/biped/arm/__init__.py b/rigify/rigs/biped/arm/__init__.py index 4198345b..13d9e430 100644 --- a/rigify/rigs/biped/arm/__init__.py +++ b/rigify/rigs/biped/arm/__init__.py @@ -17,13 +17,13 @@ #======================= END GPL LICENSE BLOCK ======================== import bpy -from imp import reload +import imp from . import fk, ik, deform from rigify.utils import MetarigError, get_layers -reload(fk) -reload(ik) -reload(deform) +imp.reload(fk) +imp.reload(ik) +imp.reload(deform) script = """ fk_arm = ["%s", "%s", "%s"] diff --git a/rigify/rigs/biped/leg/__init__.py b/rigify/rigs/biped/leg/__init__.py index ac8913f5..5cbf3b11 100644 --- a/rigify/rigs/biped/leg/__init__.py +++ b/rigify/rigs/biped/leg/__init__.py @@ -17,13 +17,13 @@ #======================= END GPL LICENSE BLOCK ======================== import bpy -from imp import reload +import imp from . import fk, ik, deform from rigify.utils import MetarigError, get_layers -reload(fk) -reload(ik) -reload(deform) +imp.reload(fk) +imp.reload(ik) +imp.reload(deform) script = """ fk_leg = ["%s", "%s", "%s"] diff --git a/rigify/ui.py b/rigify/ui.py index a7267c62..5af4122b 100644 --- a/rigify/ui.py +++ b/rigify/ui.py @@ -18,7 +18,6 @@ import bpy from bpy.props import * -from imp import reload import rigify from rigify.utils import get_rig_type from rigify import generate @@ -194,7 +193,8 @@ class Generate(bpy.types.Operator): bl_label = "Rigify Generate Rig" def execute(self, context): - reload(generate) + import imp + imp.reload(generate) try: generate.generate_rig(context, context.object) diff --git a/rigify/utils.py b/rigify/utils.py index 33170ec2..84d4c4f1 100644 --- a/rigify/utils.py +++ b/rigify/utils.py @@ -17,7 +17,7 @@ #======================= END GPL LICENSE BLOCK ======================== import bpy -from imp import reload +import imp from random import randint from mathutils import Vector from math import ceil, floor @@ -355,7 +355,7 @@ def get_rig_type(rig_type): """ #print("%s.%s.%s" % (__package__,RIG_DIR,rig_type)) submod = __import__(name="%s.%s.%s" % (MODULE_NAME, RIG_DIR, rig_type), fromlist=[rig_type]) - reload(submod) + imp.reload(submod) return submod diff --git a/space_view3d_math_vis/__init__.py b/space_view3d_math_vis/__init__.py index a73ec1cc..25f753fb 100644 --- a/space_view3d_math_vis/__init__.py +++ b/space_view3d_math_vis/__init__.py @@ -29,13 +29,12 @@ bl_addon_info = { "category": "3D View"} if "bpy" in locals(): - from imp import reload - reload(utils) - reload(draw) + import imp + imp.reload(utils) + imp.reload(draw) else: from . import utils, draw - import bpy |