use is rather then == when comparing with singletons (None/False/True), its faster...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 22 Nov 2009 17:41:35 +0000 (17:41 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 22 Nov 2009 17:41:35 +0000 (17:41 +0000)
12 files changed:
release/scripts/ui/properties_data_armature.py
release/scripts/ui/properties_data_bone.py
release/scripts/ui/properties_data_mesh.py
release/scripts/ui/properties_object.py
release/scripts/ui/properties_particle.py
release/scripts/ui/properties_physics_cloth.py
release/scripts/ui/properties_physics_smoke.py
release/scripts/ui/properties_physics_softbody.py
release/scripts/ui/properties_render.py
release/scripts/ui/properties_scene.py
release/scripts/ui/space_sequencer.py
release/scripts/ui/space_userpref.py

index a5db2bbd1a334f955405fcd9119c13ac7c9d901c..b0d2873fb8f67c3014d20954a47b7ca0edbd06be 100644 (file)
@@ -127,18 +127,18 @@ class DATA_PT_bone_groups(DataButtonsPanel):
         row.template_list(pose, "bone_groups", pose, "active_bone_group_index", rows=2)
 
         col = row.column(align=True)
-        col.active = (ob.proxy == None)
+        col.active = (ob.proxy is None)
         col.itemO("pose.group_add", icon='ICON_ZOOMIN', text="")
         col.itemO("pose.group_remove", icon='ICON_ZOOMOUT', text="")
 
         group = pose.active_bone_group
         if group:
             col = layout.column()
-            col.active = (ob.proxy == None)
+            col.active = (ob.proxy is None)
             col.itemR(group, "name")
 
             split = layout.split()
-            split.active = (ob.proxy == None)
+            split.active = (ob.proxy is None)
 
             col = split.column()
             col.itemR(group, "color_set")
@@ -148,7 +148,7 @@ class DATA_PT_bone_groups(DataButtonsPanel):
                 col.template_triColorSet(group, "colors")
 
         row = layout.row(align=True)
-        row.active = (ob.proxy == None)
+        row.active = (ob.proxy is None)
 
         row.itemO("pose.group_assign", text="Assign")
         row.itemO("pose.group_remove", text="Remove") #row.itemO("pose.bone_group_remove_from", text="Remove")
index 0770942a6ea1bea1f03b71821772a8a2def2f947..a102c2c4db66e19e7a1ea6ea3c7558de9b7c695c 100644 (file)
@@ -185,7 +185,7 @@ class BONE_PT_relations(BoneButtonsPanel):
             col.item_pointerR(bone, "parent", arm, "edit_bones", text="")
 
         sub = col.column()
-        sub.active = bone.parent != None
+        sub.active = (bone.parent is not None)
         sub.itemR(bone, "connected")
         sub.itemR(bone, "hinge", text="Inherit Rotation")
         sub.itemR(bone, "inherit_scale", text="Inherit Scale")
index acbeb3552de1854879eb2a9a0f82bbd8da590dd0..fb00ff4970014635d30ad302a892838ceb966a86 100644 (file)
@@ -156,7 +156,7 @@ class DATA_PT_shape_keys(DataButtonsPanel):
         enable_edit = ob.mode != 'EDIT'
         enable_edit_value = False
 
-        if ob.shape_key_lock == False:
+        if ob.shape_key_lock is False:
             if enable_edit or (ob.type == 'MESH' and ob.shape_key_edit_mode):
                 enable_edit_value = True
 
index a1e3edba8ee48c2198bb2f850a6d7ac63329e416..e124d654b5393859fdc3a191f34c4fc2d2335a4b 100644 (file)
@@ -135,7 +135,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel):
         parent = ob.parent
         if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
             sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="")
-        sub.active = parent != None
+        sub.active = (parent is not None)
 
 
 class OBJECT_PT_groups(ObjectButtonsPanel):
@@ -276,10 +276,10 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
         row.active = len(ob.particle_systems) != 0
         row = col.row()
         row.itemR(ob, "time_offset_parent", text="Parent")
-        row.active = ob.parent != None
+        row.active = (ob.parent is not None)
         row = col.row()
         row.itemR(ob, "slow_parent")
-        row.active = ob.parent != None
+        row.active = (ob.parent is not None)
         col.itemR(ob, "time_offset", text="Offset")
 
         if wide_ui:
@@ -290,7 +290,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
         col.itemR(ob, "up_axis", text="Up Axis")
         row = col.row()
         row.itemR(ob, "track_override_parent", text="Override Parent")
-        row.active = ob.parent != None
+        row.active = (ob.parent is not None)
 
 
 class OBJECT_PT_properties(ObjectButtonsPanel):
index 840ba549d8788b6d3e8c99f63e97bff01f1d6bd9..276643b32ff5e3cb98cc02c57a7e88acba1780ff 100644 (file)
@@ -26,14 +26,14 @@ from properties_physics_common import basic_force_field_falloff_ui
 
 
 def particle_panel_enabled(context, psys):
-    return psys.point_cache.baked == False and psys.edited == False and (not context.particle_system_editable)
+    return (psys.point_cache.baked is False) and (not psys.edited) and (not context.particle_system_editable)
 
 
 def particle_panel_poll(context):
     psys = context.particle_system
-    if psys == None:
+    if psys is None:
         return False
-    if psys.settings == None:
+    if psys.settings is None:
         return False
     return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR')
 
@@ -110,14 +110,14 @@ class PARTICLE_PT_particles(ParticleButtonsPanel):
 
                 split = layout.split(percentage=0.65)
                 if part.type == 'HAIR':
-                    if psys.edited == True:
+                    if psys.edited:
                         split.itemO("particle.edited_clear", text="Free Edit")
                     else:
                         split.itemL(text="")
                     row = split.row()
                     row.enabled = particle_panel_enabled(context, psys)
                     row.itemR(part, "hair_step")
-                    if psys.edited == True:
+                    if psys.edited:
                         if psys.global_hair:
                             layout.itemO("particle.connect_hair")
                             layout.itemL(text="Hair is disconnected.")
@@ -190,9 +190,9 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel):
 
     def poll(self, context):
         psys = context.particle_system
-        if psys == None:
+        if psys is None:
             return False
-        if psys.settings == None:
+        if psys.settings is None:
             return False
         return psys.settings.type == 'HAIR'
 
@@ -240,9 +240,9 @@ class PARTICLE_PT_cache(ParticleButtonsPanel):
 
     def poll(self, context):
         psys = context.particle_system
-        if psys == None:
+        if psys is None:
             return False
-        if psys.settings == None:
+        if psys.settings is None:
             return False
         phystype = psys.settings.physics_type
         if phystype == 'NO' or phystype == 'KEYED':
@@ -488,9 +488,9 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
 
     def poll(self, context):
         psys = context.particle_system
-        if psys == None:
+        if psys is None:
             return False
-        if psys.settings == None:
+        if psys.settings is None:
             return False
         if psys.point_cache.external:
             return False
@@ -586,9 +586,9 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
 
     def poll(self, context):
         psys = context.particle_system
-        if psys == None:
+        if psys is None:
             return False
-        if psys.settings == None:
+        if psys.settings is None:
             return False
         return True
 
@@ -625,20 +625,20 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
             sub.itemR(part, "velocity_length")
         elif part.ren_as == 'PATH':
 
-            if part.type != 'HAIR' and part.physics_type != 'KEYED' and psys.point_cache.baked == False:
+            if part.type != 'HAIR' and part.physics_type != 'KEYED' and (psys.point_cache.baked is False):
                 box = layout.box()
                 box.itemL(text="Baked or keyed particles needed for correct rendering.")
                 return
 
             sub.itemR(part, "render_strand")
             subsub = sub.column()
-            subsub.active = part.render_strand == False
+            subsub.active = (part.render_strand is False)
             subsub.itemR(part, "render_adaptive")
             subsub = sub.column()
             subsub.active = part.render_adaptive or part.render_strand == True
             subsub.itemR(part, "adaptive_angle")
             subsub = sub.column()
-            subsub.active = part.render_adaptive == True and part.render_strand == False
+            subsub.active = (part.render_adaptive is True and part.render_strand is False)
             subsub.itemR(part, "adaptive_pix")
             sub.itemR(part, "hair_bspline")
             sub.itemR(part, "render_step", text="Steps")
@@ -675,12 +675,12 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
             sub = split.column()
             sub.itemR(part, "whole_group")
             subsub = sub.column()
-            subsub.active = part.whole_group == False
+            subsub.active = (part.whole_group is False)
             subsub.itemR(part, "use_group_count")
 
             sub = split.column()
             subsub = sub.column()
-            subsub.active = part.whole_group == False
+            subsub.active = (part.whole_group is False)
             subsub.itemR(part, "use_global_dupli")
             subsub.itemR(part, "rand_group")
 
@@ -754,9 +754,9 @@ class PARTICLE_PT_draw(ParticleButtonsPanel):
 
     def poll(self, context):
         psys = context.particle_system
-        if psys == None:
+        if psys is None:
             return False
-        if psys.settings == None:
+        if psys.settings is None:
             return False
         return True
 
@@ -774,7 +774,7 @@ class PARTICLE_PT_draw(ParticleButtonsPanel):
 
         path = (part.ren_as == 'PATH' and part.draw_as == 'RENDER') or part.draw_as == 'PATH'
 
-        if path and part.type != 'HAIR' and part.physics_type != 'KEYED' and psys.point_cache.baked == False:
+        if path and part.type != 'HAIR' and part.physics_type != 'KEYED' and psys.point_cache.baked is False:
             box = layout.box()
             box.itemL(text="Baked or keyed particles needed for correct drawing.")
             return
@@ -801,7 +801,7 @@ class PARTICLE_PT_draw(ParticleButtonsPanel):
             col.itemR(part, "draw_step")
         else:
             sub = col.column()
-            sub.active = part.material_color == False
+            sub.active = (part.material_color is False)
             #sub.itemL(text="color")
             #sub.itemL(text="Override material color")
 
index 5421180134c5ce3b2c2d3ccb9a7d5a188a07bb76..07c1205739833d6cb6f3cf75dc944186cb36277d 100644 (file)
@@ -27,7 +27,7 @@ from properties_physics_common import effector_weights_ui
 
 
 def cloth_panel_enabled(md):
-    return md.point_cache.baked == False
+    return md.point_cache.baked is False
     
 
 class CLOTH_MT_presets(bpy.types.Menu):
index 631c91a5487403b7964682498d2182ffee8b5b4b..326b90851096233a2f5c11e493ac7439277f790b 100644 (file)
@@ -158,7 +158,7 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel):
         md = context.smoke.domain_settings
         cache = md.point_cache_low
 
-        point_cache_ui(self, context, cache, cache.baked == False, 0, 1)
+        point_cache_ui(self, context, cache, (cache.baked is False), 0, 1)
 
 
 class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
@@ -206,7 +206,7 @@ class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel):
         md = context.smoke.domain_settings
         cache = md.point_cache_high
 
-        point_cache_ui(self, context, cache, cache.baked == False, 0, 1)
+        point_cache_ui(self, context, cache, (cache.baked is False), 0, 1)
 
 
 class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel):
index 02244ef71abde07345bb510295dc4b2fb5154c43..c22f81cfa323f1b4f2bdfdc6fbb2995df6b79994 100644 (file)
@@ -27,7 +27,7 @@ from properties_physics_common import effector_weights_ui
 
 
 def softbody_panel_enabled(md):
-    return md.point_cache.baked == False
+    return (md.point_cache.baked is False)
 
 
 class PhysicButtonsPanel(bpy.types.Panel):
index 4894dfafe4a0990be89d38bc068622f1931a564b..06acf581429ac182eafd2ec0e4e9994a9b58d232 100644 (file)
@@ -37,7 +37,7 @@ class RenderButtonsPanel(bpy.types.Panel):
 
     def poll(self, context):
         rd = context.scene.render_data
-        return (context.scene and rd.use_game_engine == False) and (rd.engine in self.COMPAT_ENGINES)
+        return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES)
 
 
 class RENDER_PT_render(RenderButtonsPanel):
index 3c1fbf01ad60c3303897dbc12c2e06ca3def3626..5082dfaab36a04602d1ba8e2f4a8676236f0922a 100644 (file)
@@ -107,7 +107,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
     bl_label = "Active Keying Set"
 
     def poll(self, context):
-        return (context.scene != None) and (context.scene.active_keying_set != None)
+        return (context.scene.active_keying_set is not None)
 
     def draw(self, context):
         layout = self.layout
@@ -141,7 +141,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
             col = row.column()
             col.itemL(text="Array Target:")
             col.itemR(ksp, "entire_array")
-            if ksp.entire_array == False:
+            if ksp.entire_array is False:
                 col.itemR(ksp, "array_index")
 
             if wide_ui:
index 06b6569b572ca36985314f57a1f4539751d862cf..7895d40de6a4fb829c80ff21439f4d354f924896 100644 (file)
@@ -277,7 +277,7 @@ class SequencerButtonsPanel(bpy.types.Panel):
     bl_region_type = 'UI'
 
     def poll(self, context):
-        return context.space_data.display_mode == 'SEQUENCER' and act_strip(context) != None
+        return (context.space_data.display_mode == 'SEQUENCER') and (act_strip(context) is not None)
 
 
 class SequencerButtonsPanel_Output(bpy.types.Panel):
@@ -311,7 +311,7 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel):
         row = layout.row()
         if strip.mute == True:
             row.itemR(strip, "mute", toggle=True, icon='ICON_RESTRICT_VIEW_ON', text="")
-        elif strip.mute == False:
+        elif strip.mute is False:
             row.itemR(strip, "mute", toggle=True, icon='ICON_RESTRICT_VIEW_OFF', text="")
 
         sub = row.row()
index ef1d829e69c9d8ea6a2b79fb314a372ab7f93452..c12a62e6136f57205d8d612201bd90ce1f7033cf 100644 (file)
@@ -1248,7 +1248,7 @@ class USERPREF_PT_input(bpy.types.Panel):
                 flow = itemcol.column_flow(columns=2)
                 props = kmi.properties
 
-                if props != None:
+                if props is not None:
                     for pname in dir(props):
                         if not props.is_property_hidden(pname):
                             flow.itemR(props, pname)
@@ -1351,7 +1351,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
 
                 props = kmi.properties
 
-                if props != None:
+                if props is not None:
                     for pname in dir(props):
                         if props.is_property_set(pname) and not props.is_property_hidden(pname):
                             value = eval("props.%s" % pname)