From ee4b32c41a4a20cd82d10af7fefd9b20e29a77f3 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Wed, 3 Nov 2010 16:51:25 +0000 Subject: [PATCH] Fix for [#21958] Dupli group doesn't show up if linked on a layer that is different from the group layer * Object layer flag was set too soon for group duplication. --- source/blender/blenkernel/intern/anim.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 500161fee2e..547d3f7a738 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -796,6 +796,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n DupliObject *dob; vertexDupliData *vdd= userData; float vec[3], q2[4], mat[3][3], tmat[4][4], obmat[4][4]; + int origlay; mul_v3_m4v3(vec, vdd->pmat, co); sub_v3_v3(vec, vdd->pmat[3]); @@ -818,7 +819,14 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n copy_m4_m4(tmat, obmat); mul_m4_m4m3(obmat, tmat, mat); } + + origlay = vdd->ob->lay; + dob= new_dupli_object(vdd->lb, vdd->ob, obmat, vdd->par->lay, index, OB_DUPLIVERTS, vdd->animated); + + /* restore the original layer so that each dupli will have proper dob->origlay */ + vdd->ob->lay = origlay; + if(vdd->orco) VECCOPY(dob->orco, vdd->orco[index]); @@ -928,6 +936,14 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl vertex_dupli__mapFunc(&vdd, a, vec, no, NULL); } } + if(sce) { + /* Set proper layer in case of scene looping, + * in case of groups the object layer will be + * changed when it's duplicated due to the + * group duplication. + */ + ob->lay = vdd.par->lay; + } break; }