Fix T48913: cycles viewport render stuck in loop due to non-unique dupli ID.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 14 Aug 2016 13:33:21 +0000 (15:33 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 17 Aug 2016 21:16:37 +0000 (23:16 +0200)
intern/cycles/blender/blender_util.h
source/blender/blenkernel/intern/object_dupli.c
source/blender/makesdna/DNA_object_types.h

index d5dbaba094b87e9225105c7fb6fd063666453e2d..e79f2bbb27dcfe129326dde66739055b00301f24 100644 (file)
@@ -698,7 +698,7 @@ protected:
 
 /* Object Key */
 
-enum { OBJECT_PERSISTENT_ID_SIZE = 8 };
+enum { OBJECT_PERSISTENT_ID_SIZE = 16 };
 
 struct ObjectKey {
        void *parent;
index 21a0246353e9eac1c9917f885040cda881c76481..3a0222b1c4bd96127ae49ee28f7a4606b3e24979 100644 (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);
                        }
                }
        }
index d53c8360bb53c867cc1a5c447955d465619fd2e4..d24c7faa9f55a0221381382f78d5c2a51e637072 100644 (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;