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:
authorDalai Felinto <dfelinto@gmail.com>2017-12-15 01:17:00 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-12-15 01:17:27 +0300
commit569e29c49c1162bd9ee9c0e0c7313ea4ee76c0d0 (patch)
tree5a054d3180e5354759247000258f076b88f548b6 /source/blender/makesrna/intern/rna_object.c
parent100e9aa15f808bfc9cd0cc6c0abc892587cf9f34 (diff)
Fix RNA crash for objects without collection properties
This would happen if you tried to access the collection property for an object that has not being evaluated by the depsgraph.
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r--source/blender/makesrna/intern/rna_object.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index a153590f4ac..9301ed63adb 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -229,6 +229,15 @@ static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA
DEG_id_type_tag(bmain, ID_OB);
}
+static void rna_Object_collection_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Object *ob = ptr->data;
+
+ if (ob->base_collection_properties != NULL) {
+ rna_iterator_listbase_begin(iter, &ob->base_collection_properties->data.group, NULL);
+ }
+}
+
static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
{
Object *ob = ptr->id.data;
@@ -2803,6 +2812,15 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "collection_properties", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "base_collection_properties->data.group", NULL);
+ RNA_def_property_collection_funcs(prop,
+ "rna_Object_collection_properties_begin",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
RNA_def_property_struct_type(prop, "LayerCollectionSettings");
RNA_def_property_ui_text(prop, "Collection Settings",
"Engine specific render settings to be overridden by collections");