diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-10 12:54:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-10 12:54:10 +0400 |
commit | 5d4df1a999d65bdfe67cec1088b34d9d47fc5412 (patch) | |
tree | 2409cd2edc0e4399a68bb6022081e2e38d0e2b7a /release/scripts/startup | |
parent | f75ca60a1c55388334a3b85934bd23a122c6b92c (diff) |
pep8 cleanup
Diffstat (limited to 'release/scripts/startup')
10 files changed, 52 insertions, 37 deletions
diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index 161349152d5..bb3a9a6330f 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -54,7 +54,7 @@ class CopyRigidbodySettings(Operator): for o in objects: if o.rigid_body is None: continue - + o.rigid_body.type = obj.rigid_body.type o.rigid_body.kinematic = obj.rigid_body.kinematic o.rigid_body.mass = obj.rigid_body.mass @@ -144,7 +144,7 @@ class BakeToKeyframes(Operator): # this is a little roundabout but there's no better way right now aa = mat.to_quaternion().to_axis_angle() obj.rotation_axis_angle = (aa[1], ) + aa[0][:] - else: # euler + else: # euler # make sure euler rotation is compatible to previous frame obj.rotation_euler = mat.to_euler(rot_mode, obj_prev.rotation_euler) @@ -190,7 +190,8 @@ class BakeToKeyframes(Operator): class ConnectRigidBodies(Operator): - '''Create rigid body constraints between selected and active rigid bodies''' + """Create rigid body constraints between """ \ + """selected and active rigid bodies""" bl_idname = "rigidbody.connect" bl_label = "Connect Rigid Bodies" bl_options = {'REGISTER', 'UNDO'} @@ -232,7 +233,11 @@ class ConnectRigidBodies(Operator): loc = obj.location else: loc = (obj_act.location + obj.location) / 2.0 - bpy.ops.object.add(type='EMPTY', view_align=False, enter_editmode=False, location=loc) + # TODO: use bpy.data.objects.new(...) + bpy.ops.object.add(type='EMPTY', + view_align=False, + enter_editmode=False, + location=loc) bpy.ops.rigidbody.constraint_add() con_obj = context.active_object con_obj.empty_draw_type = 'ARROWS' @@ -241,12 +246,12 @@ class ConnectRigidBodies(Operator): con.object1 = obj_act con.object2 = obj change = True - + if change: # restore selection bpy.ops.object.select_all(action='DESELECT') for obj in objects: - obj.select = True; + obj.select = True scene.objects.active = obj_act return {'FINISHED'} else: diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index 022f2500940..7c06aefe575 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -82,7 +82,7 @@ def brush_texture_settings(layout, brush, sculpt): else: layout.row().prop(tex_slot, "tex_paint_map_mode", text="") layout.separator() - + # angle and texture_angle_source col = layout.column() if sculpt: @@ -101,7 +101,7 @@ def brush_texture_settings(layout, brush, sculpt): split = layout.split() split.prop(tex_slot, "offset") split.prop(tex_slot, "scale") - + if sculpt: # texture_sample_bias col = layout.column(align=True) diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index aef860e774b..ee8c74a2cb6 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -543,7 +543,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel): # spacing between particles when the fluid is at rest. This # makes it easier to set stable initial conditions. particle_volume = part.mass / fluid.rest_density - spacing = pow(particle_volume, 1/3) + spacing = pow(particle_volume, 1.0 / 3.0) sub = col.row() sub.label(text="Spacing: %g" % spacing) diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 17a44a523dc..a640cb215ba 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -44,6 +44,7 @@ def physics_add(self, layout, md, name, type, typeicon, toggles): else: sub.operator("object.modifier_add", text=name, icon=typeicon).type = type + def physics_add_special(self, layout, data, name, addop, removeop, typeicon): sub = layout.row(align=True) if data: @@ -51,6 +52,7 @@ def physics_add_special(self, layout, data, name, addop, removeop, typeicon): else: sub.operator(addop, text=name, icon=typeicon) + class PHYSICS_PT_add(PhysicButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -86,13 +88,13 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel): physics_add_special(self, col, ob.rigid_body, "Rigid Body", "rigidbody.object_add", "rigidbody.object_remove", - 'MESH_ICOSPHERE') # XXX: need dedicated icon + 'MESH_ICOSPHERE') # XXX: need dedicated icon # all types of objects can have rigid body constraint physics_add_special(self, col, ob.rigid_body_constraint, "Rigid Body Constraint", "rigidbody.constraint_add", "rigidbody.constraint_remove", - 'CONSTRAINT') # RB_TODO needs better icon + 'CONSTRAINT') # RB_TODO needs better icon # cache-type can be 'PSYS' 'HAIR' 'SMOKE' etc diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py index f335c560f7b..922eee66ddc 100644 --- a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py +++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py @@ -32,22 +32,22 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel): @classmethod def poll(cls, context): - ob = context.object - rd = context.scene.render - return (ob and ob.rigid_body and (not rd.use_game_engine)) + obj = context.object + return (obj and obj.rigid_body and + (not context.scene.render.use_game_engine)) def draw_header(self, context): obj = context.object rbo = obj.rigid_body if rbo is not None: - self.layout.prop(rbo, "enabled", text=""); + self.layout.prop(rbo, "enabled", text="") def draw(self, context): layout = self.layout ob = context.object rbo = ob.rigid_body - + if rbo is not None: layout.prop(rbo, "type", text="Type") layout.prop(rbo, "kinematic", text="Animated") @@ -61,34 +61,35 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel): @classmethod def poll(cls, context): - return (context.object and context.object.rigid_body and + obj = context.object + return (obj and obj.rigid_body and (not context.scene.render.use_game_engine)) - + def draw(self, context): layout = self.layout ob = context.object rbo = ob.rigid_body - + layout.prop(rbo, "collision_shape", text="Shape") - + split = layout.split() - + col = split.column() col.label(text="Surface Response:") col.prop(rbo, "friction") col.prop(rbo, "restitution", text="Bounciness") - + col = split.column() col.label(text="Sensitivity:") if rbo.collision_shape in {'MESH', 'CONE'}: col.prop(rbo, "collision_margin", text="Margin") else: - col.prop(rbo, "use_margin"); + col.prop(rbo, "use_margin") sub = col.column() sub.active = rbo.use_margin sub.prop(rbo, "collision_margin", text="Margin") - + layout.prop(rbo, "collision_groups") @@ -98,22 +99,23 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel): @classmethod def poll(cls, context): - return (context.object and context.object.rigid_body and - context.object.rigid_body.type == 'ACTIVE' and + obj = context.object + return (obj and obj.rigid_body and + obj.rigid_body.type == 'ACTIVE' and (not context.scene.render.use_game_engine)) - + def draw(self, context): layout = self.layout ob = context.object rbo = ob.rigid_body - + #col = layout.column(align=1) #col.label(text="Activation:") # XXX: settings such as activate on collison/etc. - - split = layout.split(); - + + split = layout.split() + col = split.column() col.label(text="Deactivation:") col.prop(rbo, "use_deactivation") @@ -123,7 +125,7 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel): sub.prop(rbo, "deactivate_linear_velocity", text="Linear Vel") sub.prop(rbo, "deactivate_angular_velocity", text="Angular Vel") # TODO: other params such as time? - + col = split.column() col.label(text="Damping:") col.prop(rbo, "linear_damping", text="Translation") diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py index 49b760ef546..e4e5b94407d 100644 --- a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py +++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py @@ -173,7 +173,7 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa sub.prop(rbc, "limit_ang_z_lower", text="Lower") sub.prop(rbc, "limit_ang_z_upper", text="Upper") - if rbc.type == 'GENERIC_SPRING': + if rbc.type == 'GENERIC_SPRING': col = layout.column(align=True) col.label("Springs:") diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index b9b57923420..68a097e6188 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -26,6 +26,7 @@ from bl_ui.properties_physics_common import ( effector_weights_ui, ) + class SCENE_UL_keying_set_paths(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.KeyingSetPath) diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 84f26acb4cc..b61830a7527 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -28,10 +28,14 @@ class CLIP_UL_tracking_objects(UIList): # assert(isinstance(item, bpy.types.MovieTrackingObject) tobj = item if self.layout_type in {'DEFAULT', 'COMPACT'}: - layout.label(text=tobj.name, translate=False, icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA') + layout.label(text=tobj.name, translate=False, + icon='CAMERA_DATA' if tobj.is_camera + else 'OBJECT_DATA') elif self.layout_type in {'GRID'}: layout.alignment = 'CENTER' - layout.label(text="", icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA') + layout.label(text="", + icon='CAMERA_DATA' if tobj.is_camera + else 'OBJECT_DATA') class CLIP_HT_header(Header): diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 6d08663006f..43535eb8c2f 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -22,6 +22,7 @@ from bpy.types import Header, Menu, Panel from bl_ui.properties_paint_common import UnifiedPaintPanel from bl_ui.properties_paint_common import brush_texture_settings + class ImagePaintPanel(UnifiedPaintPanel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' @@ -722,7 +723,7 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel): col = layout.column() col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8) - + brush_texture_settings(col, brush, 0) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 6a0cf44a784..fcc20243a8c 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2695,7 +2695,7 @@ class VIEW3D_PT_etch_a_ton(Panel): colsub = col.column(align=True) colsub.prop(toolsettings, "use_etch_autoname") - sub = colsub.column() + sub = colsub.column() sub.enabled = not toolsettings.use_etch_autoname sub.prop(toolsettings, "etch_number") sub.prop(toolsettings, "etch_side") |