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_wm_gizmo.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_wm_gizmo.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 494c988a467..41e3929e8ae 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -548,6 +548,34 @@ static StructRNA *rna_Gizmo_refine(PointerRNA *mnp_ptr)
/** \name Gizmo Group API
* \{ */
+static wmGizmoGroupType *rna_GizmoGroupProperties_find_gizmo_group_type(PointerRNA *ptr)
+{
+ IDProperty *properties = (IDProperty *)ptr->data;
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(properties->name, false);
+ return gzgt;
+}
+
+static StructRNA *rna_GizmoGroupProperties_refine(PointerRNA *ptr)
+{
+ wmGizmoGroupType *gzgt = rna_GizmoGroupProperties_find_gizmo_group_type(ptr);
+
+ if (gzgt)
+ return gzgt->srna;
+ else
+ return ptr->type;
+}
+
+static IDProperty *rna_GizmoGroupProperties_idprops(PointerRNA *ptr, bool create)
+{
+ if (create && !ptr->data) {
+ IDPropertyTemplate val = {0};
+ ptr->data = IDP_New(IDP_GROUP, &val, "RNA_GizmoGroupProperties group");
+ }
+
+ return ptr->data;
+}
+
+
static wmGizmo *rna_GizmoGroup_gizmo_new(
wmGizmoGroup *gzgroup, ReportList *reports, const char *idname)
{
@@ -1364,6 +1392,12 @@ static void rna_def_gizmogroup(BlenderRNA *brna)
RNA_define_verify_sdna(1); /* not in sdna */
RNA_api_gizmogroup(srna);
+
+ srna = RNA_def_struct(brna, "GizmoGroupProperties", NULL);
+ RNA_def_struct_ui_text(srna, "Gizmo Group Properties", "Input properties of a Gizmo Group");
+ RNA_def_struct_refine_func(srna, "rna_GizmoGroupProperties_refine");
+ RNA_def_struct_idprops_func(srna, "rna_GizmoGroupProperties_idprops");
+ RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
}
void RNA_def_wm_gizmo(BlenderRNA *brna)