pep8 cleanup
authorCampbell Barton <ideasman42@gmail.com>
Sun, 4 Apr 2010 14:52:15 +0000 (14:52 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 4 Apr 2010 14:52:15 +0000 (14:52 +0000)
16 files changed:
release/scripts/io/import_shape_mdd.py
release/scripts/modules/rigify/__init__.py
release/scripts/modules/rigify/stretch.py
release/scripts/op/image.py
release/scripts/op/nla.py
release/scripts/op/screen_play_rendered_anim.py
release/scripts/ui/properties_data_modifier.py
release/scripts/ui/properties_object.py
release/scripts/ui/properties_physics_cloth.py
release/scripts/ui/properties_physics_fluid.py
release/scripts/ui/properties_scene.py
release/scripts/ui/space_image.py
release/scripts/ui/space_sequencer.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_view3d.py
release/scripts/ui/space_view3d_toolbar.py

index 37c99f899b1f071a789690f9631ae64c6fe8e762..884fa92ddd01b8995685b8e5f790a119fa855d02 100644 (file)
@@ -45,11 +45,11 @@ def mdd_import(filepath, ob, scene, PREF_START_FRAME=0, PREF_JUMP=1):
     frames, points = unpack(">2i", file.read(8))
     time = unpack((">%df" % frames), file.read(frames * 4))
 
-    print('\tpoints:%d frames:%d' % (points,frames))
+    print('\tpoints:%d frames:%d' % (points, frames))
 
     # If target object doesn't have Basis shape key, create it.
     try:
-        num_keys = len( ob.data.shape_keys.keys )
+        num_keys = len(ob.data.shape_keys.keys)
     except:
         basis = ob.add_shape_key()
         basis.name = "Basis"
@@ -68,13 +68,11 @@ def mdd_import(filepath, ob, scene, PREF_START_FRAME=0, PREF_JUMP=1):
         index = len(ob.data.shape_keys.keys)-1
         ob.shape_key_lock = True
 
-        verts = ob.data.shape_keys.keys[ len(ob.data.shape_keys.keys)-1 ].data
+        verts = ob.data.shape_keys.keys[len(ob.data.shape_keys.keys)-1].data
 
 
-        for v in verts:
-            # 12 is the size of 3 floats
-            x,y,z= unpack('>3f', file.read(12))
-            v.co[:] = x,z,y
+        for v in verts: # 12 is the size of 3 floats
+            v.co[:] = unpack('>3f', file.read(12))
         #me.update()
         ob.shape_key_lock = False
 
@@ -122,7 +120,6 @@ class importMDD(bpy.types.Operator):
     #fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25)
     frame_start = IntProperty(name="Start Frame", description="Start frame for inserting animation", min=minframe, max=maxframe, default=0)
 
-
     def poll(self, context):
         ob = context.active_object
         return (ob and ob.type == 'MESH')
@@ -131,7 +128,7 @@ class importMDD(bpy.types.Operator):
         if not self.properties.path:
             raise Exception("filename not set")
 
-        mdd_import( self.properties.path, bpy.context.active_object, context.scene, self.properties.frame_start, 1)
+        mdd_import(self.properties.path, bpy.context.active_object, context.scene, self.properties.frame_start, 1)
 
         return {'FINISHED'}
 
@@ -149,6 +146,7 @@ def register():
     bpy.types.register(importMDD)
     bpy.types.INFO_MT_file_import.append(menu_func)
 
+
 def unregister():
     bpy.types.unregister(importMDD)
     bpy.types.INFO_MT_file_import.remove(menu_func)
index ec9afd78dce07dde402e9481e0751ca5a8d843ac..ee6cc934c1b2aa4863196ec4c3d68a9724b48d39 100644 (file)
@@ -234,12 +234,12 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
         bone_gen = obj.pose.bones[bone.name]
 
         # Rotation mode and transform locks
-        bone_gen.rotation_mode     = bone.rotation_mode
-        bone_gen.lock_rotation     = tuple(bone.lock_rotation)
-        bone_gen.lock_rotation_w   = bone.lock_rotation_w
+        bone_gen.rotation_mode = bone.rotation_mode
+        bone_gen.lock_rotation = tuple(bone.lock_rotation)
+        bone_gen.lock_rotation_w = bone.lock_rotation_w
         bone_gen.lock_rotations_4d = bone.lock_rotations_4d
-        bone_gen.lock_location     = tuple(bone.lock_location)
-        bone_gen.lock_scale        = tuple(bone.lock_scale)
+        bone_gen.lock_location = tuple(bone.lock_location)
+        bone_gen.lock_scale = tuple(bone.lock_scale)
 
         # Custom properties
         for prop in bone.keys():
index 3727c484d6aec866a1028b3c0b33c378a7e2d773..1c3d317b4b17b814bae39bc1fe75be019390de13 100644 (file)
@@ -41,12 +41,12 @@ RIG_TYPE = "stretch"
 #    pbone = obj.pose.bones['Bone']
 #    pbone['type'] = 'copy'
 
-bool_map = {0:False, 1:True,
-            0.0:False, 1.0:True,
-            "false":False, "true":True,
-            "False":False, "True":True,
-            "no":False, "yes":True,
-            "No":False, "Yes":True}
+bool_map = {0: False, 1: True,
+            0.0: False, 1.0: True,
+            "false": False, "true": True,
+            "False": False, "True": True,
+            "no": False, "yes": True,
+            "No": False, "Yes": True}
 
 
 def metarig_definition(obj, orig_bone_name):
index 182ee26288403222758b578dbfb9f0fecce7e65f..f362f55d37ef69ea7acc34fa0399bab7b0454979 100644 (file)
@@ -21,6 +21,7 @@
 import bpy
 from bpy.props import StringProperty
 
+
 class EditExternally(bpy.types.Operator):
     '''Edit image in an external application'''
     bl_idname = "image.external_edit"
@@ -74,7 +75,7 @@ class EditExternally(bpy.types.Operator):
 
         self.properties.path = path
         self.execute(context)
-        
+
         return {'FINISHED'}
 
 
@@ -187,6 +188,7 @@ classes = [
     ProjectEdit,
     ProjectApply]
 
+
 def register():
     register = bpy.types.register
     for cls in classes:
index da57bab3748609c7c1a8494a32235dab6ffedb8c..db8c0be053a053215193d77907bad9755a8d2590 100644 (file)
@@ -20,6 +20,7 @@
 
 import bpy
 
+
 def pose_info():
     from Mathutils import Matrix
 
@@ -42,14 +43,14 @@ def pose_info():
             binfo["matrix_local_inv"] = binfo["matrix_local"].copy().invert()
         except:
             binfo["matrix_local_inv"] = Matrix()
-        
+
         binfo["matrix"] = bone.matrix.copy()
         binfo["matrix_pose"] = pbone.matrix.copy()
         try:
             binfo["matrix_pose_inv"] = binfo["matrix_pose"].copy().invert()
         except:
             binfo["matrix_pose_inv"] = Matrix()
-        
+
         print(binfo["matrix_pose"])
         info[name] = binfo
 
@@ -58,13 +59,13 @@ def pose_info():
         binfo_parent = binfo.get("parent", None)
         if binfo_parent:
             binfo_parent = info[binfo_parent]
-        
+
         matrix = binfo["matrix_pose"]
         rest_matrix = binfo["matrix_local"]
 
         if binfo_parent:
-            matrix= binfo_parent["matrix_pose_inv"] * matrix
-            rest_matrix= binfo_parent["matrix_local_inv"] * rest_matrix
+            matrix = binfo_parent["matrix_pose_inv"] * matrix
+            rest_matrix = binfo_parent["matrix_local_inv"] * rest_matrix
 
         matrix = rest_matrix.copy().invert() * matrix
 
@@ -81,13 +82,13 @@ def bake(frame_start, frame_end, step=1, only_selected=False):
     pose = obj.pose
 
     info_ls = []
-    
+
     frame_range = range(frame_start, frame_end + 1, step)
 
     # could spped this up by applying steps here too...
     for f in frame_range:
         scene.set_frame(f)
-        
+
         info = pose_info()
         info_ls.append(info)
         f += 1
@@ -103,16 +104,16 @@ def bake(frame_start, frame_end, step=1, only_selected=False):
             continue
 
         for f in frame_range:
-            matrix = info_ls[int((f-frame_start) / step)][name]["matrix_key"]
+            matrix = info_ls[int((f - frame_start) / step)][name]["matrix_key"]
 
             #pbone.location = matrix.translation_part()
             #pbone.rotation_quaternion = matrix.to_quat()
             pbone.matrix_local = [f for v in matrix for f in v]
             
             pbone.keyframe_insert("location", -1, f)
-            
+
             rotation_mode = pbone.rotation_mode
-            
+
             if rotation_mode == 'QUATERNION':
                 pbone.keyframe_insert("rotation_quaternion", -1, f)
             elif rotation_mode == 'AXIS_ANGLE':
@@ -165,7 +166,7 @@ class BakeAction(bpy.types.Operator):
         props = self.properties
 
         action = bake(props.frame_start, props.frame_end, props.step, props.only_selected)
-        
+
         # basic cleanup, could move elsewhere
         for fcu in action.fcurves:
             keyframe_points = fcu.keyframe_points
@@ -201,4 +202,4 @@ def unregister():
     # bpy.types.INFO_MT_mesh_add.remove(menu_func)
 
 if __name__ == "__main__":
-    register()
\ No newline at end of file
+    register()
index b7f75e5b439c01c94744aecebde8fddad4ca60b3..2ecd445df1d02eb3a1603ee39a5836779bf4f507 100644 (file)
@@ -89,11 +89,11 @@ class PlayRenderedAnim(bpy.types.Operator):
         if is_movie == False and preset in ('FRAMECYCLER', 'RV', 'MPLAYER'):
             # replace the number with '#'
             file_a = rd.frame_path(frame=0)
-            
+
             # TODO, make an api call for this
             frame_tmp = 9
             file_b = rd.frame_path(frame=frame_tmp)
-            
+
             while len(file_a) == len(file_b):
                 frame_tmp = (frame_tmp * 10) + 9
                 print(frame_tmp)
index 6e6a7e9e3c0f5110dd12be896899a4a8dda9740d..5ae971bce6fbcc2a5c6422ed9e2f843105e5db37 100644 (file)
@@ -497,14 +497,14 @@ class DATA_PT_modifiers(DataButtonsPanel):
 
     def SCREW(self, layout, ob, md, wide_ui):
         split = layout.split()
-        
+
         col = split.column()
         col.prop(md, "axis")
         col.prop(md, "object", text="AxisOb")
         col.prop(md, "angle")
         col.prop(md, "steps")
         col.prop(md, "render_steps")
-        
+
         if wide_ui:
             col = split.column()
         row = col.row()
@@ -516,7 +516,6 @@ class DATA_PT_modifiers(DataButtonsPanel):
         col.prop(md, "use_normal_calculate")
         col.prop(md, "use_normal_flip")
         col.prop(md, "iterations")
-        
 
     def SHRINKWRAP(self, layout, ob, md, wide_ui):
         split = layout.split()
index 36aa5c9c29e8b67496f2d7c9ba7f1c83925d106d..7169d9369043bf189bf32991ebbdee09d63a8f81 100644 (file)
@@ -272,6 +272,8 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
                 layout.prop(ob, "dupli_group", text="")
 
 # XXX: the following options are all quite buggy, ancient hacks that should be dropped
+
+
 class OBJECT_PT_animation(ObjectButtonsPanel):
     bl_label = "Animation Hacks"
     bl_default_closed = True
@@ -297,7 +299,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
         row.prop(ob, "slow_parent")
         row.active = (ob.parent is not None)
         col.prop(ob, "time_offset", text="Offset")
-               
+
         # XXX: these are still used for a few curve-related tracking features
         if wide_ui:
             col = split.column()
index 7ea9e60ebbb628f8efea30b5d5efee3dc65b4a18..8761e8a38c0c42d8027c6967204ae9aa2f94c3fd 100644 (file)
@@ -135,6 +135,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
                 col.label(text="Rest Shape Key:")
                 col.prop_object(cloth, "rest_shape_key", key, "keys", text="")
 
+
 class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
     bl_label = "Cloth Cache"
     bl_default_closed = True
@@ -186,6 +187,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
 
         layout.prop(cloth, "group")
 
+
 class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
     bl_label = "Cloth Stiffness Scaling"
     bl_default_closed = True
index c6fd7e930d96206ffce6a62426b3dfe9992d4f0d..c033b6b68709141e85859cdf9f7ffb31194dc49c 100644 (file)
@@ -53,7 +53,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
             row = split.row(align=True)
             row.prop(md, "render", text="")
             row.prop(md, "realtime", text="")
-            
+
             fluid = md.settings
 
         else:
@@ -75,11 +75,11 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
                 layout.prop(fluid, "type", text="")
                 if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
                     layout.prop(fluid, "active", text="")
-            
+
             layout = layout.column()
             if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
                 layout.active = fluid.active
-            
+
             if fluid.type == 'DOMAIN':
                 layout.operator("fluid.bake", text="Bake Fluid Simulation", icon='MOD_FLUIDSIM')
                 split = layout.split()
@@ -243,7 +243,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
         else:
             col.label(text="Gravity:")
             col.prop(fluid, "gravity", text="")
-        
+
         if scene.unit_settings.system != 'NONE':
             col.label(text="Using Scene Size Units", icon="SCENE_DATA")
             sub = col.column()
index ff1de25673ed85c7cd398eae9137e9666ba99286..4b48ec926a6a102a30594ed2f61b4acca22d37b7 100644 (file)
@@ -89,7 +89,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
         row = layout.row()
 
         col = row.column()
-               # XXX: this fails because index is not what this expects...
+        # XXX: this fails because index is not what this expects...
         col.template_list(scene, "keying_sets", scene, "active_keying_set_index", rows=2)
 
         col = row.column(align=True)
@@ -120,7 +120,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
     bl_label = "Active Keying Set"
 
     def poll(self, context):
-        return (context.scene.active_keying_set and context.scene.active_keying_set.absolute);
+        return (context.scene.active_keying_set and context.scene.active_keying_set.absolute)
 
     def draw(self, context):
         layout = self.layout
@@ -163,7 +163,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
             col.prop(ksp, "grouping")
             if ksp.grouping == 'NAMED':
                 col.prop(ksp, "group")
-                
+
             col.label(text="Keyframing Settings:")
             col.prop(ksp, "insertkey_needed", text="Needed")
             col.prop(ksp, "insertkey_visual", text="Visual")
index 626188a1b97fc8d144720a3bd4416ba2c9914efb..1c48b99939d4dab1738ce4272d2a8a23da5a5942 100644 (file)
@@ -408,6 +408,7 @@ class IMAGE_PT_view_histogram(bpy.types.Panel):
 
         layout.template_histogram(sima, "histogram")
 
+
 class IMAGE_PT_sample_line(bpy.types.Panel):
     bl_space_type = 'IMAGE_EDITOR'
     bl_region_type = 'PREVIEW'
@@ -423,6 +424,7 @@ class IMAGE_PT_sample_line(bpy.types.Panel):
         sima = context.space_data
         layout.template_histogram(sima, "sample_histogram")
 
+
 class IMAGE_PT_view_properties(bpy.types.Panel):
     bl_space_type = 'IMAGE_EDITOR'
     bl_region_type = 'UI'
index aada58806ada6c5e7c949979e57bb0ef2a0c4292..4516499b47cee7dd95d36dd224c31ee66da565a4 100644 (file)
@@ -377,7 +377,7 @@ class SEQUENCER_PT_preview(bpy.types.Panel):
         col = layout.column()
         col.active = render.use_sequencer_gl_preview
         col.prop(render, "sequencer_gl_preview", text="")
-        
+
         col = layout.column()
         col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
         col = layout.column()
index 66c5860642a7f7deecd5d562c5b00a54c274625d..83693ed2dffdc1a23b4c18ce9104e85e15f17222 100644 (file)
@@ -164,9 +164,9 @@ class USERPREF_HT_header(bpy.types.Header):
 
         layout.operator_context = 'EXEC_AREA'
         layout.operator("wm.save_homefile", text="Save As Default")
-        
+
         layout.operator_context = 'INVOKE_DEFAULT'
-        
+
         if userpref.active_section == 'INPUT':
             op = layout.operator("wm.keyconfig_export")
             op.path = "keymap.py"
@@ -175,7 +175,7 @@ class USERPREF_HT_header(bpy.types.Header):
         elif userpref.active_section == 'ADDONS':
             op = layout.operator("wm.addon_install")
             op.path = "*.py"
-        elif userpref.active_section == 'THEMES':           
+        elif userpref.active_section == 'THEMES':
             op = layout.operator("ui.reset_default_theme")
 
 
index 5a738ade68451ab603dd3eec626b74636caf18a0..fa0c5029416714c0e68d8b5937b3b710f589d60e 100644 (file)
@@ -1922,12 +1922,12 @@ class VIEW3D_PT_3dview_display(bpy.types.Panel):
         col.active = display_all
         split = col.split(percentage=0.55)
         split.prop(view, "display_floor", text="Grid Floor")
-        
+
         row = split.row(align=True)
         row.prop(view, "display_x_axis", text="X", toggle=True)
         row.prop(view, "display_y_axis", text="Y", toggle=True)
         row.prop(view, "display_z_axis", text="Z", toggle=True)
-        
+
         sub = col.column(align=True)
         sub.active = (display_all and view.display_floor)
         sub.prop(view, "grid_lines", text="Lines")
index 603ed93efeda4fabe47860d5975a09683e9e41bc..099e7944784635ce90f01c667ed1b5e385256e32 100644 (file)
@@ -606,7 +606,7 @@ class VIEW3D_PT_tools_brush(PaintPanel):
             col = layout.column()
             col.active = (brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'))
             col.prop(brush, "use_alpha")
-            
+
 
         # Weight Paint Mode #