Cleanup: inline icon conditional

This commit is contained in:
Campbell Barton 2018-08-30 13:47:27 +10:00
parent e9c2477a84
commit 2093b79ee7
5 changed files with 67 additions and 34 deletions

View File

@ -289,10 +289,13 @@ class DATA_PT_camera_background_image(CameraButtonsPanel, Panel):
else:
row.label(text="Not Set")
if bg.show_background_image:
row.prop(bg, "show_background_image", text="", emboss=False, icon='RESTRICT_VIEW_OFF')
else:
row.prop(bg, "show_background_image", text="", emboss=False, icon='RESTRICT_VIEW_ON')
row.prop(
bg,
"show_background_image",
text="",
emboss=False,
icon='RESTRICT_VIEW_OFF' if bg.show_background_image else 'RESTRICT_VIEW_ON',
)
row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i

View File

@ -119,10 +119,20 @@ class PARTICLE_UL_particle_systems(bpy.types.UIList):
layout.prop(psys, "name", text="", emboss=False, icon_value=icon)
if md:
layout.prop(md, "show_render", emboss=False, icon_only=True,
icon='RESTRICT_RENDER_OFF' if md.show_render else 'RESTRICT_RENDER_ON')
layout.prop(md, "show_viewport", emboss=False, icon_only=True,
icon='RESTRICT_VIEW_OFF' if md.show_viewport else 'RESTRICT_VIEW_ON')
layout.prop(
md,
"show_render",
emboss=False,
icon_only=True,
icon='RESTRICT_RENDER_OFF' if md.show_render else 'RESTRICT_RENDER_ON',
)
layout.prop(
md,
"show_viewport",
emboss=False,
icon_only=True,
icon='RESTRICT_VIEW_OFF' if md.show_viewport else 'RESTRICT_VIEW_ON',
)
elif self.layout_type == 'GRID':
layout.alignment = 'CENTER'

View File

@ -43,7 +43,10 @@ class PHYSICS_UL_dynapaint_surfaces(UIList):
if surf.use_color_preview:
row.prop(
surf, "show_preview", text="", emboss=False,
surf,
"show_preview",
text="",
emboss=False,
icon='RESTRICT_VIEW_OFF' if surf.show_preview else 'RESTRICT_VIEW_ON'
)
row.prop(surf, "is_active", text="")

View File

@ -960,10 +960,13 @@ class IMAGE_PT_tools_brush_overlay(BrushButtonsPanel, Panel):
col.label(text="Curve:")
row = col.row(align=True)
if brush.use_cursor_overlay:
row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
else:
row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
row.prop(
brush,
"use_cursor_overlay",
text="",
toggle=True,
icon='RESTRICT_VIEW_OFF' if brush.use_cursor_overlay else 'RESTRICT_VIEW_ON',
)
sub = row.row(align=True)
sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
@ -973,10 +976,13 @@ class IMAGE_PT_tools_brush_overlay(BrushButtonsPanel, Panel):
col.label(text="Texture:")
row = col.row(align=True)
if tex_slot.map_mode != 'STENCIL':
if brush.use_primary_overlay:
row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
else:
row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
row.prop(
brush,
"use_primary_overlay",
text="",
toggle=True,
icon='RESTRICT_VIEW_OFF' if brush.use_primary_overlay else 'RESTRICT_VIEW_ON',
)
sub = row.row(align=True)
sub.prop(brush, "texture_overlay_alpha", text="Alpha")
@ -986,10 +992,13 @@ class IMAGE_PT_tools_brush_overlay(BrushButtonsPanel, Panel):
row = col.row(align=True)
if tex_slot_mask.map_mode != 'STENCIL':
if brush.use_secondary_overlay:
row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
else:
row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
row.prop(
brush,
"use_secondary_overlay",
text="",
toggle=True,
icon='RESTRICT_VIEW_OFF' if brush.use_secondary_overlay else 'RESTRICT_VIEW_ON',
)
sub = row.row(align=True)
sub.prop(brush, "mask_overlay_alpha", text="Alpha")

View File

@ -672,11 +672,13 @@ class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel):
col.label(text="Curve:")
row = col.row(align=True)
if brush.use_cursor_overlay:
row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
else:
row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
row.prop(
brush,
"use_cursor_overlay",
text="",
toggle=True,
icon='RESTRICT_VIEW_OFF' if brush.use_cursor_overlay else 'RESTRICT_VIEW_ON',
)
sub = row.row(align=True)
sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
@ -687,10 +689,13 @@ class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel):
col.label(text="Texture:")
row = col.row(align=True)
if tex_slot.map_mode != 'STENCIL':
if brush.use_primary_overlay:
row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
else:
row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
row.prop(
brush,
"use_primary_overlay",
text="",
toggle=True,
icon='RESTRICT_VIEW_OFF' if brush.use_primary_overlay else 'RESTRICT_VIEW_ON',
)
sub = row.row(align=True)
sub.prop(brush, "texture_overlay_alpha", text="Alpha")
@ -701,10 +706,13 @@ class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel):
row = col.row(align=True)
if tex_slot_mask.map_mode != 'STENCIL':
if brush.use_secondary_overlay:
row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
else:
row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
row.prop(
brush,
"use_secondary_overlay",
text="",
toggle=True,
icon='RESTRICT_VIEW_OFF' if brush.use_secondary_overlay else 'RESTRICT_VIEW_ON',
)
sub = row.row(align=True)
sub.prop(brush, "mask_overlay_alpha", text="Alpha")