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:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-06-06 17:27:02 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-06-06 17:30:14 +0300
commit81615ddf86173e6525fb92d26dc5cf130a4cdef5 (patch)
tree97dc38f4cc30f2865d7aeb44258f093c3844835f /source/blender/makesrna/intern/rna_depsgraph.c
parentcb97b07e23d37acceff9c487fbed6c3d3c21d370 (diff)
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.
Diffstat (limited to 'source/blender/makesrna/intern/rna_depsgraph.c')
-rw-r--r--source/blender/makesrna/intern/rna_depsgraph.c29
1 files changed, 29 insertions, 0 deletions
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)