Keymap: preference for extended shading menu
authorCampbell Barton <ideasman42@gmail.com>
Sat, 24 Nov 2018 00:24:34 +0000 (11:24 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 24 Nov 2018 00:24:34 +0000 (11:24 +1100)
This brings back the option to have x-ray & overlay toggle.

release/scripts/presets/keyconfig/blender.py
release/scripts/presets/keyconfig/keymap_data/blender_default.py
release/scripts/startup/bl_ui/space_view3d.py

index e7b4c699be7714a5760ec345fcfdac773a490289..eb5444eb77ab96ce6d63ee1da492449eaa2c1483 100644 (file)
@@ -55,6 +55,7 @@ class Prefs(bpy.types.KeyConfigPreferences):
         update=update_fn,
     )
 
+    # 3D View
     use_v3d_tab_menu: BoolProperty(
         name="Tab for Pie Menu",
         description=(
@@ -63,6 +64,14 @@ class Prefs(bpy.types.KeyConfigPreferences):
         default=False,
         update=update_fn,
     )
+    use_v3d_shade_ex_pie: BoolProperty(
+        name="Extra Shading Pie Menu Items",
+        description=(
+            "Show additional options in the shading menu ('Z')"
+        ),
+        default=False,
+        update=update_fn,
+    )
 
     def draw(self, layout):
         split = layout.split()
@@ -75,11 +84,12 @@ class Prefs(bpy.types.KeyConfigPreferences):
         col.label(text="Spacebar Action:")
         col.row().prop(self, "spacebar_action", expand=True)
 
+        layout.label(text="3D View:")
         split = layout.split()
         col = split.column()
-        col.label(text="3D View:")
         col.prop(self, "use_v3d_tab_menu")
-        split.column()
+        col = split.column()
+        col.prop(self, "use_v3d_shade_ex_pie")
 
 
 blender_default = bpy.utils.execfile(os.path.join(dirname, "keymap_data", "blender_default.py"))
@@ -97,6 +107,7 @@ def load():
             spacebar_action=kc_prefs.spacebar_action,
             use_select_all_toggle=kc_prefs.use_select_all_toggle,
             use_v3d_tab_menu=kc_prefs.use_v3d_tab_menu,
+            use_v3d_shade_ex_pie=kc_prefs.use_v3d_shade_ex_pie,
         ),
     )
     keyconfig_init_from_data(kc, keyconfig_data)
index dbc964c84c9410e400bb005c8821d33b194b8384..2b83b03f322f0dee5560724f99acad449387f187 100644 (file)
@@ -43,6 +43,8 @@ class Params:
         "use_select_all_toggle",
         # Use pie menu for tab by default (swap 'Tab/Ctrl-Tab').
         "use_v3d_tab_menu",
+        # Use extended pie menu for shading.
+        "use_v3d_shade_ex_pie"
     )
 
     def __init__(
@@ -56,6 +58,7 @@ class Params:
             use_select_all_toggle=False,
             use_pie_on_tab=False,
             use_v3d_tab_menu=False,
+            use_v3d_shade_ex_pie=False,
     ):
         import platform
 
@@ -98,6 +101,7 @@ class Params:
         self.spacebar_action = spacebar_action
         self.use_select_all_toggle = use_select_all_toggle
         self.use_v3d_tab_menu = use_v3d_tab_menu
+        self.use_v3d_shade_ex_pie = use_v3d_shade_ex_pie
 
 
 # ------------------------------------------------------------------------------
@@ -1035,7 +1039,9 @@ def km_view3d(params):
             op_menu_pie("VIEW3D_MT_orientations_pie", {"type": 'COMMA', "value": 'PRESS'}),
             ("wm.context_toggle", {"type": 'ACCENT_GRAVE', "value": 'PRESS', "ctrl": True},
              {"properties": [("data_path", 'space_data.show_gizmo_tool')]}),
-            op_menu_pie("VIEW3D_MT_shading_pie", {"type": 'Z', "value": 'PRESS'}),
+            op_menu_pie(
+                "VIEW3D_MT_shading_pie" if not params.use_v3d_shade_ex_pie else
+                "VIEW3D_MT_shading_ex_pie", {"type": 'Z', "value": 'PRESS'}),
             ("view3d.toggle_shading", {"type": 'Z', "value": 'PRESS', "shift": True},
              {"properties": [("type", 'WIREFRAME')]}),
             ("view3d.toggle_xray", {"type": 'Z', "value": 'PRESS', "alt": True}, None),
index 119478629447485b632652ad38154102e908eb76..8b4028386fff1a5e3851a0dac43f0654a74e577b 100644 (file)
@@ -3855,6 +3855,35 @@ class VIEW3D_MT_shading_pie(Menu):
         pie.prop_enum(view.shading, "type", value='RENDERED')
 
 
+class VIEW3D_MT_shading_ex_pie(Menu):
+    bl_label = "Shading"
+
+    def draw(self, context):
+        layout = self.layout
+        pie = layout.menu_pie()
+
+        view = context.space_data
+
+        pie.prop_enum(view.shading, "type", value='WIREFRAME')
+
+        xray_active = (
+            (context.mode in {'POSE', 'EDIT_MESH'}) or
+            (view.shading.type in {'SOLID', 'WIREFRAME'})
+        )
+        if xray_active:
+            sub = pie
+        else:
+            sub = pie.row()
+            sub.active = False
+        sub.operator("view3d.toggle_xray", text="Toggle X-Ray", icon='XRAY')
+
+        pie.prop(view.overlay, "show_overlays", text="Toggle Overlays", icon='OVERLAY')
+
+        pie.prop_enum(view.shading, "type", value='SOLID')
+        pie.prop_enum(view.shading, "type", value='MATERIAL')
+        pie.prop_enum(view.shading, "type", value='RENDERED')
+
+
 class VIEW3D_MT_pivot_pie(Menu):
     bl_label = "Pivot Point"
 
@@ -5435,6 +5464,7 @@ classes = (
     VIEW3D_MT_object_mode_pie,
     VIEW3D_MT_view_pie,
     VIEW3D_MT_shading_pie,
+    VIEW3D_MT_shading_ex_pie,
     VIEW3D_MT_pivot_pie,
     VIEW3D_MT_snap_pie,
     VIEW3D_MT_orientations_pie,