[Bf-blender-cvs] [871845b9793] blender-v2.81-release: Fix T70433: No shortcut in tooltip for viewport X-Ray

Campbell Barton noreply at git.blender.org
Tue Oct 15 11:29:48 CEST 2019


Commit: 871845b9793744f635750c830c52cb3f7ed1bcc8
Author: Campbell Barton
Date:   Tue Oct 15 20:27:04 2019 +1100
Branches: blender-v2.81-release
https://developer.blender.org/rB871845b9793744f635750c830c52cb3f7ed1bcc8

Fix T70433: No shortcut in tooltip for viewport X-Ray

While not a bug exactly, it's useful to show the shortcut,
expose the operator in the UI instead of the property.

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

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 7d13c9c4112..137691c10ba 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -707,10 +707,18 @@ class VIEW3D_HT_header(Header):
         row = layout.row()
         row.active = (object_mode == 'EDIT') or (shading.type in {'WIREFRAME', 'SOLID'})
 
-        if shading.type == 'WIREFRAME':
-            row.prop(shading, "show_xray_wireframe", text="", icon='XRAY')
-        else:
-            row.prop(shading, "show_xray", text="", icon='XRAY')
+        # While exposing 'shading.show_xray(_wireframe)' is correct.
+        # this hides the key shortcut from users: T70433.
+        row.operator(
+            "view3d.toggle_xray",
+            text="",
+            icon='XRAY',
+            depress=getattr(
+                shading,
+                "show_xray_wireframe" if shading.type == 'WIREFRAME' else
+                "show_xray"
+            ),
+        )
 
         row = layout.row(align=True)
         row.prop(shading, "type", text="", expand=True)



More information about the Bf-blender-cvs mailing list