diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-22 00:01:12 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-22 00:03:49 +0400 |
commit | 2aeb49204d40d6a43026de6f87fd5e7f0df100c6 (patch) | |
tree | ec40874f4175b4e56d26988e227188f0dcd2e4fd /source/blender/blenkernel/intern/object_dupli.c | |
parent | ae3f577ac18acf22ee2dafd939b6e121fd220c1f (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/object_dupli.c')
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 1ebf31bf2ee..41d411b9b1c 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; |