[Bf-blender-cvs] [2093b79ee74] blender2.8: Cleanup: inline icon conditional

Campbell Barton noreply at git.blender.org
Thu Aug 30 05:49:40 CEST 2018


Commit: 2093b79ee746b15e5f55d703a1b6de60de940433
Author: Campbell Barton
Date:   Thu Aug 30 13:47:27 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB2093b79ee746b15e5f55d703a1b6de60de940433

Cleanup: inline icon conditional

===================================================================

M	release/scripts/startup/bl_ui/properties_data_camera.py
M	release/scripts/startup/bl_ui/properties_particle.py
M	release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
M	release/scripts/startup/bl_ui/space_image.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index 130264bb91d..0ecce3b2f78 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -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
 
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index ffc0c6830c6..ff8aeb3106b 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -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'
diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
index ff2ced7704f..9228c40e13b 100644
--- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
+++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
@@ -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="")
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 8e163f86dc5..95c7072f14a 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -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")
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 2c29061cca6..6915129ef2c 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -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")



More information about the Bf-blender-cvs mailing list