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.
This commit is contained in:
Janne Karhu 2010-11-03 16:51:25 +00:00
parent 57fd35ae26
commit ee4b32c41a

@ -796,6 +796,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
DupliObject *dob; DupliObject *dob;
vertexDupliData *vdd= userData; vertexDupliData *vdd= userData;
float vec[3], q2[4], mat[3][3], tmat[4][4], obmat[4][4]; float vec[3], q2[4], mat[3][3], tmat[4][4], obmat[4][4];
int origlay;
mul_v3_m4v3(vec, vdd->pmat, co); mul_v3_m4v3(vec, vdd->pmat, co);
sub_v3_v3(vec, vdd->pmat[3]); 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); copy_m4_m4(tmat, obmat);
mul_m4_m4m3(obmat, tmat, mat); 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); 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) if(vdd->orco)
VECCOPY(dob->orco, vdd->orco[index]); 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); 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; break;
} }