diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-09-21 10:55:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-09-21 11:14:11 +0300 |
commit | c9d9bfa84ad5cb985e3feccffa702b2f3cc2adf8 (patch) | |
tree | 9cefe8d45141127b71d11812e4023ae185f06271 /source/blender/makesrna | |
parent | 52bfa750e74952ddd4e8223d92d21140831902a7 (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 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_workspace_api.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c index a2bb89dd5ee..15230f1198b 100644 --- a/source/blender/makesrna/intern/rna_workspace_api.c +++ b/source/blender/makesrna/intern/rna_workspace_api.c @@ -29,6 +29,7 @@ #include "DNA_object_types.h" #include "DNA_windowmanager_types.h" +#include "DNA_workspace_types.h" #include "RNA_enum_types.h" /* own include */ @@ -51,6 +52,7 @@ static void rna_WorkSpaceTool_setup(ID *id, const char *data_block, const char *op_idname, int index, + int options, const char *idname_fallback, const char *keymap_fallback) { @@ -62,6 +64,7 @@ static void rna_WorkSpaceTool_setup(ID *id, STRNCPY(tref_rt.data_block, data_block); STRNCPY(tref_rt.op, op_idname); tref_rt.index = index; + tref_rt.flag = options; /* While it's logical to assign both these values from setup, * it's useful to stored this in DNA for re-use, exceptional case: write to the 'tref'. */ @@ -131,6 +134,11 @@ void RNA_api_workspace_tool(StructRNA *srna) PropertyRNA *parm; FunctionRNA *func; + static EnumPropertyItem options_items[] = { + {TOOLREF_FLAG_FALLBACK_KEYMAP, "KEYMAP_FALLBACK", 0, "Fallback", ""}, + {0, NULL, 0, NULL, NULL}, + }; + func = RNA_def_function(srna, "setup", "rna_WorkSpaceTool_setup"); RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Set the tool settings"); @@ -146,6 +154,7 @@ void RNA_api_workspace_tool(StructRNA *srna) RNA_def_string(func, "data_block", NULL, MAX_NAME, "Data Block", ""); RNA_def_string(func, "operator", NULL, MAX_NAME, "Operator", ""); RNA_def_int(func, "index", 0, INT_MIN, INT_MAX, "Index", "", INT_MIN, INT_MAX); + RNA_def_enum_flag(func, "options", options_items, 0, "Tool Options", ""); RNA_def_string(func, "idname_fallback", NULL, MAX_NAME, "Fallback Identifier", ""); RNA_def_string(func, "keymap_fallback", NULL, KMAP_MAX_NAME, "Fallback Key Map", ""); |