[Bf-blender-cvs] [d8830048f7a] blender-v2.82-release: Keymap: preference for relative/absolute Alt-MMB navigation

Campbell Barton noreply at git.blender.org
Fri Feb 7 03:50:40 CET 2020


Commit: d8830048f7ae9a9d2763111f062aeafba07069bc
Author: Campbell Barton
Date:   Fri Feb 7 13:13:13 2020 +1100
Branches: blender-v2.82-release
https://developer.blender.org/rBd8830048f7ae9a9d2763111f062aeafba07069bc

Keymap: preference for relative/absolute Alt-MMB navigation

Original request from Hjalti was to set absolute view axis,
so make this an option.

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

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

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

diff --git a/release/scripts/presets/keyconfig/blender.py b/release/scripts/presets/keyconfig/blender.py
index 11cd76335f1..8cbbb900154 100644
--- a/release/scripts/presets/keyconfig/blender.py
+++ b/release/scripts/presets/keyconfig/blender.py
@@ -108,6 +108,22 @@ class Prefs(bpy.types.KeyConfigPreferences):
         update=update_fn,
     )
 
+    v3d_alt_mmb_drag_action: EnumProperty(
+        name="Alt-MMB Drag Action",
+        items=(
+            ('RELATIVE', "Relative",
+             "Set the view axis where each mouse direction maps to an axis relative to the current orientation",
+             0),
+            ('ABSOLUTE', "Absolute",
+             "Set the view axis where each mouse direction always maps to the same axis",
+             1),
+        ),
+        description=(
+            "Action when Alt-MMB dragging in the 3D viewport"
+        ),
+        update=update_fn,
+    )
+
     # Developer note, this is an experemental option.
     use_pie_click_drag: BoolProperty(
         name="Pie Menu on Drag",
@@ -149,10 +165,12 @@ class Prefs(bpy.types.KeyConfigPreferences):
         col = split.column()
         col.prop(self, "use_v3d_tab_menu")
         col.prop(self, "use_pie_click_drag")
+        col.prop(self, "use_v3d_shade_ex_pie")
         col = split.column()
         col.label(text="Tilde Action:")
         col.row().prop(self, "v3d_tilde_action", expand=True)
-        col.prop(self, "use_v3d_shade_ex_pie")
+        col.label(text="Alt Middle Mouse Drag Action:")
+        col.row().prop(self, "v3d_alt_mmb_drag_action", expand=True)
 
 
 blender_default = bpy.utils.execfile(os.path.join(DIRNAME, "keymap_data", "blender_default.py"))
@@ -176,6 +194,7 @@ def load():
             ),
             spacebar_action=kc_prefs.spacebar_action,
             v3d_tilde_action=kc_prefs.v3d_tilde_action,
+            v3d_alt_mmb_drag_action=kc_prefs.v3d_alt_mmb_drag_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,
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 8b398d1541c..bfd0066e66d 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -53,6 +53,8 @@ class Params:
         # Experimental option.
         "use_pie_click_drag",
         "v3d_tilde_action",
+        # Alt-MMB axis switching 'RELATIVE' or 'ABSOLUTE' axis switching.
+        "v3d_alt_mmb_drag_action",
     )
 
     def __init__(
@@ -70,6 +72,7 @@ class Params:
             use_v3d_shade_ex_pie=False,
             use_pie_click_drag=False,
             v3d_tilde_action='VIEW',
+            v3d_alt_mmb_drag_action='RELATIVE',
     ):
         from sys import platform
         self.apple = (platform == 'darwin')
@@ -117,6 +120,7 @@ class Params:
         self.use_v3d_tab_menu = use_v3d_tab_menu
         self.use_v3d_shade_ex_pie = use_v3d_shade_ex_pie
         self.v3d_tilde_action = v3d_tilde_action
+        self.v3d_alt_mmb_drag_action = v3d_alt_mmb_drag_action
 
         self.use_pie_click_drag = use_pie_click_drag
         if not use_pie_click_drag:
@@ -1040,14 +1044,25 @@ def km_view3d(params):
          {"properties": [("type", 'LEFT'), ("align_active", True)]}),
         ("view3d.view_axis", {"type": 'NUMPAD_7', "value": 'PRESS', "shift": True, "ctrl": True},
          {"properties": [("type", 'BOTTOM'), ("align_active", True)]}),
-        ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'NORTH', "alt": True},
-         {"properties": [("type", 'TOP'), ("relative", True)]}),
-        ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'SOUTH', "alt": True},
-         {"properties": [("type", 'BOTTOM'), ("relative", True)]}),
-        ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'EAST', "alt": True},
-         {"properties": [("type", 'RIGHT'), ("relative", True)]}),
-        ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'WEST', "alt": True},
-         {"properties": [("type", 'LEFT'), ("relative", True)]}),
+        *((
+            ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'NORTH', "alt": True},
+             {"properties": [("type", 'TOP'), ("relative", True)]}),
+            ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'SOUTH', "alt": True},
+             {"properties": [("type", 'BOTTOM'), ("relative", True)]}),
+            ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'EAST', "alt": True},
+             {"properties": [("type", 'RIGHT'), ("relative", True)]}),
+            ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'WEST', "alt": True},
+             {"properties": [("type", 'LEFT'), ("relative", True)]}),
+        ) if params.v3d_alt_mmb_drag_action == 'RELATIVE' else (
+            ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'NORTH', "alt": True},
+             {"properties": [("type", 'TOP')]}),
+            ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'SOUTH', "alt": True},
+             {"properties": [("type", 'BOTTOM')]}),
+            ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'EAST', "alt": True},
+             {"properties": [("type", 'RIGHT')]}),
+            ("view3d.view_axis", {"type": 'EVT_TWEAK_M', "value": 'WEST', "alt": True},
+             {"properties": [("type", 'LEFT')]}),
+        )),
         ("view3d.view_center_pick", {"type": 'MIDDLEMOUSE', "value": 'CLICK', "alt": True}, None),
         ("view3d.ndof_orbit_zoom", {"type": 'NDOF_MOTION', "value": 'ANY'}, None),
         ("view3d.ndof_orbit", {"type": 'NDOF_MOTION', "value": 'ANY', "ctrl": True}, None),



More information about the Bf-blender-cvs mailing list