diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-04-04 18:52:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-04-04 18:52:15 +0400 |
commit | bc149e0fbe85819935eceb1ae5d54578e37d5247 (patch) | |
tree | 57378648167ae9f62a6b8b3d78ee12134d6979b0 | |
parent | 97454d7b85e2be0259318e73a8d4ec662eb75985 (diff) |
pep8 cleanup
-rw-r--r-- | release/scripts/io/import_shape_mdd.py | 16 | ||||
-rw-r--r-- | release/scripts/modules/rigify/__init__.py | 10 | ||||
-rw-r--r-- | release/scripts/modules/rigify/stretch.py | 12 | ||||
-rw-r--r-- | release/scripts/op/image.py | 4 | ||||
-rw-r--r-- | release/scripts/op/nla.py | 25 | ||||
-rw-r--r-- | release/scripts/op/screen_play_rendered_anim.py | 4 | ||||
-rw-r--r-- | release/scripts/ui/properties_data_modifier.py | 5 | ||||
-rw-r--r-- | release/scripts/ui/properties_object.py | 4 | ||||
-rw-r--r-- | release/scripts/ui/properties_physics_cloth.py | 2 | ||||
-rw-r--r-- | release/scripts/ui/properties_physics_fluid.py | 8 | ||||
-rw-r--r-- | release/scripts/ui/properties_scene.py | 6 | ||||
-rw-r--r-- | release/scripts/ui/space_image.py | 2 | ||||
-rw-r--r-- | release/scripts/ui/space_sequencer.py | 2 | ||||
-rw-r--r-- | release/scripts/ui/space_userpref.py | 6 | ||||
-rw-r--r-- | release/scripts/ui/space_view3d.py | 4 | ||||
-rw-r--r-- | release/scripts/ui/space_view3d_toolbar.py | 2 |
16 files changed, 59 insertions, 53 deletions
diff --git a/release/scripts/io/import_shape_mdd.py b/release/scripts/io/import_shape_mdd.py index 37c99f899b1..884fa92ddd0 100644 --- a/release/scripts/io/import_shape_mdd.py +++ b/release/scripts/io/import_shape_mdd.py @@ -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) diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py index ec9afd78dce..ee6cc934c1b 100644 --- a/release/scripts/modules/rigify/__init__.py +++ b/release/scripts/modules/rigify/__init__.py @@ -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(): diff --git a/release/scripts/modules/rigify/stretch.py b/release/scripts/modules/rigify/stretch.py index 3727c484d6a..1c3d317b4b1 100644 --- a/release/scripts/modules/rigify/stretch.py +++ b/release/scripts/modules/rigify/stretch.py @@ -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): diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index 182ee262884..f362f55d37e 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -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: diff --git a/release/scripts/op/nla.py b/release/scripts/op/nla.py index da57bab3748..db8c0be053a 100644 --- a/release/scripts/op/nla.py +++ b/release/scripts/op/nla.py @@ -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() diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py index b7f75e5b439..2ecd445df1d 100644 --- a/release/scripts/op/screen_play_rendered_anim.py +++ b/release/scripts/op/screen_play_rendered_anim.py @@ -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) diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py index 6e6a7e9e3c0..5ae971bce6f 100644 --- a/release/scripts/ui/properties_data_modifier.py +++ b/release/scripts/ui/properties_data_modifier.py @@ -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() diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index 36aa5c9c29e..7169d936904 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -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() diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py index 7ea9e60ebbb..8761e8a38c0 100644 --- a/release/scripts/ui/properties_physics_cloth.py +++ b/release/scripts/ui/properties_physics_cloth.py @@ -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 diff --git a/release/scripts/ui/properties_physics_fluid.py b/release/scripts/ui/properties_physics_fluid.py index c6fd7e930d9..c033b6b6870 100644 --- a/release/scripts/ui/properties_physics_fluid.py +++ b/release/scripts/ui/properties_physics_fluid.py @@ -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() diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py index ff1de25673e..4b48ec926a6 100644 --- a/release/scripts/ui/properties_scene.py +++ b/release/scripts/ui/properties_scene.py @@ -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") diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py index 626188a1b97..1c48b99939d 100644 --- a/release/scripts/ui/space_image.py +++ b/release/scripts/ui/space_image.py @@ -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' diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py index aada58806ad..4516499b47c 100644 --- a/release/scripts/ui/space_sequencer.py +++ b/release/scripts/ui/space_sequencer.py @@ -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() diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index 66c5860642a..83693ed2dff 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -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") diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 5a738ade684..fa0c5029416 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -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") diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index 603ed93efed..099e7944784 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -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 # |