Cleanup: logical checks in UI scripts
This commit is contained in:
@@ -199,8 +199,8 @@ class MASK_PT_point:
|
||||
tracks_list = "tracks" if parent.type == 'POINT_TRACK' else "plane_tracks"
|
||||
|
||||
if parent.parent in tracking.objects:
|
||||
object = tracking.objects[parent.parent]
|
||||
col.prop_search(parent, "sub_parent", object,
|
||||
ob = tracking.objects[parent.parent]
|
||||
col.prop_search(parent, "sub_parent", ob,
|
||||
tracks_list, icon='ANIM_DATA', text="Track")
|
||||
else:
|
||||
col.prop_search(parent, "sub_parent", tracking,
|
||||
|
||||
@@ -309,7 +309,7 @@ class OBJECT_PT_instancing(ObjectButtonsPanel, Panel):
|
||||
col = layout.column()
|
||||
col.prop(ob, "instance_collection", text="Collection")
|
||||
|
||||
if ob.instance_type != 'NONE' or len(ob.particle_systems):
|
||||
if ob.instance_type != 'NONE' or ob.particle_systems:
|
||||
col = flow.column(align=True)
|
||||
col.prop(ob, "show_instancer_for_viewport")
|
||||
col.prop(ob, "show_instancer_for_render")
|
||||
|
||||
@@ -365,7 +365,7 @@ def brush_basic_sculpt_settings(layout, context, brush, *, compact=False):
|
||||
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
||||
|
||||
# direction
|
||||
if capabilities.has_direction == False:
|
||||
if not capabilities.has_direction:
|
||||
layout.row().prop(brush, "direction", expand=True, **({"text": ""} if compact else {}))
|
||||
|
||||
|
||||
|
||||
@@ -488,7 +488,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, Panel):
|
||||
if psys.settings.is_fluid:
|
||||
return False
|
||||
phystype = psys.settings.physics_type
|
||||
if phystype == 'NO' or phystype == 'KEYED':
|
||||
if phystype in {'NO', 'KEYED'}:
|
||||
return False
|
||||
return (
|
||||
psys.settings.type in {'EMITTER', 'REACTOR'} or (
|
||||
@@ -691,10 +691,7 @@ class PARTICLE_PT_physics_fluid_advanced(ParticleButtonsPanel, Panel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
part = particle_get_settings(context)
|
||||
if part.physics_type == 'FLUID':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return part.physics_type == 'FLUID'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -740,10 +737,7 @@ class PARTICLE_PT_physics_fluid_springs(ParticleButtonsPanel, Panel):
|
||||
def poll(cls, context):
|
||||
part = particle_get_settings(context)
|
||||
fluid = part.fluid
|
||||
if part.physics_type == 'FLUID' and fluid.solver == 'DDR':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return part.physics_type == 'FLUID' and fluid.solver == 'DDR'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -767,10 +761,7 @@ class PARTICLE_PT_physics_fluid_springs_viscoelastic(ParticleButtonsPanel, Panel
|
||||
def poll(cls, context):
|
||||
part = particle_get_settings(context)
|
||||
fluid = part.fluid
|
||||
if part.physics_type == 'FLUID' and fluid.solver == 'DDR':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return part.physics_type == 'FLUID' and fluid.solver == 'DDR'
|
||||
|
||||
def draw_header(self, context):
|
||||
part = particle_get_settings(context)
|
||||
@@ -806,10 +797,7 @@ class PARTICLE_PT_physics_fluid_springs_advanced(ParticleButtonsPanel, Panel):
|
||||
def poll(cls, context):
|
||||
part = particle_get_settings(context)
|
||||
fluid = part.fluid
|
||||
if part.physics_type == 'FLUID' and fluid.solver == 'DDR':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return part.physics_type == 'FLUID' and fluid.solver == 'DDR'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@@ -975,7 +975,7 @@ class IMAGE_PT_paint_color(Panel, ImagePaintPanel):
|
||||
settings = context.tool_settings.image_paint
|
||||
brush = settings.brush
|
||||
|
||||
layout.active = brush.use_gradient == False
|
||||
layout.active = not brush.use_gradient
|
||||
|
||||
brush_texpaint_common_color(self, context, layout, brush, settings, True)
|
||||
|
||||
|
||||
@@ -658,7 +658,7 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
|
||||
row.label(text=iface_("Final Length: %s") % bpy.utils.smpte_from_frame(strip.frame_final_duration),
|
||||
translate=False)
|
||||
row = col.row(align=True)
|
||||
row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
|
||||
row.active = strip.frame_start <= frame_current <= strip.frame_start + strip.frame_duration
|
||||
row.label(text=iface_("Playhead: %d") % (frame_current - strip.frame_start), translate=False)
|
||||
|
||||
col.label(text=iface_("Frame Offset %d:%d") % (strip.frame_offset_start, strip.frame_offset_end),
|
||||
|
||||
@@ -43,7 +43,6 @@ class VIEW3D_HT_tool_header(Header):
|
||||
|
||||
layout.row(align=True).template_header()
|
||||
|
||||
view = context.space_data
|
||||
# mode_string = context.mode
|
||||
obj = context.active_object
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
@@ -404,7 +404,7 @@ class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel):
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
layout.active = brush.use_gradient == False
|
||||
layout.active = not brush.use_gradient
|
||||
|
||||
brush_texpaint_common_color(self, context, layout, brush, settings, True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user