diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-11-30 08:07:57 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-11-30 08:07:57 +0300 |
commit | 970fa83fab52387aa3f9aa0f3e90d73b5af52bfd (patch) | |
tree | c4d84fb85bb23cb16b757c29ef1e82e3ca4dc817 /source/blender | |
parent | 18f3e5d69f7959afaf41a55a5e18cc0a0a2a0972 (diff) |
Added Group type to RNA
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_group.c | 70 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 1 |
5 files changed, 74 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 6ec7bca45da..367bb5a13d7 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -96,6 +96,7 @@ extern StructRNA RNA_JoystickSensor; extern StructRNA RNA_ActuatorSensor; extern StructRNA RNA_DelaySensor; extern StructRNA RNA_Camera; +extern StructRNA RNA_Group; /* Pointer * * These functions will fill in RNA pointers, this can be done in three ways: diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 2842da1d72a..1891112aa03 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -889,6 +889,7 @@ RNAProcessItem PROCESS_ITEMS[]= { {"rna_wm.c", RNA_def_wm}, {"rna_sensor.c", RNA_def_sensor}, {"rna_camera.c", RNA_def_camera}, + {"rna_group.c", RNA_def_group}, {NULL, NULL}}; static int rna_preprocess(char *basedirectory, FILE *f) diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 8081b7f684d..e095daac4b5 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -59,6 +59,7 @@ static StructRNA *rna_ID_refine(PointerRNA *ptr) switch(GS(id->name)) { case ID_CA: return &RNA_Camera; + case ID_GR: return &RNA_Group; case ID_LA: return &RNA_Lamp; case ID_LI: return &RNA_Library; case ID_MA: return &RNA_Material; diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c new file mode 100644 index 00000000000..972dadae266 --- /dev/null +++ b/source/blender/makesrna/intern/rna_group.c @@ -0,0 +1,70 @@ +/** + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Contributor(s): Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <stdlib.h> + +#include "RNA_define.h" +#include "RNA_types.h" + +#include "rna_internal.h" + +#include "DNA_group_types.h" + +#ifdef RNA_RUNTIME + +void *rna_Group_objects_get(CollectionPropertyIterator *iter) +{ + ListBaseIterator *internal= iter->internal; + + /* we are actually iterating a GroupObject list, so override get */ + return ((GroupObject *)internal->link)->ob; +} + +#else + +void RNA_def_group(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "Group", "ID", "Group"); + + prop= RNA_def_property(srna, "dupli_ofs", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_ui_text(prop, "Dupli Offset", "Offset from the center to use when instancing as DupliGroup."); + RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4); + + prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "gobject", NULL); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects"); + RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0, 0); + + prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); + RNA_def_property_array(prop, 20); + RNA_def_property_ui_text(prop, "Dupli Layers", "Layers visible when this groups is instanced as a dupli."); +} + +#endif + diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 9cc6606c40b..d16fa5de6f6 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -94,6 +94,7 @@ void RNA_def_screen(struct BlenderRNA *brna); void RNA_def_wm(struct BlenderRNA *brna); void RNA_def_sensor(struct BlenderRNA *brna); void RNA_def_camera(struct BlenderRNA *brna); +void RNA_def_group(struct BlenderRNA *brna); /* ID Properties */ |