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).

This commit is contained in:
Campbell Barton 2011-03-07 13:23:45 +00:00
parent cfd9d6d190
commit c9685af1ff
24 changed files with 112 additions and 115 deletions

@ -123,7 +123,7 @@ class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel):
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")

@ -28,7 +28,7 @@ class CurveButtonsPanel():
@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):

@ -91,7 +91,7 @@ class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel):
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 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
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 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
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 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
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 @@ class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
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

@ -118,7 +118,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel):
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 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel):
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

@ -96,7 +96,7 @@ class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
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")

@ -536,7 +536,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
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")

@ -47,7 +47,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
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 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
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 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel):
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

@ -161,13 +161,13 @@ class MATERIAL_PT_pipeline(MaterialButtonsPanel, bpy.types.Panel):
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 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
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 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
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 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
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 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
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 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
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_header(self, context):
mat = context.material
@ -417,7 +417,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
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_header(self, context):
raym = active_node_mat(context.material).raytrace_mirror
@ -475,7 +475,7 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
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_header(self, context):
mat = active_node_mat(context.material)
@ -645,7 +645,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
return mat and (mat.type in {'SURFACE', 'WIRE', 'HALO'}) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -691,7 +691,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
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
@ -739,7 +739,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
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
@ -875,7 +875,7 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
sub = col.column()
sub.active = vol.use_light_cache
sub.prop(vol, "cache_resolution")
elif vol.light_method in ('MULTIPLE_SCATTERING', 'SHADED_PLUS_MULTIPLE_SCATTERING'):
elif vol.light_method in {'MULTIPLE_SCATTERING', 'SHADED_PLUS_MULTIPLE_SCATTERING'}:
sub = col.column()
sub.enabled = True
sub.active = False

@ -111,7 +111,7 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
col.prop(ob, "lock_location", text="Location")
col = row.column()
if ob.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'):
if ob.rotation_mode in {'QUATERNION', 'AXIS_ANGLE'}:
col.prop(ob, "lock_rotations_4d", text="Rotation")
if ob.lock_rotations_4d:
col.prop(ob, "lock_rotation_w", text="W")

@ -34,7 +34,7 @@ class ConstraintButtonsPanel():
# match enum type to our functions, avoids a lookup table.
getattr(self, con.type)(context, box, con)
if con.type not in ('RIGID_BODY_JOINT', 'NULL'):
if con.type not in {'RIGID_BODY_JOINT', 'NULL'}:
box.prop(con, "influence")
def space_template(self, layout, con, target=True, owner=True):
@ -65,7 +65,7 @@ class ConstraintButtonsPanel():
row = layout.row()
row.label(text="Head/Tail:")
row.prop(con, "head_tail", text="")
elif con.target.type in ('MESH', 'LATTICE'):
elif con.target.type in {'MESH', 'LATTICE'}:
layout.prop_search(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
def ik_template(self, layout, con):

@ -30,7 +30,7 @@ def particle_panel_enabled(context, psys):
if psys == None:
return True
phystype = psys.settings.physics_type
if psys.settings.type in ('EMITTER', 'REACTOR') and phystype in ('NO', 'KEYED'):
if psys.settings.type in {'EMITTER', 'REACTOR'} and phystype in {'NO', 'KEYED'}:
return True
else:
return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
@ -321,7 +321,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
phystype = psys.settings.physics_type
if phystype == 'NO' or phystype == 'KEYED':
return False
return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and (psys.use_hair_dynamics or psys.point_cache.is_baked))) and engine in cls.COMPAT_ENGINES
return (psys.settings.type in {'EMITTER', 'REACTOR'} or (psys.settings.type == 'HAIR' and (psys.use_hair_dynamics or psys.point_cache.is_baked))) and engine in cls.COMPAT_ENGINES
def draw(self, context):
psys = context.particle_system
@ -593,7 +593,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
col.prop(boids, "pitch", slider=True)
col.prop(boids, "height", slider=True)
if psys and part.physics_type in ('KEYED', 'BOIDS', 'FLUID'):
if psys and part.physics_type in {'KEYED', 'BOIDS', 'FLUID'}:
if part.physics_type == 'BOIDS':
layout.label(text="Relations:")
elif part.physics_type == 'FLUID':

@ -89,7 +89,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
col.operator("ptcache.remove", icon='ZOOMOUT', text="")
row = layout.row()
if cachetype in ('PSYS', 'HAIR', 'SMOKE'):
if cachetype in {'PSYS', 'HAIR', 'SMOKE'}:
row.prop(cache, "use_external")
if cache.use_external:
@ -121,7 +121,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
row.enabled = enabled
row.prop(cache, "frame_start")
row.prop(cache, "frame_end")
if cachetype not in ('SMOKE', 'CLOTH'):
if cachetype not in {'SMOKE', 'CLOTH'}:
row.prop(cache, "frame_step")
row.prop(cache, "use_quick_cache")
if cachetype != 'SMOKE':

@ -55,7 +55,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
split.prop(field, "type", text="")
if field.type not in ('NONE', 'GUIDE', 'TEXTURE'):
if field.type not in {'NONE', 'GUIDE', 'TEXTURE'}:
split = layout.split(percentage=0.2)
split.label(text="Shape:")
split.prop(field, "shape", text="")
@ -112,7 +112,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
else:
basic_force_field_settings_ui(self, context, field)
if field.type not in ('NONE', 'GUIDE'):
if field.type not in {'NONE', 'GUIDE'}:
layout.label(text="Falloff:")
layout.prop(field, "falloff_type", expand=True)

@ -49,11 +49,11 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
return
row.prop(fluid, "type")
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE', 'FLUID'):
if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}:
row.prop(fluid, "use", text="")
layout = layout.column()
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE', 'FLUID'):
if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}:
layout.active = fluid.use
if fluid.type == 'DOMAIN':

@ -299,13 +299,13 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
col.prop(rd, "use_overwrite")
col.prop(rd, "use_placeholder")
if file_format in ('AVI_JPEG', 'JPEG'):
if file_format in {'AVI_JPEG', 'JPEG'}:
layout.prop(rd, "file_quality", slider=True)
if file_format == 'PNG':
layout.prop(rd, "file_quality", slider=True, text="Compression")
if file_format in ('OPEN_EXR', 'MULTILAYER'):
if file_format in {'OPEN_EXR', 'MULTILAYER'}:
row = layout.row()
row.prop(rd, "exr_codec", text="Codec")
@ -325,7 +325,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
col.prop(rd, "jpeg2k_preset", text="")
col.prop(rd, "jpeg2k_ycc")
elif file_format in ('CINEON', 'DPX'):
elif file_format in {'CINEON', 'DPX'}:
split = layout.split()
split.label("FIXME: hard coded Non-Linear, Gamma:1.0")
@ -384,7 +384,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
@classmethod
def poll(cls, context):
rd = context.scene.render
return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
return rd.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
def draw(self, context):
layout = self.layout
@ -395,7 +395,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
split = layout.split()
split.prop(rd, "ffmpeg_format")
if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
if rd.ffmpeg_format in {'AVI', 'QUICKTIME', 'MKV', 'OGG'}:
split.prop(rd, "ffmpeg_codec")
else:
split.label()
@ -421,7 +421,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
layout.separator()
# Audio:
if rd.ffmpeg_format not in ('MP3', ):
if rd.ffmpeg_format not in {'MP3'}:
layout.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
split = layout.split()
@ -535,10 +535,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
fps_rate = round(rd.fps / rd.fps_base, 2)
# TODO: Change the following to iterate over existing presets
if (fps_rate in (23.98, 24, 25, 29.97, 30, 50, 59.94, 60)):
custom_framerate = False
else:
custom_framerate = True
custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60})
if custom_framerate == True:
fps_label_text = "Custom (" + str(fps_rate) + " fps)"
@ -547,7 +544,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
sub.menu("RENDER_MT_framerate_presets", text=fps_label_text)
if (bpy.types.RENDER_MT_framerate_presets.bl_label == "Custom") or (custom_framerate == True):
if custom_framerate or (bpy.types.RENDER_MT_framerate_presets.bl_label == "Custom"):
sub.prop(rd, "fps")
sub.prop(rd, "fps_base", text="/")
subrow = sub.row(align=True)
@ -618,7 +615,7 @@ class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel):
if rd.bake_type == 'NORMALS':
layout.prop(rd, "bake_normal_space")
elif rd.bake_type in ('DISPLACEMENT', 'AO'):
elif rd.bake_type in {'DISPLACEMENT', 'AO'}:
layout.prop(rd, "use_bake_normalize")
# col.prop(rd, "bake_aa_mode")

@ -261,13 +261,13 @@ class TEXTURE_PT_wood(TextureTypePanel, bpy.types.Panel):
layout.prop(tex, "wood_type", expand=True)
col = layout.column()
col.active = tex.wood_type in ('RINGNOISE', 'BANDNOISE')
col.active = tex.wood_type in {'RINGNOISE', 'BANDNOISE'}
col.label(text="Noise:")
col.row().prop(tex, "noise_type", text="Type", expand=True)
layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
split.active = tex.wood_type in ('RINGNOISE', 'BANDNOISE')
split.active = tex.wood_type in {'RINGNOISE', 'BANDNOISE'}
col = split.column()
col.prop(tex, "noise_scale", text="Size")
@ -332,7 +332,7 @@ class TEXTURE_PT_blend(TextureTypePanel, bpy.types.Panel):
sub = layout.row()
sub.active = (tex.progression in ('LINEAR', 'QUADRATIC', 'EASING', 'RADIAL'))
sub.active = (tex.progression in {'LINEAR', 'QUADRATIC', 'EASING', 'RADIAL'})
sub.prop(tex, "use_flip_axis", expand=True)
@ -372,7 +372,7 @@ class TEXTURE_PT_image(TextureTypePanel, bpy.types.Panel):
def texture_filter_common(tex, layout):
layout.label(text="Filter:")
layout.prop(tex, "filter_type", text="")
if tex.use_mipmap and tex.filter_type in ('AREA', 'EWA', 'FELINE'):
if tex.use_mipmap and tex.filter_type in {'AREA', 'EWA', 'FELINE'}:
if tex.filter_type == 'FELINE':
layout.prop(tex, "filter_probes", text="Probes")
else:
@ -552,11 +552,11 @@ class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel):
musgrave_type = tex.musgrave_type
col = split.column()
if musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'):
if musgrave_type in {'HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'}:
col.prop(tex, "offset")
if musgrave_type in ('MULTIFRACTAL', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'):
if musgrave_type in {'MULTIFRACTAL', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'}:
col.prop(tex, "noise_intensity", text="Intensity")
if musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'):
if musgrave_type in {'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'}:
col.prop(tex, "gain")
layout.label(text="Noise:")
@ -643,7 +643,7 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel):
vd = tex.voxel_data
layout.prop(vd, "file_format")
if vd.file_format in ('BLENDER_VOXEL', 'RAW_8BIT'):
if vd.file_format in {'BLENDER_VOXEL', 'RAW_8BIT'}:
layout.prop(vd, "filepath")
if vd.file_format == 'RAW_8BIT':
layout.prop(vd, "resolution")
@ -655,7 +655,7 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel):
layout.template_image(tex, "image", tex.image_user, compact=True)
#layout.prop(vd, "frame_duration")
if vd.file_format in ('BLENDER_VOXEL', 'RAW_8BIT'):
if vd.file_format in {'BLENDER_VOXEL', 'RAW_8BIT'}:
layout.prop(vd, "use_still_frame")
row = layout.row()
row.active = vd.use_still_frame
@ -708,9 +708,9 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
col.label(text="Color Source:")
col.prop(pd, "color_source", text="")
if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_VELOCITY'):
if pd.color_source in {'PARTICLE_SPEED', 'PARTICLE_VELOCITY'}:
col.prop(pd, "speed_scale")
if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_AGE'):
if pd.color_source in {'PARTICLE_SPEED', 'PARTICLE_AGE'}:
layout.template_color_ramp(pd, "color_ramp", expand=True)
col = split.column()
@ -818,7 +818,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
layout.prop(tex, "map_mode", expand=True)
row = layout.row()
row.active = tex.map_mode in ('FIXED', 'TILED')
row.active = tex.map_mode in {'FIXED', 'TILED'}
row.prop(tex, "angle")
else:
if isinstance(idblock, bpy.types.Material):
@ -829,7 +829,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
split = layout.split()
col = split.column()
if tex.texture_coords in ('ORCO', 'UV'):
if tex.texture_coords in {'ORCO', 'UV'}:
col.prop(tex, "use_from_dupli")
elif tex.texture_coords == 'OBJECT':
col.prop(tex, "use_from_original")
@ -881,7 +881,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
return sub # XXX, temp. use_map_normal needs to override.
if isinstance(idblock, bpy.types.Material):
if idblock.type in ('SURFACE', 'WIRE'):
if idblock.type in {'SURFACE', 'WIRE'}:
split = layout.split()
col = split.column()
@ -1019,7 +1019,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
row.prop(tex, "bump_method", text="Method")
sub = row.row()
sub.active = tex.bump_method in ('BUMP_DEFAULT', 'BUMP_BEST_QUALITY')
sub.active = tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}
sub.prop(tex, "bump_objectspace", text="Space")

@ -118,7 +118,7 @@ class DOPESHEET_HT_header(bpy.types.Header):
# filters which will work here and are useful (especially for character animation)
dopesheet_filter(layout, context, genericFiltersOnly=True)
if st.mode in ('ACTION', 'SHAPEKEY'):
if st.mode in {'ACTION', 'SHAPEKEY'}:
layout.template_ID(st, "action", new="action.new")
# Grease Pencil mode doesn't need snapping, as it's frame-aligned only
@ -221,7 +221,7 @@ class DOPESHEET_MT_marker(bpy.types.Menu):
layout.operator("marker.rename", text="Rename Marker")
layout.operator("marker.move", text="Grab/Move Marker")
if st.mode in ('ACTION', 'SHAPEKEY') and st.action:
if st.mode in {'ACTION', 'SHAPEKEY'} and st.action:
layout.separator()
layout.prop(st, "show_pose_markers")

@ -143,7 +143,7 @@ class IMAGE_MT_image(bpy.types.Menu):
# only for dirty && specific image types, perhaps
# this could be done in operator poll too
if ima.is_dirty:
if ima.source in ('FILE', 'GENERATED') and ima.type != 'MULTILAYER':
if ima.source in {'FILE', 'GENERATED'} and ima.type != 'MULTILAYER':
layout.operator("image.pack", text="Pack As PNG").as_png = True
layout.separator()
@ -404,7 +404,7 @@ class IMAGE_HT_header(bpy.types.Header):
row = layout.row(align=True)
if ima.type == 'COMPOSITE':
row.operator("image.record_composite", icon='REC')
if ima.type == 'COMPOSITE' and ima.source in ('MOVIE', 'SEQUENCE'):
if ima.type == 'COMPOSITE' and ima.source in {'MOVIE', 'SEQUENCE'}:
row.operator("image.play_composite", icon='PLAY')
if show_uvedit or sima.use_image_paint:

@ -72,7 +72,7 @@ class OUTLINER_MT_view(bpy.types.Menu):
space = context.space_data
col = layout.column()
if space.display_mode not in ('DATABLOCKS', 'USER_PREFERENCES', 'KEYMAPS'):
if space.display_mode not in {'DATABLOCKS', 'USER_PREFERENCES', 'KEYMAPS'}:
col.prop(space, "show_restrict_columns")
col.separator()
col.operator("outliner.show_active")

@ -387,11 +387,11 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
if not strip:
return False
return strip.type in ('ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
return strip.type in {'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
'MULTICAM')
'MULTICAM'}
def draw(self, context):
layout = self.layout
@ -417,7 +417,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
col = layout.column()
col.prop(strip, "blur_width", slider=True)
if strip.transition_type in ('SINGLE', 'DOUBLE'):
if strip.transition_type in {'SINGLE', 'DOUBLE'}:
col.prop(strip, "angle")
elif strip.type == 'GLOW':
@ -463,7 +463,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
col = layout.column(align=True)
if strip.type == 'SPEED':
col.prop(strip, "multiply_speed")
elif strip.type in ('CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'):
elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
col.prop(strip, "use_default_fade", "Default fade")
if not strip.use_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
@ -525,12 +525,12 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
if not strip:
return False
return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META',
return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM', 'SPEED')
'MULTICAM', 'SPEED'}
def draw(self, context):
layout = self.layout
@ -675,12 +675,12 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
if not strip:
return False
return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META',
return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM', 'SPEED')
'MULTICAM', 'SPEED'}
def draw(self, context):
layout = self.layout
@ -737,7 +737,7 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
if not strip:
return False
return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM')
return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM'}
def draw_header(self, context):
strip = act_strip(context)

@ -993,7 +993,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
module_names = {mod.__name__ for mod, info in addons}
missing_modules = {ext for ext in used_ext if ext not in module_names}
if missing_modules and filter in ("All", "Enabled"):
if missing_modules and filter in {"All", "Enabled"}:
col.column().separator()
col.column().label(text="Missing script files")

@ -292,7 +292,7 @@ class InputKeyMapPanel(bpy.types.Panel):
box.enabled = km.is_user_defined
if map_type not in ('TEXTINPUT', 'TIMER'):
if map_type not in {'TEXTINPUT', 'TIMER'}:
split = box.split(percentage=0.4)
sub = split.row()

@ -42,13 +42,13 @@ class VIEW3D_HT_header(bpy.types.Header):
sub.menu("VIEW3D_MT_view")
# Select Menu
if mode_string not in ('EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'):
if mode_string not in {'EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
sub.menu("VIEW3D_MT_select_%s" % mode_string.lower())
if edit_object:
sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
elif obj:
if mode_string not in ('PAINT_TEXTURE'):
if mode_string not in {'PAINT_TEXTURE'}:
sub.menu("VIEW3D_MT_%s" % mode_string.lower())
else:
sub.menu("VIEW3D_MT_object")
@ -71,11 +71,11 @@ class VIEW3D_HT_header(bpy.types.Header):
row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True, toggle=True)
# Occlude geometry
if view.viewport_shade in ('SOLID', 'SHADED', 'TEXTURED') and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
if view.viewport_shade in {'SOLID', 'SHADED', 'TEXTURED'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
row.prop(view, "use_occlude_geometry", text="")
# Proportional editing
if obj.mode in ('EDIT', 'PARTICLE_EDIT'):
if obj.mode in {'EDIT', 'PARTICLE_EDIT'}:
row = layout.row(align=True)
row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
if toolsettings.proportional_edit != 'DISABLED':
@ -160,7 +160,7 @@ class VIEW3D_MT_transform(bpy.types.Menu):
layout.separator()
obj = context.object
if obj.type == 'ARMATURE' and obj.mode in ('EDIT', 'POSE') and obj.data.draw_type in ('BBONE', 'ENVELOPE'):
if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and obj.data.draw_type in {'BBONE', 'ENVELOPE'}:
layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
if context.edit_object and context.edit_object.type == 'ARMATURE':
@ -766,7 +766,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
props.data_path_item = "data.dof_distance"
props.input_scale = 0.02
if obj.type in ('CURVE', 'FONT'):
if obj.type in {'CURVE', 'FONT'}:
layout.operator_context = 'INVOKE_REGION_WIN'
props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
@ -794,7 +794,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.energy"
if obj.data.type in ('SPOT', 'AREA', 'POINT'):
if obj.data.type in {'SPOT', 'AREA', 'POINT'}:
props = layout.operator("wm.context_modal_mouse", text="Falloff Distance")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.distance"
@ -1075,7 +1075,7 @@ class VIEW3D_MT_sculpt(bpy.types.Menu):
if sculpt_tool != 'GRAB':
layout.prop_menu_enum(brush, "stroke_method")
if sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
layout.prop_menu_enum(brush, "direction")
if sculpt_tool == 'LAYER':
@ -2002,7 +2002,7 @@ class VIEW3D_PT_view3d_name(bpy.types.Panel):
row.label(text="", icon='OBJECT_DATA')
row.prop(ob, "name", text="")
if ob.type == 'ARMATURE' and ob.mode in ('EDIT', 'POSE'):
if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
bone = context.active_bone
if bone:
row = layout.row()

@ -519,12 +519,12 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
row.prop(brush, "use_pressure_size", toggle=True, text="")
if brush.sculpt_tool not in ('SNAKE_HOOK', 'GRAB', 'ROTATE'):
if brush.sculpt_tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}:
col.separator()
row = col.row(align=True)
if brush.use_space and brush.sculpt_tool not in ('SMOOTH'):
if brush.use_space and brush.sculpt_tool not in {'SMOOTH'}:
if brush.use_space_atten:
row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED')
else:
@ -533,26 +533,26 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
row.prop(brush, "strength", text="Strength", slider=True)
row.prop(brush, "use_pressure_strength", text="")
if brush.sculpt_tool not in ('SMOOTH'):
if brush.sculpt_tool not in {'SMOOTH'}:
col.separator()
row = col.row(align=True)
row.prop(brush, "auto_smooth_factor", slider=True)
row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
if brush.sculpt_tool in ('GRAB', 'SNAKE_HOOK'):
if brush.sculpt_tool in {'GRAB', 'SNAKE_HOOK'}:
col.separator()
row = col.row(align=True)
row.prop(brush, "normal_weight", slider=True)
if brush.sculpt_tool in ('CREASE', 'BLOB'):
if brush.sculpt_tool in {'CREASE', 'BLOB'}:
col.separator()
row = col.row(align=True)
row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
if brush.sculpt_tool not in ('PINCH', 'INFLATE', 'SMOOTH'):
if brush.sculpt_tool not in {'PINCH', 'INFLATE', 'SMOOTH'}:
row = col.row(align=True)
col.separator()
@ -564,8 +564,8 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
row.prop(brush, "sculpt_plane", text="")
#if brush.sculpt_tool in ('CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'):
if brush.sculpt_tool in ('CLAY', 'FLATTEN', 'FILL', 'SCRAPE'):
#if brush.sculpt_tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}:
if brush.sculpt_tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}:
row = col.row(align=True)
row.prop(brush, "plane_offset", slider=True)
row.prop(brush, "use_offset_pressure", text="")
@ -590,7 +590,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
col.separator()
col.row().prop(brush, "direction", expand=True)
if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'):
if brush.sculpt_tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}:
col.separator()
col.prop(brush, "use_accumulate")
@ -632,7 +632,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
col.prop(brush, "blend", text="Blend")
col = layout.column()
col.active = (brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'))
col.active = (brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'})
col.prop(brush, "use_alpha")
# Weight Paint Mode #
@ -709,32 +709,32 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
col.separator()
col = layout.column()
col.active = tex_slot.map_mode in ('FIXED', )
col.active = tex_slot.map_mode in {'FIXED'}
col.label(text="Angle:")
col = layout.column()
if not brush.use_anchor and brush.sculpt_tool not in ('GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE') and tex_slot.map_mode in ('FIXED'):
if not brush.use_anchor and brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'} and tex_slot.map_mode in {'FIXED'}:
col.prop(brush, "texture_angle_source_random", text="")
else:
col.prop(brush, "texture_angle_source_no_random", text="")
#row = col.row(align=True)
#row.label(text="Angle:")
#row.active = tex_slot.map_mode in ('FIXED', 'TILED')
#row.active = tex_slot.map_mode in {'FIXED', 'TILED'}
#row = col.row(align=True)
#col = row.column()
#col.active = tex_slot.map_mode in ('FIXED')
#col.active = tex_slot.map_mode in {'FIXED'}
#col.prop(brush, "use_rake", toggle=True, icon='PARTICLEMODE', text="")
col = layout.column()
col.prop(tex_slot, "angle", text="")
col.active = tex_slot.map_mode in ('FIXED', 'TILED')
col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
#col = layout.column()
#col.prop(brush, "use_random_rotation")
#col.active = (not brush.use_rake) and (not brush.use_anchor) and brush.sculpt_tool not in ('GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE') and tex_slot.map_mode in ('FIXED')
#col.active = (not brush.use_rake) and (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'}) and tex_slot.map_mode in {'FIXED'}
split = layout.split()
@ -754,7 +754,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
row = col.row(align=True)
row.label(text="Overlay:")
row.active = tex_slot.map_mode in ('FIXED', 'TILED')
row.active = tex_slot.map_mode in {'FIXED', 'TILED'}
row = col.row(align=True)
@ -765,11 +765,11 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
else:
col.prop(brush, "use_texture_overlay", toggle=True, text="", icon='MUTE_IPO_ON')
col.active = tex_slot.map_mode in ('FIXED', 'TILED')
col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
col = row.column()
col.prop(brush, "texture_overlay_alpha", text="Alpha")
col.active = tex_slot.map_mode in ('FIXED', 'TILED') and brush.use_texture_overlay
col.active = tex_slot.map_mode in {'FIXED', 'TILED'} and brush.use_texture_overlay
class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
@ -850,7 +850,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
row.active = brush.use_space
row.prop(brush, "spacing", text="Spacing")
if brush.sculpt_tool not in ('GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE') and (not brush.use_anchor) and (not brush.use_restore_mesh):
if (brush.sculpt_tool not in {'GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE'}) and (not brush.use_anchor) and (not brush.use_restore_mesh):
col = layout.column()
col.separator()
@ -889,7 +889,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
col.separator()
col = layout.column()
col.active = (not brush.use_anchor) and (brush.sculpt_tool not in ('GRAB', 'THUMB', 'ROTATE', 'SNAKE_HOOK'))
col.active = (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'THUMB', 'ROTATE', 'SNAKE_HOOK'})
row = col.row()
row.prop(brush, "use_space")
@ -1022,8 +1022,8 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
col = layout.column()
if context.sculpt_object and context.tool_settings.sculpt:
#if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'):
if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'):
#if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'}:
if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'}:
col.prop(brush, "cursor_color_add", text="Add Color")
col.prop(brush, "cursor_color_subtract", text="Subtract Color")
else: