cleanup for python scripts - unused vars and imports
authorCampbell Barton <ideasman42@gmail.com>
Sun, 10 Jul 2011 12:51:37 +0000 (12:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 10 Jul 2011 12:51:37 +0000 (12:51 +0000)
release/scripts/modules/addon_utils.py
release/scripts/modules/bpy_extras/view3d_utils.py
release/scripts/modules/bpy_types.py
release/scripts/modules/bpyml_ui.py
release/scripts/modules/rna_prop_ui.py
release/scripts/startup/bl_operators/image.py
release/scripts/startup/bl_operators/mesh.py
release/scripts/startup/bl_operators/object_align.py
release/scripts/startup/bl_operators/screen_play_rendered_anim.py
release/scripts/startup/bl_operators/uvcalc_follow_active.py
release/scripts/startup/bl_operators/uvcalc_lightmap.py

index 3877f711b7fbc60b395cfbc6536fc7bf4f4a633f..07f1dc618dcc4223e03f3dbf8892ca62af7cc651 100644 (file)
@@ -48,8 +48,6 @@ def paths():
 
 def modules(module_cache):
     import os
-    import sys
-    import time
 
     path_list = paths()
 
@@ -173,11 +171,9 @@ def enable(module_name, default_set=True):
     :return: the loaded module or None on failier.
     :rtype: module
     """
-    # note, this still gets added to _bpy_types.TypeMap
 
     import os
     import sys
-    import bpy_types as _bpy_types
     import imp
 
     def handle_error():
@@ -246,8 +242,6 @@ def disable(module_name, default_set=True):
     :type module_name: string
     """
     import sys
-    import bpy_types as _bpy_types
-
     mod = sys.modules.get(module_name)
 
     # possible this addon is from a previous session and didnt load a module this time.
index 01ac543aec7ae416a49248b728e55607611e55c0..c0c0f9186bd22117dd5623ec54d1de2df517520b 100644 (file)
@@ -22,7 +22,6 @@ __all__ = (
     "region_2d_to_vector_3d",
     "region_2d_to_location_3d",
     "location_3d_to_region_2d",
-    "location_3d_to_region_2d",
 )
 
 
index eaa7563c75786a8e8c9d701a57fb914bd3cd0de9..f2cd46b20ae7075ede531f6fe9501ff9031a61d8 100644 (file)
@@ -241,7 +241,7 @@ class _GenericBone:
                 chain.append(child)
             else:
                 if len(children_basename):
-                    print("multiple basenames found, this is probably not what you want!", bone.name, children_basename)
+                    print("multiple basenames found, this is probably not what you want!", self.name, children_basename)
 
                 break
 
index 1e0522974d19659318ff872ad834169905bc19d5..5df04b8bf34784c410cb0ce197bc0b69a2996ffe 100644 (file)
@@ -22,7 +22,6 @@
 import bpy as _bpy
 import bpyml
 from bpyml import TAG, ARGS, CHILDREN
-from types import ModuleType
 
 _uilayout_rna = _bpy.types.UILayout.bl_rna
 
index b0fb3b66d0aad9d015304a2d04d895daa2e15f95..388ae2b0e131f7e5a4c37984f5f17de02a2fa25c 100644 (file)
@@ -114,7 +114,7 @@ def draw(layout, context, context_member, property_type, use_edit=True):
         to_dict = getattr(val, "to_dict", None)
         to_list = getattr(val, "to_list", None)
 
-        val_orig = val
+        # val_orig = val  # UNUSED
         if to_dict:
             val = to_dict()
             val_draw = str(val)
index 1e5217217dd1d5244fe71934526e95c8ef5daf55..34c5b0d922a981b2e81dc5454aed469ca92c559d 100644 (file)
@@ -121,7 +121,6 @@ class ProjectEdit(bpy.types.Operator):
 
     def execute(self, context):
         import os
-        import subprocess
 
         EXT = "png"  # could be made an option but for now ok
 
index 8dca30e54df8fbc8331ef067e36f3c0a3309c779..03b0e4693106b9b206c60f960c7244397eb574c3 100644 (file)
@@ -87,8 +87,6 @@ class MeshMirrorUV(bpy.types.Operator):
     def execute(self, context):
         DIR = (self.direction == 'NEGATIVE')
 
-        from mathutils import Vector
-
         ob = context.active_object
         is_editmode = (ob.mode == 'EDIT')
         if is_editmode:
index 644f30a4745b3aa91ec5fef5ae665f2ac1132772..3202a717001cc4acc867b2348fa0c7ce965d078d 100644 (file)
@@ -98,8 +98,6 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
     # Main Loop
 
     for obj, bb_world in objs:
-
-        loc_world = obj.location
         bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box]
 
         Left_Up_Front = bb_world[1]
index 64af25e7b0f469c820203c8528fc5a79d494c2b0..910ccf96c0e41e96cd3487d7bd8c687e52b07495 100644 (file)
@@ -78,7 +78,7 @@ class PlayRenderedAnim(bpy.types.Operator):
 
         preset = prefs.filepaths.animation_player_preset
         player_path = prefs.filepaths.animation_player
-        file_path = bpy.path.abspath(rd.filepath)
+        # file_path = bpy.path.abspath(rd.filepath)  # UNUSED
         is_movie = rd.is_movie_format
 
         # try and guess a command line if it doesn't exist
index edd09d9c66b2cee8d5acd16e55019ca1ff9ee1b9..43ca9af59baccd8f945fc9ff6fb90a71e475b428 100644 (file)
@@ -42,7 +42,6 @@ def extend(obj, operator, EXTEND_MODE):
     edge_average_lengths = {}
 
     OTHER_INDEX = 2, 3, 0, 1
-    FAST_INDICIES = 0, 2, 1, 3  # order is faster
 
     def extend_uvs(face_source, face_target, edge_key):
         '''
index 40eaf91b0426a8f7194b724ceb0b596a921f5d93..9ae0cd0ddf961a048659685482f27954cafd7b87 100644 (file)
@@ -444,7 +444,7 @@ def lightmap_uvpack(meshes,
         del even_dict
         del odd_dict
 
-        orig = len(pretty_faces)
+        orig = len(pretty_faces)
 
         pretty_faces = [pf for pf in pretty_faces if not pf.has_parent]
 
@@ -489,7 +489,10 @@ def lightmap_uvpack(meshes,
 
         if PREF_APPLY_IMAGE:
             if not PREF_PACK_IN_ONE:
-                image = Image.New("lightmap", PREF_IMG_PX_SIZE, PREF_IMG_PX_SIZE, 24)
+                image = bpy.data.images.new(name="lightmap",
+                                            width=PREF_IMG_PX_SIZE,
+                                            height=PREF_IMG_PX_SIZE,
+                                            )
 
             for f in face_sel:
                 # f.image = image
@@ -530,7 +533,7 @@ def unwrap(operator, context, **kwargs):
 
     return {'FINISHED'}
 
-from bpy.props import BoolProperty, FloatProperty, IntProperty, EnumProperty
+from bpy.props import BoolProperty, FloatProperty, IntProperty
 
 
 class LightMapPack(bpy.types.Operator):