Fix for [#25879] Particle Duplication issue with Linked in Objects from Groups.

* Only the first object (in scene object order) that instanced a dupligroup was rendered properly, because particle instances were checked for only after creating the render object (and even this check was done wrong).
* Now the actual render object is created only after both object and particle instances have been checked.
This commit is contained in:
Janne Karhu
2011-02-01 15:02:25 +00:00
parent 67b1cdd953
commit 4037eda069

View File

@@ -4765,6 +4765,8 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
int psysindex;
float mat[4][4];
obi=NULL;
/* instances instead of the actual object are added in two cases, either
* this is a duplivert/face/particle, or it is a non-animated object in
* a dupligroup that has already been created before */
@@ -4789,15 +4791,14 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
find_dupli_instances(re, obr);
}
}
else
/* can't instance, just create the object */
init_render_object(re, obd, ob, dob, timeoffset, vectorlay);
/* same logic for particles, each particle system has it's own object, so
* need to go over them separately */
psysindex= 1;
for(psys=obd->particlesystem.first; psys; psys=psys->next) {
if(dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, ob, psysindex))) {
if(dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, psysindex))) {
if(obi == NULL)
mul_m4_m4m4(mat, dob->mat, re->viewmat);
obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, psysindex++, mat, obd->lay);
set_dupli_tex_mat(re, obi, dob);
@@ -4813,6 +4814,10 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
}
}
}
if(obi==NULL)
/* can't instance, just create the object */
init_render_object(re, obd, ob, dob, timeoffset, vectorlay);
if(dob->type != OB_DUPLIGROUP) {
obd->flag |= OB_DONE;