code cleanup: py ui
authorCampbell Barton <ideasman42@gmail.com>
Thu, 4 Apr 2013 17:01:51 +0000 (17:01 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 4 Apr 2013 17:01:51 +0000 (17:01 +0000)
release/scripts/startup/bl_ui/properties_paint_common.py
release/scripts/startup/bl_ui/properties_physics_common.py
release/scripts/startup/bl_ui/space_info.py
release/scripts/startup/bl_ui/space_time.py
release/scripts/startup/bl_ui/space_view3d.py

index 391874ea3dc5ea0c023ec61cfad79e8cea62a521..ce7335d29755111ee46c88094be193e6c4622efd 100644 (file)
@@ -117,7 +117,7 @@ def brush_texture_settings(layout, brush, sculpt):
 def brush_mask_texture_settings(layout, brush):
     mask_tex_slot = brush.mask_texture_slot
 
-    if(brush.mask_texture):
+    if brush.mask_texture:
         layout.label(text="Mask Mapping:")
         col = layout.column()
         col.active = brush.brush_capabilities.has_texture_angle
index b02a53302e705bf5861b740e9ffbb46e081e75b0..3d7fe59ff779d1fea54411f3b523c5b174bc8c4f 100644 (file)
@@ -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
index eedfe3587b1d58f0b29f7dd0731afc3f29e99242..4ea366e35418148b7f275768e03059c5d033afb5 100644 (file)
@@ -304,7 +304,7 @@ class INFO_MT_add(Menu):
         layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
         layout.separator()
 
-        if(len(bpy.data.groups) > 10):
+        if len(bpy.data.groups) > 10:
             layout.operator_context = 'INVOKE_REGION_WIN'
             layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
         else:
index 6af9f37723761eadafcf4491f25a642a1296e390..becdc79223077cb068e76fb88bd25654d2b8ff8b 100644 (file)
@@ -214,7 +214,7 @@ def marker_menu_generic(layout):
     layout.operator("marker.add", "Add Marker")
     layout.operator("marker.duplicate", text="Duplicate Marker")
 
-    if(len(bpy.data.scenes) > 10):
+    if len(bpy.data.scenes) > 10:
         layout.operator_context = 'INVOKE_DEFAULT'
         layout.operator("marker.make_links_scene", text="Duplicate Marker to Scene...", icon='OUTLINER_OB_EMPTY')
     else:
index a82d92211669bcf49e13094f564078eb1b0358be..d3350a77ba7c476870aeaa45904496f5b323f440 100644 (file)
@@ -1113,7 +1113,7 @@ class VIEW3D_MT_make_links(Menu):
     def draw(self, context):
         layout = self.layout
         operator_context_default = layout.operator_context
-        if(len(bpy.data.scenes) > 10):
+        if len(bpy.data.scenes) > 10:
             layout.operator_context = 'INVOKE_REGION_WIN'
             layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
         else: