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-10-02 09:59:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-02 10:03:23 +0300
commit07d4580f644577ebbd49f7d9a2bd8a81561cc099 (patch)
tree268e8a78e00389f136391c1d00e2020eb9f472a4 /source/blender/makesrna/intern/rna_workspace_api.c
parentdce12293d0dbaf0ae1e2ea90dc46ae7e40763f31 (diff)
Gizmo: support for gizmo-group properties
This allows gizmo groups to store properties in the tool. This makes sense for gizmo options which only control gizmo display and don't control operator execution. Unlike similar kinds of properties, this isn't accessible via the gizmo-group-type instance. For now the it's only stored in the workspace tool as can be done for operator properties, so each instance doesn't have different settings which would be confusing from a user perspective and complicate access from the top-bar. Later we could add gizmo-group properties if needed.
Diffstat (limited to 'source/blender/makesrna/intern/rna_workspace_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_workspace_api.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c
index 331a8e77637..898dc296299 100644
--- a/source/blender/makesrna/intern/rna_workspace_api.c
+++ b/source/blender/makesrna/intern/rna_workspace_api.c
@@ -133,6 +133,23 @@ static PointerRNA rna_WorkspaceTool_operator_properties(
return PointerRNA_NULL;
}
+static PointerRNA rna_WorkspaceTool_gizmo_group_properties(
+ bToolRef *tref,
+ ReportList *reports,
+ const char *idname)
+{
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
+ if (gzgt != NULL) {
+ PointerRNA ptr;
+ WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgt, &ptr);
+ return ptr;
+ }
+ else {
+ BKE_reportf(reports, RPT_ERROR, "Gizmo group '%s' not found!", idname);
+ }
+ return PointerRNA_NULL;
+}
+
#else
void RNA_api_workspace(StructRNA *srna)
@@ -176,6 +193,16 @@ void RNA_api_workspace_tool(StructRNA *srna)
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
RNA_def_function_return(func, parm);
+ /* Access gizmo-group options (optionally create). */
+ func = RNA_def_function(srna, "gizmo_group_properties", "rna_WorkspaceTool_gizmo_group_properties");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "group", NULL, 0, "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return */
+ parm = RNA_def_pointer(func, "result", "GizmoGroupProperties", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
func = RNA_def_function(srna, "refresh_from_context", "rna_WorkspaceTool_refresh_from_context");
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
}