Keymap: 3D view pref for tab to show pie menu
authorCampbell Barton <ideasman42@gmail.com>
Wed, 21 Nov 2018 21:12:39 +0000 (08:12 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 21 Nov 2018 21:14:20 +0000 (08:14 +1100)
This behaves like the 2.7x pie menu add-on,
for users who prefer single-key access to all modes.

release/scripts/presets/keyconfig/blender.py
release/scripts/presets/keyconfig/keymap_data/blender_default.py

index c750800ae4f9ea539b305abe399e6ddc04868a47..e7b4c699be7714a5760ec345fcfdac773a490289 100644 (file)
@@ -55,17 +55,31 @@ class Prefs(bpy.types.KeyConfigPreferences):
         update=update_fn,
     )
 
+    use_v3d_tab_menu: BoolProperty(
+        name="Tab for Pie Menu",
+        description=(
+            "Causes tab to open pie menu (swaps 'Tab' / 'Ctrl-Tab')"
+        ),
+        default=False,
+        update=update_fn,
+    )
+
     def draw(self, layout):
         split = layout.split()
         col = split.column(align=True)
         col.label(text="Select With:")
         col.row().prop(self, "select_mouse", expand=True)
+        col.prop(self, "use_select_all_toggle")
 
         col = split.column(align=True)
         col.label(text="Spacebar Action:")
         col.row().prop(self, "spacebar_action", expand=True)
 
-        layout.prop(self, "use_select_all_toggle")
+        split = layout.split()
+        col = split.column()
+        col.label(text="3D View:")
+        col.prop(self, "use_v3d_tab_menu")
+        split.column()
 
 
 blender_default = bpy.utils.execfile(os.path.join(dirname, "keymap_data", "blender_default.py"))
@@ -82,6 +96,7 @@ def load():
             select_mouse=kc_prefs.select_mouse,
             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,
         ),
     )
     keyconfig_init_from_data(kc, keyconfig_data)
index fa3e88f74d3a29d65608d404b1b883828beec493..461bed432bc4bf9df4ac54cd94f19a0188ca7bef 100644 (file)
@@ -41,6 +41,8 @@ class Params:
         "spacebar_action",
         # Key toggles selection with 'A'.
         "use_select_all_toggle",
+        # Use pie menu for tab by default (swap 'Tab/Ctrl-Tab').
+        "use_v3d_tab_menu",
     )
 
     def __init__(
@@ -52,6 +54,8 @@ class Params:
             # User preferences.
             spacebar_action='TOOL',
             use_select_all_toggle=False,
+            use_pie_on_tab=False,
+            use_v3d_tab_menu=False,
     ):
         import platform
 
@@ -93,6 +97,7 @@ class Params:
         # User preferences
         self.spacebar_action = spacebar_action
         self.use_select_all_toggle = use_select_all_toggle
+        self.use_v3d_tab_menu = use_v3d_tab_menu
 
 
 # ------------------------------------------------------------------------------
@@ -4090,11 +4095,19 @@ def km_object_non_modal(params):
         {"items": items},
     )
 
-    items.extend([
-        ("object.mode_set", {"type": 'TAB', "value": 'PRESS'},
-         {"properties": [("mode", 'EDIT'), ("toggle", True)]}),
-        ("view3d.object_mode_pie_or_toggle", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, None),
-    ])
+    if not params.use_v3d_tab_menu:
+        items.extend([
+            ("object.mode_set", {"type": 'TAB', "value": 'PRESS'},
+             {"properties": [("mode", 'EDIT'), ("toggle", True)]}),
+            ("view3d.object_mode_pie_or_toggle", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, None),
+        ])
+    else:
+        # Swap Tab/Ctrl-Tab
+        items.extend([
+            ("object.mode_set", {"type": 'TAB', "value": 'PRESS', "ctrl": True},
+             {"properties": [("mode", 'EDIT'), ("toggle", True)]}),
+            ("view3d.object_mode_pie_or_toggle", {"type": 'TAB', "value": 'PRESS'}, None),
+        ])
 
     if params.legacy:
         items.extend([