diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2016-11-23 21:09:29 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2016-11-23 21:09:29 +0300 |
commit | 72edec3e23e43f181dd456f583d3fa9447001b07 (patch) | |
tree | 1b21c286bb1ba8ef03167501fae34c1158e065b1 /source/blender/makesrna/intern | |
parent | 75d6c0cae6426d0a37c45476b527a406eaffd08b (diff) |
RNA: layer.collections[2].objects
This does not include objects from nested collections.
Missing bits: objects.link, objects.unlink
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 9439c00e295..60156a60c1e 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -655,6 +655,14 @@ static PointerRNA rna_Scene_layer_objects_get(CollectionPropertyIterator *iter) return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base *)internal->link)->object); } +static PointerRNA rna_LayerCollection_objects_get(CollectionPropertyIterator *iter) +{ + ListBaseIterator *internal = &iter->internal.listbase; + + /* we are actually iterating a Base list, so override get */ + return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base *)((LinkData *)internal->link)->data)->object); +} + static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value) { ToolSettings *ts = (ToolSettings *)ptr->data; @@ -5220,7 +5228,12 @@ static void rna_def_layer_collection(BlenderRNA *brna) RNA_def_struct_name_property(srna, prop); RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); - /* TODO baselist (selected objects, ...) */ + prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "elements", NULL); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_ui_text(prop, "Objects", ""); + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_LayerCollection_objects_get", NULL, NULL, NULL, NULL); + /* TODO overrides */ prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE); |