Keymap: preference for extended shading menu

This brings back the option to have x-ray & overlay toggle.
This commit is contained in:
Campbell Barton 2018-11-24 11:24:34 +11:00
parent 1e820898ff
commit 31e3b7790a
3 changed files with 50 additions and 3 deletions

@ -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)

@ -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),

@ -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,