Fix T48913: cycles viewport render stuck in loop due to non-unique dupli ID.

This commit is contained in:
Brecht Van Lommel 2016-08-14 15:33:21 +02:00
parent 11e9c5e10a
commit c0161a1bab
Notes: blender-bot 2023-12-22 20:14:11 +01:00
Referenced by issue #89844, Nesting Collection instances cause first objects to disappear (restricted by MAX_DUPLI_RECUR)
Referenced by issue #48913, Viewport gets stuck when two group instances are emitted from one face using dupli-verts
3 changed files with 14 additions and 6 deletions

View File

@ -698,7 +698,7 @@ protected:
/* Object Key */
enum { OBJECT_PERSISTENT_ID_SIZE = 8 };
enum { OBJECT_PERSISTENT_ID_SIZE = 16 };
struct ObjectKey {
void *parent;

View File

@ -221,31 +221,39 @@ static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChild
if (ctx->group) {
unsigned int lay = ctx->group->layer;
unsigned int groupid = 0;
GroupObject *go;
for (go = ctx->group->gobject.first; go; go = go->next) {
for (go = ctx->group->gobject.first; go; go = go->next, groupid++) {
Object *ob = go->ob;
if ((ob->lay & lay) && ob != obedit && is_child(ob, parent)) {
DupliContext pctx;
copy_dupli_context(&pctx, ctx, ctx->object, NULL, groupid, false);
/* mballs have a different dupli handling */
if (ob->type != OB_MBALL)
ob->flag |= OB_DONE; /* doesnt render */
make_child_duplis_cb(ctx, userdata, ob);
make_child_duplis_cb(&pctx, userdata, ob);
}
}
}
else {
unsigned int lay = ctx->scene->lay;
unsigned int baseid = 0;
Base *base;
for (base = ctx->scene->base.first; base; base = base->next) {
for (base = ctx->scene->base.first; base; base = base->next, baseid++) {
Object *ob = base->object;
if ((base->lay & lay) && ob != obedit && is_child(ob, parent)) {
DupliContext pctx;
copy_dupli_context(&pctx, ctx, ctx->object, NULL, baseid, false);
/* mballs have a different dupli handling */
if (ob->type != OB_MBALL)
ob->flag |= OB_DONE; /* doesnt render */
make_child_duplis_cb(ctx, userdata, ob);
make_child_duplis_cb(&pctx, userdata, ob);
}
}
}

View File

@ -331,7 +331,7 @@ typedef struct DupliObject {
/* persistent identifier for a dupli object, for inter-frame matching of
* objects with motion blur, or inter-update matching for syncing */
int persistent_id[8]; /* MAX_DUPLI_RECUR */
int persistent_id[16]; /* 2*MAX_DUPLI_RECUR */
/* particle this dupli was generated from */
struct ParticleSystem *particle_system;