Commit: 72edec3e23e43f181dd456f583d3fa9447001b07
Author: Dalai Felinto
Date:   Wed Nov 23 19:09:29 2016 +0100
Branches: layers
https://developer.blender.org/rB72edec3e23e43f181dd456f583d3fa9447001b07

RNA: layer.collections[2].objects

This does not include objects from nested collections.
Missing bits: objects.link, objects.unlink

===================================================================

M       source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 9439c00..60156a6 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);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to