diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-04 21:01:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-04 21:01:51 +0400 |
commit | e8c272422a44a25a0324eeade4154fe349f401fe (patch) | |
tree | 07a3d58b0b3074a608d74891ab03b8837d975440 /release/scripts/startup/bl_ui/properties_physics_common.py | |
parent | 7338dea2524b2ed0c4049f6043ae2246605a9438 (diff) |
code cleanup: py ui
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_physics_common.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_physics_common.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index b02a53302e7..3d7fe59ff77 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -39,7 +39,7 @@ def physics_add(self, layout, md, name, type, typeicon, toggles): if md: sub.context_pointer_set("modifier", md) sub.operator("object.modifier_remove", text=name, text_ctxt=i18n_contexts.default, icon='X') - if(toggles): + if toggles: sub.prop(md, "show_render", text="") sub.prop(md, "show_viewport", text="") else: @@ -59,40 +59,39 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel): bl_options = {'HIDE_HEADER'} def draw(self, context): - ob = context.object + obj = context.object layout = self.layout layout.label("Enable physics for:") split = layout.split() col = split.column() - if(context.object.field.type == 'NONE'): + if obj.field.type == 'NONE': col.operator("object.forcefield_toggle", text="Force Field", icon='FORCE_FORCE') else: col.operator("object.forcefield_toggle", text="Force Field", icon='X') - if(ob.type == 'MESH'): + if obj.type == 'MESH': physics_add(self, col, context.collision, "Collision", 'COLLISION', 'MOD_PHYSICS', False) physics_add(self, col, context.cloth, "Cloth", 'CLOTH', 'MOD_CLOTH', True) physics_add(self, col, context.dynamic_paint, "Dynamic Paint", 'DYNAMIC_PAINT', 'MOD_DYNAMICPAINT', True) col = split.column() - if(ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE'): + if obj.type in {'MESH', 'LATTICE', 'CURVE'}: physics_add(self, col, context.soft_body, "Soft Body", 'SOFT_BODY', 'MOD_SOFT', True) - if(ob.type == 'MESH'): + if obj.type == 'MESH': physics_add(self, col, context.fluid, "Fluid", 'FLUID_SIMULATION', 'MOD_FLUIDSIM', True) physics_add(self, col, context.smoke, "Smoke", 'SMOKE', 'MOD_SMOKE', True) - if(ob.type == 'MESH'): - physics_add_special(self, col, ob.rigid_body, "Rigid Body", + physics_add_special(self, col, obj.rigid_body, "Rigid Body", "rigidbody.object_add", "rigidbody.object_remove", '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", + physics_add_special(self, col, obj.rigid_body_constraint, "Rigid Body Constraint", "rigidbody.constraint_add", "rigidbody.constraint_remove", 'CONSTRAINT') # RB_TODO needs better icon |