Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-09-21 10:55:43 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-09-21 11:14:11 +0300
commitc9d9bfa84ad5cb985e3feccffa702b2f3cc2adf8 (patch)
tree9cefe8d45141127b71d11812e4023ae185f06271 /release/scripts/startup/bl_ui/space_toolsystem_common.py
parent52bfa750e74952ddd4e8223d92d21140831902a7 (diff)
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
Diffstat (limited to 'release/scripts/startup/bl_ui/space_toolsystem_common.py')
-rw-r--r--release/scripts/startup/bl_ui/space_toolsystem_common.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index 28549098e51..1c3dbded083 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -118,6 +118,8 @@ ToolDef = namedtuple(
"draw_settings",
# Optional draw cursor.
"draw_cursor",
+ # Various options, see: `bpy.types.WorkSpaceTool.setup` options argument.
+ "options",
)
)
del namedtuple
@@ -133,6 +135,7 @@ def from_dict(kw_args):
"description": None,
"icon": None,
"cursor": None,
+ "options": None,
"widget": None,
"widget_properties": None,
"keymap": None,
@@ -536,6 +539,7 @@ class ToolSelectPanelHelper:
visited.add(km_name)
yield (km_name, cls.bl_space_type, 'WINDOW', [])
+ yield (km_name + " (fallback)", cls.bl_space_type, 'WINDOW', [])
# -------------------------------------------------------------------------
# Layout Generators
@@ -988,16 +992,22 @@ def _activate_by_item(context, space_type, item, index, *, as_fallback=False):
gizmo_group = item.widget or ""
+ idname_fallback = (item_fallback and item_fallback.idname) or ""
+ keymap_fallback = (item_fallback and item_fallback.keymap and item_fallback.keymap[0]) or ""
+ if keymap_fallback:
+ keymap_fallback = keymap_fallback + " (fallback)"
+
tool.setup(
idname=item.idname,
keymap=item.keymap[0] if item.keymap is not None else "",
cursor=item.cursor or 'DEFAULT',
+ options=item.options or set(),
gizmo_group=gizmo_group,
data_block=item.data_block or "",
operator=item.operator or "",
index=index,
- idname_fallback=(item_fallback and item_fallback.idname) or "",
- keymap_fallback=(item_fallback and item_fallback.keymap and item_fallback.keymap[0]) or "",
+ idname_fallback=idname_fallback,
+ keymap_fallback=keymap_fallback,
)
if (