[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35387] trunk/blender/release/scripts/ui: use set's, since pythons 3.2's optimizer converts these to frozensets, lookups are also faster then tuples (though this isn't a bottleneck).

Campbell Barton ideasman42 at gmail.com
Mon Mar 7 14:23:45 CET 2011


Revision: 35387
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35387
Author:   campbellbarton
Date:     2011-03-07 13:23:45 +0000 (Mon, 07 Mar 2011)
Log Message:
-----------
use set's, since pythons 3.2's optimizer converts these to frozensets, lookups are also faster then tuples (though this isn't a bottleneck).

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_data_bone.py
    trunk/blender/release/scripts/ui/properties_data_curve.py
    trunk/blender/release/scripts/ui/properties_data_lamp.py
    trunk/blender/release/scripts/ui/properties_data_mesh.py
    trunk/blender/release/scripts/ui/properties_data_metaball.py
    trunk/blender/release/scripts/ui/properties_data_modifier.py
    trunk/blender/release/scripts/ui/properties_game.py
    trunk/blender/release/scripts/ui/properties_material.py
    trunk/blender/release/scripts/ui/properties_object.py
    trunk/blender/release/scripts/ui/properties_object_constraint.py
    trunk/blender/release/scripts/ui/properties_particle.py
    trunk/blender/release/scripts/ui/properties_physics_common.py
    trunk/blender/release/scripts/ui/properties_physics_field.py
    trunk/blender/release/scripts/ui/properties_physics_fluid.py
    trunk/blender/release/scripts/ui/properties_render.py
    trunk/blender/release/scripts/ui/properties_texture.py
    trunk/blender/release/scripts/ui/space_dopesheet.py
    trunk/blender/release/scripts/ui/space_image.py
    trunk/blender/release/scripts/ui/space_outliner.py
    trunk/blender/release/scripts/ui/space_sequencer.py
    trunk/blender/release/scripts/ui/space_userpref.py
    trunk/blender/release/scripts/ui/space_userpref_keymap.py
    trunk/blender/release/scripts/ui/space_view3d.py
    trunk/blender/release/scripts/ui/space_view3d_toolbar.py

Modified: trunk/blender/release/scripts/ui/properties_data_bone.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_bone.py	2011-03-07 11:53:40 UTC (rev 35386)
+++ trunk/blender/release/scripts/ui/properties_data_bone.py	2011-03-07 13:23:45 UTC (rev 35387)
@@ -123,7 +123,7 @@
         col.active = not (bone.parent and bone.use_connect)
 
         col = row.column()
-        if pchan.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'):
+        if pchan.rotation_mode in {'QUATERNION', 'AXIS_ANGLE'}:
             col.prop(pchan, "lock_rotations_4d", text="Lock Rotation")
             if pchan.lock_rotations_4d:
                 col.prop(pchan, "lock_rotation_w", text="W")

Modified: trunk/blender/release/scripts/ui/properties_data_curve.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_curve.py	2011-03-07 11:53:40 UTC (rev 35386)
+++ trunk/blender/release/scripts/ui/properties_data_curve.py	2011-03-07 13:23:45 UTC (rev 35387)
@@ -28,7 +28,7 @@
 
     @classmethod
     def poll(cls, context):
-        return (context.object and context.object.type in ('CURVE', 'SURFACE', 'FONT') and context.curve)
+        return (context.object and context.object.type in {'CURVE', 'SURFACE', 'FONT'} and context.curve)
 
 
 class CurveButtonsPanelCurve(CurveButtonsPanel):

Modified: trunk/blender/release/scripts/ui/properties_data_lamp.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_lamp.py	2011-03-07 11:53:40 UTC (rev 35386)
+++ trunk/blender/release/scripts/ui/properties_data_lamp.py	2011-03-07 13:23:45 UTC (rev 35387)
@@ -91,7 +91,7 @@
         sub.prop(lamp, "color", text="")
         sub.prop(lamp, "energy")
 
-        if lamp.type in ('POINT', 'SPOT'):
+        if lamp.type in {'POINT', 'SPOT'}:
             sub.label(text="Falloff:")
             sub.prop(lamp, "falloff_type", text="")
             sub.prop(lamp, "distance")
@@ -195,7 +195,7 @@
     def poll(cls, context):
         lamp = context.lamp
         engine = context.scene.render.engine
-        return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in cls.COMPAT_ENGINES)
+        return (lamp and lamp.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and (engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
@@ -234,7 +234,7 @@
             col = split.column()
             col.label(text="Sampling:")
 
-            if lamp.type in ('POINT', 'SUN', 'SPOT'):
+            if lamp.type in {'POINT', 'SUN', 'SPOT'}:
                 sub = col.row()
 
                 sub.prop(lamp, "shadow_ray_samples", text="Samples")
@@ -265,7 +265,7 @@
             col.label(text="Buffer Type:")
             col.row().prop(lamp, "shadow_buffer_type", expand=True)
 
-            if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY', 'DEEP'):
+            if lamp.shadow_buffer_type in {'REGULAR', 'HALFWAY', 'DEEP'}:
                 split = layout.split()
 
                 col = split.column()
@@ -372,7 +372,7 @@
         lamp = context.lamp
         engine = context.scene.render.engine
 
-        return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES)
+        return (lamp and lamp.type in {'POINT', 'SPOT'} and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
         lamp = context.lamp

Modified: trunk/blender/release/scripts/ui/properties_data_mesh.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_mesh.py	2011-03-07 11:53:40 UTC (rev 35386)
+++ trunk/blender/release/scripts/ui/properties_data_mesh.py	2011-03-07 13:23:45 UTC (rev 35387)
@@ -118,7 +118,7 @@
     def poll(cls, context):
         engine = context.scene.render.engine
         obj = context.object
-        return (obj and obj.type in ('MESH', 'LATTICE') and (engine in cls.COMPAT_ENGINES))
+        return (obj and obj.type in {'MESH', 'LATTICE'} and (engine in cls.COMPAT_ENGINES))
 
     def draw(self, context):
         layout = self.layout
@@ -167,7 +167,7 @@
     def poll(cls, context):
         engine = context.scene.render.engine
         obj = context.object
-        return (obj and obj.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE') and (engine in cls.COMPAT_ENGINES))
+        return (obj and obj.type in {'MESH', 'LATTICE', 'CURVE', 'SURFACE'} and (engine in cls.COMPAT_ENGINES))
 
     def draw(self, context):
         layout = self.layout

Modified: trunk/blender/release/scripts/ui/properties_data_metaball.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_metaball.py	2011-03-07 11:53:40 UTC (rev 35386)
+++ trunk/blender/release/scripts/ui/properties_data_metaball.py	2011-03-07 13:23:45 UTC (rev 35387)
@@ -96,7 +96,7 @@
 
         col = split.column(align=True)
 
-        if metaelem.type in ('CUBE', 'ELLIPSOID'):
+        if metaelem.type in {'CUBE', 'ELLIPSOID'}:
             col.label(text="Size:")
             col.prop(metaelem, "size_x", text="X")
             col.prop(metaelem, "size_y", text="Y")

Modified: trunk/blender/release/scripts/ui/properties_data_modifier.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_modifier.py	2011-03-07 11:53:40 UTC (rev 35386)
+++ trunk/blender/release/scripts/ui/properties_data_modifier.py	2011-03-07 13:23:45 UTC (rev 35387)
@@ -536,7 +536,7 @@
         col.label(text="Deform:")
         col.prop(md, "factor")
         col.prop(md, "limits", slider=True)
-        if md.deform_method in ('TAPER', 'STRETCH'):
+        if md.deform_method in {'TAPER', 'STRETCH'}:
             col.prop(md, "lock_x")
             col.prop(md, "lock_y")
 

Modified: trunk/blender/release/scripts/ui/properties_game.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_game.py	2011-03-07 11:53:40 UTC (rev 35386)
+++ trunk/blender/release/scripts/ui/properties_game.py	2011-03-07 13:23:45 UTC (rev 35387)
@@ -47,7 +47,7 @@
         layout.separator()
 
         #if game.physics_type == 'DYNAMIC':
-        if game.physics_type in ('DYNAMIC', 'RIGID_BODY'):
+        if game.physics_type in {'DYNAMIC', 'RIGID_BODY'}:
             split = layout.split()
 
             col = split.column()
@@ -163,7 +163,7 @@
             subsub.active = game.use_anisotropic_friction
             subsub.prop(game, "friction_coefficients", text="", slider=True)
 
-        elif game.physics_type in ('SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'):
+        elif game.physics_type in {'SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'}:
             layout.prop(ob, "hide_render", text="Invisible")
 
 
@@ -175,7 +175,7 @@
     def poll(cls, context):
         game = context.object.game
         rd = context.scene.render
-        return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in cls.COMPAT_ENGINES)
+        return (game.physics_type in {'DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC'}) and (rd.engine in cls.COMPAT_ENGINES)
 
     def draw_header(self, context):
         game = context.active_object.game

Modified: trunk/blender/release/scripts/ui/properties_material.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_material.py	2011-03-07 11:53:40 UTC (rev 35386)
+++ trunk/blender/release/scripts/ui/properties_material.py	2011-03-07 13:23:45 UTC (rev 35387)
@@ -161,13 +161,13 @@
     def poll(cls, context):
         mat = context.material
         engine = context.scene.render.engine
-        return mat and (not simple_material(mat)) and (mat.type in ('SURFACE', 'WIRE', 'VOLUME')) and (engine in cls.COMPAT_ENGINES)
+        return mat and (not simple_material(mat)) and (mat.type in {'SURFACE', 'WIRE', 'VOLUME'}) and (engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self. layout
 
         mat = context.material
-        mat_type = mat.type in ('SURFACE', 'WIRE')
+        mat_type = mat.type in {'SURFACE', 'WIRE'}
 
         row = layout.row()
         row.active = mat_type
@@ -209,7 +209,7 @@
     def poll(cls, context):
         mat = context.material
         engine = context.scene.render.engine
-        return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+        return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
@@ -264,7 +264,7 @@
     def poll(cls, context):
         mat = context.material
         engine = context.scene.render.engine
-        return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+        return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
@@ -284,7 +284,7 @@
         col.prop(mat, "use_specular_ramp", text="Ramp")
 
         col = layout.column()
-        if mat.specular_shader in ('COOKTORR', 'PHONG'):
+        if mat.specular_shader in {'COOKTORR', 'PHONG'}:
             col.prop(mat, "specular_hardness", text="Hardness")
         elif mat.specular_shader == 'BLINN':
             row = col.row()
@@ -317,14 +317,14 @@
     def poll(cls, context):
         mat = context.material
         engine = context.scene.render.engine
-        return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+        return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
 
         mat = active_node_mat(context.material)
 
-        if mat.type in ('SURFACE', 'WIRE'):
+        if mat.type in {'SURFACE', 'WIRE'}:
             split = layout.split()
 
             col = split.column()
@@ -352,7 +352,7 @@
     def poll(cls, context):
         mat = context.material
         engine = context.scene.render.engine

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list