From 81615ddf86173e6525fb92d26dc5cf130a4cdef5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 6 Jun 2017 16:27:02 +0200 Subject: Cycles: Fix infinite update when using duplis The issue was caused by usage of address of dupli-object (which will vary from iteration process to iteration process) as something denoting whether we've got the data synchronized to Cycles or not. For now solved by using address of original object (the one DupliObject points to) as a pointer for the map. Need to do more thoughts about this. --- source/blender/makesrna/intern/rna_depsgraph.c | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source/blender/makesrna/intern/rna_depsgraph.c') diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index c1f84b44447..b995347856b 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -59,6 +59,17 @@ static PointerRNA rna_DepsgraphIter_object_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_Object, iterator->current); } +static PointerRNA rna_DepsgraphIter_instance_object_get(PointerRNA *ptr) +{ + BLI_Iterator *iterator = ptr->data; + DEGObjectsIteratorData *deg_iter = (DEGObjectsIteratorData *)iterator->data; + Object *instance_object = NULL; + if (deg_iter->dupli_object_current != NULL) { + instance_object = deg_iter->dupli_object_current->ob; + } + return rna_pointer_inherit_refine(ptr, &RNA_Object, instance_object); +} + static PointerRNA rna_DepsgraphIter_parent_get(PointerRNA *ptr) { BLI_Iterator *iterator = ptr->data; @@ -101,6 +112,13 @@ static void rna_DepsgraphIter_uv_get(PointerRNA *ptr, float *uv) sizeof(deg_iter->dupli_object_current->uv)); } +static int rna_DepsgraphIter_is_instance_get(PointerRNA *ptr) +{ + BLI_Iterator *iterator = ptr->data; + DEGObjectsIteratorData *deg_iter = (DEGObjectsIteratorData *)iterator->data; + return (deg_iter->dupli_object_current != NULL); +} + /* **************** Depsgraph **************** */ static void rna_Depsgraph_debug_graphviz(Depsgraph *graph, const char *filename) @@ -224,6 +242,12 @@ static void rna_def_depsgraph_iter(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); RNA_def_property_pointer_funcs(prop, "rna_DepsgraphIter_object_get", NULL, NULL, NULL); + prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_ui_text(prop, "Instance Object", "Object which is being instanced by this iterator"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, "rna_DepsgraphIter_instance_object_get", NULL, NULL, NULL); + prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Parent", "Parent of the duplication list"); @@ -256,6 +280,11 @@ static void rna_def_depsgraph_iter(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); RNA_def_property_float_funcs(prop, "rna_DepsgraphIter_uv_get", NULL, NULL); + + prop = RNA_def_property(srna, "is_instance", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Is Instance", "Denotes whether the object is ocming from dupli-list"); + RNA_def_property_boolean_funcs(prop, "rna_DepsgraphIter_is_instance_get", NULL); } static void rna_def_depsgraph(BlenderRNA *brna) -- cgit v1.2.3