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.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user