Keymap: preference for fallback-tool with RMB select

Expose a key-map preference "Fallback Tool (RMB)",
disabled by default.

The right mouse button uses the fallback tool
(currently visible selection tool in the toolbar),
instead of always tweaking.

When any selection tool is active, right mouse always tweaks.

To enable fallback selection on RMB, set the "Right Mouse Select Action"
to "Selection Tool".

Internal changes:

- Add fall-back key-maps, separate key-maps needed for when the tool is
  run as a fall-back. This is needed so RMB-select can support fall-back
  tools, so left-mouse can be used when it's the active tool and RMB
  can be used as a fall-back action when another tool is active.
- Add options field to tools so tools without gizmos can enable the
  full-back tool keymap.
- Support multiple key-maps for keymap handlers.
- Fall-back keymaps now co-exist with the tool-keymaps.
  So both keymaps may be active at once - using different mouse buttons.
  When gizmos are in use, a highlighted gizmo prioritizes the
  tool-keymap over the fall-back keymap.

Resolves T83690.

Reviewed By: JulienKaspar

Ref D12493
This commit is contained in:
2021-09-21 17:55:43 +10:00
parent 52bfa750e7
commit c9d9bfa84a
16 changed files with 523 additions and 214 deletions

View File

@@ -858,6 +858,7 @@ def register_tool(tool_cls, *, after=None, separator=False, group=False):
"description": getattr(tool_cls, "bl_description", tool_cls.__doc__),
"icon": getattr(tool_cls, "bl_icon", None),
"cursor": getattr(tool_cls, "bl_cursor", None),
"options": getattr(tool_cls, "bl_options", None),
"widget": getattr(tool_cls, "bl_widget", None),
"widget_properties": getattr(tool_cls, "bl_widget_properties", None),
"keymap": getattr(tool_cls, "bl_keymap", None),