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>2018-05-22 15:00:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-22 16:31:06 +0300
commit96a7ed8a159fec97ab19a6d19ffe6201a4ee2b35 (patch)
treead7164dbc343e62551de15e96c3bdb4841560453 /source/blender/makesrna/intern/rna_workspace_api.c
parent298f8042efe12b4a8861a83c860b3adb0d56f1f6 (diff)
Tool System: store operator properties in the tool
This replaces last-used property use which wasn't reliable since properties were not considered 'set' - causing them to be ignored.
Diffstat (limited to 'source/blender/makesrna/intern/rna_workspace_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_workspace_api.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c
index 4c6949cc33d..e56d9a0bc33 100644
--- a/source/blender/makesrna/intern/rna_workspace_api.c
+++ b/source/blender/makesrna/intern/rna_workspace_api.c
@@ -64,6 +64,20 @@ static void rna_WorkspaceTool_setup(
WM_toolsystem_ref_set_from_runtime(C, (WorkSpace *)id, tref, &tref_rt, name);
}
+static PointerRNA rna_WorkspaceTool_operator_properties(
+ bToolRef *tref,
+ const char *idname)
+{
+ wmOperatorType *ot = WM_operatortype_find(idname, true);
+
+ if (ot != NULL) {
+ PointerRNA ptr;
+ WM_toolsystem_ref_properties_ensure(tref, ot, &ptr);
+ return ptr;
+ }
+ return PointerRNA_NULL;
+}
+
#else
void RNA_api_workspace(StructRNA *UNUSED(srna))
@@ -91,6 +105,16 @@ void RNA_api_workspace_tool(StructRNA *srna)
RNA_def_string(func, "manipulator_group", NULL, MAX_NAME, "Manipulator Group", "");
RNA_def_string(func, "data_block", NULL, MAX_NAME, "Data Block", "");
RNA_def_int(func, "index", 0, INT_MIN, INT_MAX, "Index", "", INT_MIN, INT_MAX);
+
+ /* Access tool operator options (optionally create). */
+ func = RNA_def_function(srna, "operator_properties", "rna_WorkspaceTool_operator_properties");
+ parm = RNA_def_string(func, "operator", NULL, 0, "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return */
+ parm = RNA_def_pointer(func, "result", "OperatorProperties", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
}
#endif