[Bf-blender-cvs] [2aeb492] master: Fix T38306: dupliframes causing viewport render to continually restart.

Brecht Van Lommel noreply at git.blender.org
Tue Jan 21 21:06:21 CET 2014


Commit: 2aeb49204d40d6a43026de6f87fd5e7f0df100c6
Author: Brecht Van Lommel
Date:   Tue Jan 21 21:01:12 2014 +0100
https://developer.blender.org/rB2aeb49204d40d6a43026de6f87fd5e7f0df100c6

Fix T38306: dupliframes causing viewport render to continually restart.

Evaluating the animation is causing the object to get tagged as changed, but in
this case it's not a permanent change so no one should be notified. Also found
a case where the persistent ID for duplis wasn't unique, fixed that as well.

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

M	source/blender/blenkernel/intern/anim_sys.c
M	source/blender/blenkernel/intern/object_dupli.c
M	source/blender/makesdna/DNA_ID.h

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

diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 609932a..f20fa0c 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1382,8 +1382,13 @@ static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_in
 			 * be run, it's for e.g. render engines to synchronize data */
 			if (written && new_ptr.id.data) {
 				ID *id = new_ptr.id.data;
-				id->flag |= LIB_ID_RECALC;
-				DAG_id_type_tag(G.main, GS(id->name));
+
+				/* for cases like duplifarmes it's only a temporary so don't
+				 * notify anyone of updates */
+				if (!(id->flag & LIB_ANIM_NO_RECALC)) {
+					id->flag |= LIB_ID_RECALC;
+					DAG_id_type_tag(G.main, GS(id->name));
+				}
 			}
 		}
 		
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 1ebf31b..41d411b 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -29,6 +29,7 @@
  *  \ingroup bke
  */
 
+#include <limits.h>
 #include <stdlib.h>
 #include <stddef.h>
 
@@ -170,8 +171,11 @@ static DupliObject *make_dupli(const DupliContext *ctx,
 	 * dupli object between frames, which is needed for motion blur. last level
 	 * goes first in the array. */
 	dob->persistent_id[0] = index;
-	for (i = 0; i < ctx->level; i++)
-		dob->persistent_id[i + 1] = ctx->persistent_id[ctx->level - 1 - i];
+	for (i = 1; i < ctx->level+1; i++)
+		dob->persistent_id[i] = ctx->persistent_id[ctx->level - i];
+	/* fill rest of values with INT_MAX which index will never have as value */
+	for (; i < MAX_DUPLI_RECUR; i++)
+		dob->persistent_id[i] = INT_MAX;
 
 	if (hide)
 		dob->no_draw = true;
@@ -347,6 +351,10 @@ static void make_duplis_frames(const DupliContext *ctx)
 	/* duplicate over the required range */
 	if (ob->transflag & OB_DUPLINOSPEED) enable_cu_speed = 0;
 
+	/* special flag to avoid setting recalc flags to notify the depsgraph of
+	 * updates, as this is not a permanent change to the object */
+	ob->id.flag |= LIB_ANIM_NO_RECALC;
+
 	for (scene->r.cfra = ob->dupsta; scene->r.cfra <= dupend; scene->r.cfra++) {
 		int ok = 1;
 
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index af27ea9..f429360 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -260,6 +260,7 @@ typedef struct PreviewImage {
 /* runtime */
 #define LIB_ID_RECALC		4096
 #define LIB_ID_RECALC_DATA	8192
+#define LIB_ANIM_NO_RECALC 16384
 
 #ifdef __cplusplus
 }




More information about the Bf-blender-cvs mailing list