[Bf-blender-cvs] [32ffb858d6d] master: Keymap: resolve conflict with use_alt_cursor/Ctrl-LMB to add/extrude

Campbell Barton noreply at git.blender.org
Mon Sep 27 13:05:26 CEST 2021


Commit: 32ffb858d6da920926fcd37a6720d2a7b408e04b
Author: Campbell Barton
Date:   Mon Sep 27 18:06:17 2021 +1000
Branches: master
https://developer.blender.org/rB32ffb858d6da920926fcd37a6720d2a7b408e04b

Keymap: resolve conflict with use_alt_cursor/Ctrl-LMB to add/extrude

While the option allows tools be be activated on press instead of tweak,
this meant box-select was catching Ctrl-LMB which is also used for
add/extrude in edit mode.

Resolve this by always using tweak for selection tools,
only supporting activation on press for other tools.

Note that this doesn't impact the default configuration.

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

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

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

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 56ff776ea48..41b5d6f7998 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -76,7 +76,14 @@ class Params:
         "select_mouse_value_fallback",
         # Shorthand for: `('CLICK_DRAG' if params.use_pie_click_drag else 'PRESS')`
         "pie_value",
+        # Shorthand for: `{"type": params.tool_tweak, "value": 'ANY'}`.
+        "tool_tweak_event",
         # Shorthand for: `{"type": params.tool_maybe_tweak, "value": params.tool_maybe_tweak_value}`.
+        #
+        # NOTE: This is typically used for active tool key-map items however it should never
+        # be used for selection tools (the default box-select tool for example).
+        # Since this means with RMB select enabled in edit-mode for e.g.
+        # `Ctrl-LMB` would be caught by box-select instead of add/extrude.
         "tool_maybe_tweak_event",
     )
 
@@ -187,6 +194,7 @@ class Params:
         self.use_fallback_tool_rmb = self.use_fallback_tool if self.select_mouse == 'RIGHT' else False
         self.select_mouse_value_fallback = 'CLICK' if self.use_fallback_tool_rmb else self.select_mouse_value
         self.pie_value = 'CLICK_DRAG' if use_pie_click_drag else 'PRESS'
+        self.tool_tweak_event = {"type": self.tool_tweak, "value": 'ANY'}
         self.tool_maybe_tweak_event = {"type": self.tool_maybe_tweak, "value": self.tool_maybe_tweak_value}
 
 
@@ -6128,12 +6136,9 @@ def km_image_editor_tool_uv_cursor(params):
         "Image Editor Tool: Uv, Cursor",
         {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
         {"items": [
-            ("uv.cursor_set",
-             {"type": params.tool_mouse, "value": 'PRESS'},
-             None),
+            ("uv.cursor_set", {"type": params.tool_mouse, "value": 'PRESS'}, None),
             # Don't use `tool_maybe_tweak_event` since it conflicts with `PRESS` that places the cursor.
-            ("transform.translate",
-             {"type": params.tool_tweak, "value": 'ANY'},
+            ("transform.translate", params.tool_tweak_event,
              {"properties": [("release_confirm", True), ("cursor_transform", True)]}),
         ]},
     )
@@ -6158,7 +6163,8 @@ def km_image_editor_tool_uv_select_box(params, *, fallback):
         {"items": [
             *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple(
                 "uv.select_box",
-                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_maybe_tweak_event))),
+                # Don't use `tool_maybe_tweak_event`, see comment for this slot.
+                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_tweak_event))),
             *_template_uv_select_for_fallback(params, fallback),
         ]},
     )
@@ -6187,7 +6193,7 @@ def km_image_editor_tool_uv_select_lasso(params, *, fallback):
         {"items": [
             *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions_simple(
                 "uv.select_lasso",
-                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_maybe_tweak_event))),
+                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_tweak_event))),
             *_template_uv_select_for_fallback(params, fallback),
         ]},
     )
@@ -6324,7 +6330,7 @@ def km_3d_view_tool_cursor(params):
         {"items": [
             ("view3d.cursor3d", {"type": params.tool_mouse, "value": 'PRESS'}, None),
             # Don't use `tool_maybe_tweak_event` since it conflicts with `PRESS` that places the cursor.
-            ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'},
+            ("transform.translate", params.tool_tweak_event,
              {"properties": [("release_confirm", True), ("cursor_transform", True)]}),
         ]},
     )
@@ -6350,7 +6356,8 @@ def km_3d_view_tool_select_box(params, *, fallback):
         {"items": [
             *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions(
                 "view3d.select_box",
-                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_maybe_tweak_event))),
+                # Don't use `tool_maybe_tweak_event`, see comment for this slot.
+                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_tweak_event))),
             *_template_view3d_select_for_fallback(params, fallback),
         ]},
     )
@@ -6380,7 +6387,7 @@ def km_3d_view_tool_select_lasso(params, *, fallback):
         {"items": [
             *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions(
                 "view3d.select_lasso",
-                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_maybe_tweak_event))),
+                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_tweak_event))),
             *_template_view3d_select_for_fallback(params, fallback),
         ]}
     )
@@ -7035,10 +7042,8 @@ def km_3d_view_tool_sculpt_mask_by_color(params):
         "3D View Tool: Sculpt, Mask by Color",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
         {"items": [
-            ("sculpt.mask_by_color", {"type": params.tool_mouse, "value": 'ANY'},
-             None),
-            ("sculpt.mask_by_color", {"type": params.tool_tweak, "value": 'ANY'},
-             None),
+            ("sculpt.mask_by_color", {"type": params.tool_mouse, "value": 'ANY'}, None),
+            ("sculpt.mask_by_color", params.tool_tweak_event, None),
         ]},
     )
 
@@ -7048,8 +7053,7 @@ def km_3d_view_tool_sculpt_face_set_edit(params):
         "3D View Tool: Sculpt, Face Set Edit",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
         {"items": [
-            ("sculpt.face_set_edit", {"type": params.tool_mouse, "value": 'PRESS'},
-             None),
+            ("sculpt.face_set_edit", {"type": params.tool_mouse, "value": 'PRESS'}, None),
         ]},
     )
 
@@ -7238,7 +7242,8 @@ def km_3d_view_tool_edit_gpencil_select_box(params, *, fallback):
         {"items": [
             *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions(
                 "gpencil.select_box",
-                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_maybe_tweak_event))),
+                # Don't use `tool_maybe_tweak_event`, see comment for this slot.
+                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_tweak_event))),
             *_template_view3d_gpencil_select_for_fallback(params, fallback),
         ]},
     )
@@ -7268,7 +7273,7 @@ def km_3d_view_tool_edit_gpencil_select_lasso(params, *, fallback):
         {"items": [
             *([] if (fallback and not params.use_fallback_tool) else _template_items_tool_select_actions(
                 "gpencil.select_lasso",
-                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_maybe_tweak_event))),
+                **({"type": params.select_tweak, "value": 'ANY'} if fallback else params.tool_tweak_event))),
             *_template_view3d_gpencil_select_for_fallback(params, fallback),
         ]}
     )
@@ -7367,7 +7372,7 @@ def km_3d_view_tool_sculpt_gpencil_select_box(params):
     return (
         "3D View Tool: Sculpt Gpencil, Select Box",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
-        {"items": _template_items_tool_select_actions("gpencil.select_box", **params.tool_maybe_tweak_event)},
+        {"items": _template_items_tool_select_actions("gpencil.select_box", **params.tool_tweak_event)},
     )
 
 
@@ -7386,7 +7391,7 @@ def km_3d_view_tool_sculpt_gpencil_select_lasso(params):
     return (
         "3D View Tool: Sculpt Gpencil, Select Lasso",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
-        {"items": _template_items_tool_select_actions("gpencil.select_lasso", **params.tool_maybe_tweak_event)},
+        {"items": _template_items_tool_select_actions("gpencil.select_lasso", **params.tool_tweak_event)},
     )
 
 
@@ -7408,8 +7413,9 @@ def km_sequencer_editor_tool_select_box(params, *, fallback):
         _fallback_id("Sequencer Tool: Select Box", fallback),
         {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'},
         {"items": [
+            # Don't use `tool_maybe_tweak_event`, see comment for this slot.
             *_template_items_tool_select_actions_simple(
-                "sequencer.select_box", **params.tool_maybe_tweak_event,
+                "sequencer.select_box", **params.tool_tweak_event,
                 properties=[("tweak", params.select_mouse == 'LEFTMOUSE')],
             ),
             # RMB select can already set the frame, match the tweak tool.



More information about the Bf-blender-cvs mailing list