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:
Brecht Van Lommel 2014-01-21 21:01:12 +01:00
parent ae3f577ac1
commit 2aeb49204d
Notes: blender-bot 2023-02-14 11:19:13 +01:00
Referenced by issue #38326, Only half face displayed
Referenced by issue #38312, Snap During Transform | Crash
Referenced by issue #38314, Negative rotation (With minus) after degree to reverse
Referenced by issue #38306, Dupliframes+Dupliverts is not working in Rendered Viewport Shading mode.
3 changed files with 18 additions and 4 deletions

View File

@ -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));
}
}
}

View File

@ -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;

View File

@ -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
}