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>2019-12-06 19:45:50 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-12-06 22:03:00 +0300
commit6ffcddc10afa07b073ce01c25884e23fc2b661df (patch)
tree86e7ddb017474083890bf16fac4876175a923e57 /source/blender/makesrna/intern/rna_workspace_api.c
parent7465078e637b729e8b36a4f4b73a50a347052df4 (diff)
Tool System: experimental fallback tool support
Implement T66304 as an experimental option, available under the preferences "Experimental" section. - When enabled most tools in the 3D view have a gizmo. - Dragging outside the gizmo uses the 'fallback' tool. - The fallback tool can be changed or disabled in the tool options or from a pie menu (Alt-W).
Diffstat (limited to 'source/blender/makesrna/intern/rna_workspace_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_workspace_api.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c
index 2d3b1e76b71..f244a674e57 100644
--- a/source/blender/makesrna/intern/rna_workspace_api.c
+++ b/source/blender/makesrna/intern/rna_workspace_api.c
@@ -43,14 +43,16 @@
static void rna_WorkSpaceTool_setup(ID *id,
bToolRef *tref,
bContext *C,
- const char *tool_idname,
+ const char *idname,
/* Args for: 'bToolRef_Runtime'. */
int cursor,
const char *keymap,
const char *gizmo_group,
const char *data_block,
const char *op_idname,
- int index)
+ int index,
+ const char *idname_fallback,
+ const char *keymap_fallback)
{
bToolRef_Runtime tref_rt = {0};
@@ -61,7 +63,10 @@ static void rna_WorkSpaceTool_setup(ID *id,
STRNCPY(tref_rt.op, op_idname);
tref_rt.index = index;
- WM_toolsystem_ref_set_from_runtime(C, (WorkSpace *)id, tref, &tref_rt, tool_idname);
+ STRNCPY(tref_rt.idname_fallback, idname_fallback ? idname_fallback : NULL);
+ STRNCPY(tref_rt.keymap_fallback, keymap_fallback ? keymap_fallback : NULL);
+
+ WM_toolsystem_ref_set_from_runtime(C, (WorkSpace *)id, tref, &tref_rt, idname);
}
static void rna_WorkSpaceTool_refresh_from_context(ID *id, bToolRef *tref, Main *bmain)
@@ -140,6 +145,9 @@ void RNA_api_workspace_tool(StructRNA *srna)
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_string(func, "idname_fallback", NULL, MAX_NAME, "Fallback Identifier", "");
+ RNA_def_string(func, "keymap_fallback", NULL, KMAP_MAX_NAME, "Fallback Key Map", "");
+
/* Access tool operator options (optionally create). */
func = RNA_def_function(srna, "operator_properties", "rna_WorkSpaceTool_operator_properties");
RNA_def_function_flag(func, FUNC_USE_REPORTS);