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 | |
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')
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.c | 12 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 1 |
3 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 609932ae5e2..f20fa0c401d 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 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; diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index af27ea921ce..f429360e1cf 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 } |