Manipulator: add access to manipulator's group
authorCampbell Barton <ideasman42@gmail.com>
Wed, 19 Jul 2017 18:35:48 +0000 (04:35 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 20 Jul 2017 14:51:03 +0000 (00:51 +1000)
source/blender/makesrna/intern/rna_wm_manipulator.c

index 6efed5c1150f5099755e49c7dfa47469cac82c17..a4debc86505b36eab68756f41df59b426fbf11f5 100644 (file)
@@ -393,6 +393,12 @@ static int rna_Manipulator_name_length(PointerRNA *ptr)
        return strlen(mpr->name);
 }
 
+static PointerRNA rna_Manipulator_group_get(PointerRNA *ptr)
+{
+       wmManipulator *mpr = ptr->data;
+       return rna_pointer_inherit_refine(ptr, &RNA_ManipulatorGroup, mpr->parent_mgroup);
+}
+
 #ifdef WITH_PYTHON
 
 static void rna_Manipulator_unregister(struct Main *bmain, StructRNA *type);
@@ -998,6 +1004,12 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_struct_name_property(srna, prop);
        RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
 
+       prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+       RNA_def_property_struct_type(prop, "ManipulatorGroup");
+       RNA_def_property_pointer_funcs(prop, "rna_Manipulator_group_get", NULL, NULL, NULL);
+       RNA_def_property_ui_text(prop, "", "Manipulator group this manipulator is a member of");
+
        /* Color & Alpha */
        prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
        RNA_def_property_array(prop, 3);