[Bf-blender-cvs] [ced4dfa3491] master: Cleanup: Toggle X-Ray button, removed nested ternary operators

Sybren A. Stüvel noreply at git.blender.org
Mon May 11 13:04:15 CEST 2020


Commit: ced4dfa3491e31273f40670b04c636a9cb646b27
Author: Sybren A. Stüvel
Date:   Mon May 11 13:02:11 2020 +0200
Branches: master
https://developer.blender.org/rBced4dfa3491e31273f40670b04c636a9cb646b27

Cleanup: Toggle X-Ray button, removed nested ternary operators

Replaced two nested ternary operators combined with dynamic attribute
access, with a simple `if`/`elif`/`else` construct.

No functional changes.

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

M	release/scripts/startup/bl_ui/space_view3d.py

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 926219ed207..c5311b67496 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -829,18 +829,17 @@ class VIEW3D_HT_header(Header):
 
         # While exposing 'shading.show_xray(_wireframe)' is correct.
         # this hides the key shortcut from users: T70433.
+        if has_pose_mode:
+            draw_depressed = overlay.show_xray_bone
+        elif shading.type == 'WIREFRAME':
+            draw_depressed = shading.show_xray_wireframe
+        else:
+            draw_depressed = shading.show_xray
         row.operator(
             "view3d.toggle_xray",
             text="",
             icon='XRAY',
-            depress=(
-                overlay.show_xray_bone if has_pose_mode else
-                getattr(
-                    shading,
-                    "show_xray_wireframe" if shading.type == 'WIREFRAME' else
-                    "show_xray"
-                )
-            ),
+            depress=draw_depressed,
         )
 
         row = layout.row(align=True)



More information about the Bf-blender-cvs mailing list