[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38279] trunk/blender/release/scripts: cleanup for python scripts - unused vars and imports

Campbell Barton ideasman42 at gmail.com
Sun Jul 10 14:51:37 CEST 2011


Revision: 38279
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38279
Author:   campbellbarton
Date:     2011-07-10 12:51:37 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
cleanup for python scripts - unused vars and imports

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/addon_utils.py
    trunk/blender/release/scripts/modules/bpy_extras/view3d_utils.py
    trunk/blender/release/scripts/modules/bpy_types.py
    trunk/blender/release/scripts/modules/bpyml_ui.py
    trunk/blender/release/scripts/modules/rna_prop_ui.py
    trunk/blender/release/scripts/startup/bl_operators/image.py
    trunk/blender/release/scripts/startup/bl_operators/mesh.py
    trunk/blender/release/scripts/startup/bl_operators/object_align.py
    trunk/blender/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
    trunk/blender/release/scripts/startup/bl_operators/uvcalc_follow_active.py
    trunk/blender/release/scripts/startup/bl_operators/uvcalc_lightmap.py

Modified: trunk/blender/release/scripts/modules/addon_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/addon_utils.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/modules/addon_utils.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -48,8 +48,6 @@
 
 def modules(module_cache):
     import os
-    import sys
-    import time
 
     path_list = paths()
 
@@ -173,11 +171,9 @@
     :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 @@
     :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.

Modified: trunk/blender/release/scripts/modules/bpy_extras/view3d_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_extras/view3d_utils.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/modules/bpy_extras/view3d_utils.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -22,7 +22,6 @@
     "region_2d_to_vector_3d",
     "region_2d_to_location_3d",
     "location_3d_to_region_2d",
-    "location_3d_to_region_2d",
 )
 
 

Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/modules/bpy_types.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -241,7 +241,7 @@
                 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
 

Modified: trunk/blender/release/scripts/modules/bpyml_ui.py
===================================================================
--- trunk/blender/release/scripts/modules/bpyml_ui.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/modules/bpyml_ui.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -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
 

Modified: trunk/blender/release/scripts/modules/rna_prop_ui.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_prop_ui.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/modules/rna_prop_ui.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -114,7 +114,7 @@
         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)

Modified: trunk/blender/release/scripts/startup/bl_operators/image.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/image.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/startup/bl_operators/image.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -121,7 +121,6 @@
 
     def execute(self, context):
         import os
-        import subprocess
 
         EXT = "png"  # could be made an option but for now ok
 

Modified: trunk/blender/release/scripts/startup/bl_operators/mesh.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/mesh.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/startup/bl_operators/mesh.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -87,8 +87,6 @@
     def execute(self, context):
         DIR = (self.direction == 'NEGATIVE')
 
-        from mathutils import Vector
-
         ob = context.active_object
         is_editmode = (ob.mode == 'EDIT')
         if is_editmode:

Modified: trunk/blender/release/scripts/startup/bl_operators/object_align.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/object_align.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/startup/bl_operators/object_align.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -98,8 +98,6 @@
     # 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]

Modified: trunk/blender/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/screen_play_rendered_anim.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/startup/bl_operators/screen_play_rendered_anim.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -78,7 +78,7 @@
 
         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

Modified: trunk/blender/release/scripts/startup/bl_operators/uvcalc_follow_active.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/uvcalc_follow_active.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/startup/bl_operators/uvcalc_follow_active.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -42,7 +42,6 @@
     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):
         '''

Modified: trunk/blender/release/scripts/startup/bl_operators/uvcalc_lightmap.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/uvcalc_lightmap.py	2011-07-10 09:10:29 UTC (rev 38278)
+++ trunk/blender/release/scripts/startup/bl_operators/uvcalc_lightmap.py	2011-07-10 12:51:37 UTC (rev 38279)
@@ -444,7 +444,7 @@
         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 @@
 
         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 @@
 
     return {'FINISHED'}
 
-from bpy.props import BoolProperty, FloatProperty, IntProperty, EnumProperty
+from bpy.props import BoolProperty, FloatProperty, IntProperty
 
 
 class LightMapPack(bpy.types.Operator):




More information about the Bf-blender-cvs mailing list