[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2115] trunk/py/scripts/addons: cleanup

Campbell Barton ideasman42 at gmail.com
Sun Jul 10 19:28:54 CEST 2011


Revision: 2115
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2115
Author:   campbellbarton
Date:     2011-07-10 17:28:53 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
cleanup
- remove unused imports
- remove/comment unused vars
- fix for some bugs with unused vars being used

Modified Paths:
--------------
    trunk/py/scripts/addons/add_curve_aceous_galore.py
    trunk/py/scripts/addons/add_mesh_ant_landscape.py
    trunk/py/scripts/addons/add_mesh_pipe_joint.py
    trunk/py/scripts/addons/add_mesh_solid.py
    trunk/py/scripts/addons/animation_add_corrective_shape_key.py
    trunk/py/scripts/addons/curve_simplify.py
    trunk/py/scripts/addons/development_api_navigator.py
    trunk/py/scripts/addons/io_export_unreal_psk_psa.py
    trunk/py/scripts/addons/io_import_scene_dxf.py
    trunk/py/scripts/addons/io_import_scene_lwo.py
    trunk/py/scripts/addons/io_import_scene_mhx.py
    trunk/py/scripts/addons/io_import_scene_unreal_psk.py
    trunk/py/scripts/addons/modules/geometry_utils.py
    trunk/py/scripts/addons/modules/ui_utils.py
    trunk/py/scripts/addons/object_cloud_gen.py
    trunk/py/scripts/addons/paint_palette.py
    trunk/py/scripts/addons/render_renderfarmfi.py
    trunk/py/scripts/addons/space_view3d_align_tools.py
    trunk/py/scripts/addons/space_view3d_materials_utils.py
    trunk/py/scripts/addons/space_view3d_spacebar_menu.py
    trunk/py/scripts/addons/texture_paint_layer_manager.py

Modified: trunk/py/scripts/addons/add_curve_aceous_galore.py
===================================================================
--- trunk/py/scripts/addons/add_curve_aceous_galore.py	2011-07-10 17:27:57 UTC (rev 2114)
+++ trunk/py/scripts/addons/add_curve_aceous_galore.py	2011-07-10 17:28:53 UTC (rev 2115)
@@ -63,7 +63,7 @@
                 (type=float)
     """
 
-    s = Noise.seed_set(seed)
+    Noise.seed_set(seed)
     rnum = Noise.random()
     rnum = rnum*(high-low)
     rnum = rnum+low
@@ -97,7 +97,6 @@
             the generated turbulence vector.
                 (type=3-float list)
     """
-    sn = 0.001
     rand = randnum(-100,100,Seed)
     if Basis == 9: Basis = 14
     vTurb = Noise.turbulence_vector((x/Size+rand, y/Size+rand, z/Size+rand), Depth, Hard, Basis)

Modified: trunk/py/scripts/addons/add_mesh_ant_landscape.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_ant_landscape.py	2011-07-10 17:27:57 UTC (rev 2114)
+++ trunk/py/scripts/addons/add_mesh_ant_landscape.py	2011-07-10 17:28:53 UTC (rev 2115)
@@ -82,9 +82,6 @@
 #                    new mesh (as used in from_pydata).
 # name ... Name of the new mesh (& object).
 def create_mesh_object(context, verts, edges, faces, name):
-    scene = context.scene
-    obj_act = scene.objects.active
-
     # Create new mesh
     mesh = bpy.data.meshes.new(name)
 

Modified: trunk/py/scripts/addons/add_mesh_pipe_joint.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_pipe_joint.py	2011-07-10 17:27:57 UTC (rev 2114)
+++ trunk/py/scripts/addons/add_mesh_pipe_joint.py	2011-07-10 17:28:53 UTC (rev 2115)
@@ -129,7 +129,6 @@
 """
 
 import bpy
-import mathutils
 from math import *
 from bpy.props import *
 
@@ -826,7 +825,7 @@
 
             verts.append([locX * radius, locY * radius, locZ * radius])
 
-        loopTemp2 = loopJoint2[:]
+        # loopTemp2 = loopJoint2[:]  # UNUSED
 
         # Create 2. deformed joint circle
         loopTempA = []

Modified: trunk/py/scripts/addons/add_mesh_solid.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_solid.py	2011-07-10 17:27:57 UTC (rev 2114)
+++ trunk/py/scripts/addons/add_mesh_solid.py	2011-07-10 17:28:53 UTC (rev 2115)
@@ -35,7 +35,7 @@
 import bpy
 from bpy.props import FloatProperty,EnumProperty,BoolProperty
 from math import sqrt
-from mathutils import Vector,Matrix
+from mathutils import Vector
 from functools import reduce
 from bpy_extras.object_utils import object_data_add
 
@@ -141,9 +141,6 @@
     
 # processes the raw data from source
 def createSolid(plato,vtrunc,etrunc,dual,snub):
-    verts = []
-    faces = []
-    edges = []
     # the duals from each platonic solid
     dualSource = {"4":"4",
                   "6":"8",
@@ -493,8 +490,7 @@
         
         # resize to normal size, or if keepSize, make sure all verts are of length 'size'
         if self.keepSize:
-            if dual: rad = self.size/verts[-1].length
-            else: rad = self.size/verts[0].length
+            rad = self.size/verts[-1 if self.dual else 0].length
         else: rad = self.size
         verts = [i*rad for i in verts]
 

Modified: trunk/py/scripts/addons/animation_add_corrective_shape_key.py
===================================================================
--- trunk/py/scripts/addons/animation_add_corrective_shape_key.py	2011-07-10 17:27:57 UTC (rev 2114)
+++ trunk/py/scripts/addons/animation_add_corrective_shape_key.py	2011-07-10 17:28:53 UTC (rev 2115)
@@ -137,20 +137,16 @@
     reset_transform(target)
     
     # If target object doesn't have Basis shape key, create it.
-    try:
-        num_keys = len( mesh_1.shape_keys.key_blocks )
-    except:
+    if not mesh_1.shape_keys:
         basis = ob_1.shape_key_add()
         basis.name = "Basis"
         ob_1.data.update()
-        
-    
+
     key_index = ob_1.active_shape_key_index
     # Insert new shape key
     if key_index == 0:
         new_shapekey = ob_1.shape_key_add()
         new_shapekey.name = "Shape_" + ob_2.name
-        new_shapekey_name = new_shapekey.name
         
         key_index = len(mesh_1.shape_keys.key_blocks)-1
         ob_1.active_shape_key_index = key_index
@@ -383,9 +379,7 @@
     reset_transform(target)
     
     # If target object doesn't have Basis shape key, create it.
-    try:
-        num_keys = len( target.data.shape_keys.key_blocks )
-    except:
+    if not target.data.shape_keys:
         basis = target.shape_key_add()
         basis.name = "Basis"
         target.data.update()
@@ -397,7 +391,6 @@
         # Insert new shape key
         new_shapekey = target.shape_key_add()
         new_shapekey.name = "Shape_" + source.name
-        new_shapekey_name = new_shapekey.name
         
         key_index = len(target.data.shape_keys.key_blocks)-1
         target.active_shape_key_index = key_index
@@ -486,10 +479,9 @@
     layout.row().operator("object.add_corrective_pose_shape", text='Add as corrective pose-shape (slow, all modifiers)', icon='COPY_ID') # icon is not ideal
 
 def modifiers_draw(self, context):
-    layout = self.layout
+    pass
 
 
-
 def register():
     bpy.utils.register_module(__name__)
 

Modified: trunk/py/scripts/addons/curve_simplify.py
===================================================================
--- trunk/py/scripts/addons/curve_simplify.py	2011-07-10 17:27:57 UTC (rev 2114)
+++ trunk/py/scripts/addons/curve_simplify.py	2011-07-10 17:28:53 UTC (rev 2115)
@@ -194,11 +194,10 @@
 ##########################
 # set bezierhandles to auto
 def setBezierHandles(newCurve):
-        scene = bpy.context.scene
-        bpy.ops.object.mode_set(mode='EDIT', toggle=True)
-        bpy.ops.curve.select_all(action='SELECT')
-        bpy.ops.curve.handle_type_set(type='AUTOMATIC')
-        bpy.ops.object.mode_set(mode='OBJECT', toggle=True)
+    bpy.ops.object.mode_set(mode='EDIT', toggle=True)
+    bpy.ops.curve.select_all(action='SELECT')
+    bpy.ops.curve.handle_type_set(type='AUTOMATIC')
+    bpy.ops.object.mode_set(mode='OBJECT', toggle=True)
 
 # get array of new coords for new spline from vertindices
 def vertsToPoints(newVerts, splineVerts, splineType):
@@ -321,8 +320,6 @@
 def fcurves_simplify(context, obj, options, fcurves):
     # main vars
     mode = options[0]
-    scene = context.scene
-    fcurves_obj = obj.animation_data.action.fcurves
 
     #get indices of selected fcurves
     fcurve_sel = selectedfcurves(obj)

Modified: trunk/py/scripts/addons/development_api_navigator.py
===================================================================
--- trunk/py/scripts/addons/development_api_navigator.py	2011-07-10 17:27:57 UTC (rev 2114)
+++ trunk/py/scripts/addons/development_api_navigator.py	2011-07-10 17:28:53 UTC (rev 2115)
@@ -59,7 +59,7 @@
 
 """
 
-import bpy, sys
+import bpy
 from console.complete_import import get_root_modules
 
 
@@ -113,7 +113,7 @@
     #print('evaluate')
     global root_module, tree_level, root_m_path
     
-    path = bpy.context.window_manager.api_nav_props.path
+    # path = bpy.context.window_manager.api_nav_props.path
     try :
         len_name = root_module.__name__.__len__()
         root_m_path = 'root_module' + module[len_name:]
@@ -483,11 +483,11 @@
                 return {'FINISHED'}
             
             col = self.layout
-            filter = bpy.context.window_manager.api_nav_props.filter
+            # filter = bpy.context.window_manager.api_nav_props.filter  # UNUSED
             reduce_to = bpy.context.window_manager.api_nav_props.reduce_to * self.columns
             pages = bpy.context.window_manager.api_nav_props.pages
             page_index = reduce_to*pages
-            rank = 0
+            # rank = 0  # UNUSED
             count = 0
             i = 0
             filtered = 0
@@ -624,9 +624,7 @@
         global tree_level, current_module, module_type, return_report
     
         api_update(context)
-        
-        st = bpy.context.space_data
-        
+
         ###### layout ######
         layout = self.layout
         col = layout.column()
@@ -664,7 +662,7 @@
     km = kc.keymaps.get("Text")
     if km is None:
          km = kc.keymaps.new(name="Text")
-    kmi = km.keymap_items.new('api_navigator.toggle_doc', 'ESC', 'PRESS')
+    km.keymap_items.new('api_navigator.toggle_doc', 'ESC', 'PRESS')
 
 
 def unregister_keymaps():

Modified: trunk/py/scripts/addons/io_export_unreal_psk_psa.py
===================================================================
--- trunk/py/scripts/addons/io_export_unreal_psk_psa.py	2011-07-10 17:27:57 UTC (rev 2114)
+++ trunk/py/scripts/addons/io_export_unreal_psk_psa.py	2011-07-10 17:28:53 UTC (rev 2115)
@@ -80,16 +80,13 @@
 
 import os
 import time
-import datetime
 import bpy
 import mathutils
 import random
 import operator
-import sys
 
+from struct import pack
 
-from struct import pack, calcsize
-
 # REFERENCE MATERIAL JUST IN CASE:
 # 
 # U = x / sqrt(x^2 + y^2 + z^2)
@@ -500,11 +497,7 @@
         # this will take the format of key=Bone Name, value = (BoneIndex, Bone Object)
         # THIS IS NOT DUMPED
         self.BoneLookup = {} 
-        
-    def dump(self):
-        data = self.Generalheader.dump() + self.Bones.dump() + self.Animations.dump() + self.RawKeys.dump()
-        return data
-    
+
     def AddBone(self, b):
         #LOUD
         #print "AddBone: " + b.Name
@@ -720,7 +713,7 @@
                 vect_list = []
                 
                 #get or create the current material
-                m = psk_file.GetMatByIndex(object_material_index)
+                psk_file.GetMatByIndex(object_material_index)
 
                 face_index = current_face.index
                 has_UV = False
@@ -1261,7 +1254,7 @@
                     anim.AnimRate = anim_rate
                     anim.FirstRawFrame = cur_frame_index
                     #===================================================
-                    count_previous_keys = len(psa_file.RawKeys.Data)
+                    # count_previous_keys = len(psa_file.RawKeys.Data)  # UNUSED
                     print("Frame Key Set Count:",frame_count, "Total Frame:",frame_count)
                     #print("init action bones...")
                     unique_bone_indexes = {}
@@ -1306,7 +1299,7 @@
                             #print("[=====POSE NAME:",pose_bone.name)
                             
                             #print("LENG >>.",len(bones_lookup))

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list