Fix #36355: cycles render of objects with both duplis and hair would not render

the hair in some cases.
This commit is contained in:
Brecht Van Lommel 2013-08-07 19:02:15 +00:00
parent 4941cafa09
commit 9d9c64582b

@ -348,32 +348,41 @@ static bool object_render_hide(BL::Object b_ob, bool top_level, bool parent_hide
bool hair_present = false; bool hair_present = false;
bool show_emitter = false; bool show_emitter = false;
bool hide = false; bool hide_as_dupli_parent = false;
bool hide_as_dupli_child_original = false;
for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) { for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) {
if((b_psys->settings().render_type() == BL::ParticleSettings::render_type_PATH) && if((b_psys->settings().render_type() == BL::ParticleSettings::render_type_PATH) &&
(b_psys->settings().type()==BL::ParticleSettings::type_HAIR)) (b_psys->settings().type()==BL::ParticleSettings::type_HAIR))
hair_present = true; hair_present = true;
if(b_psys->settings().use_render_emitter()) { if(b_psys->settings().use_render_emitter())
hide = false;
show_emitter = true; show_emitter = true;
} }
}
/* duplicators hidden by default, except dupliframes which duplicate self */ /* duplicators hidden by default, except dupliframes which duplicate self */
if(b_ob.is_duplicator()) if(b_ob.is_duplicator())
if(top_level || b_ob.dupli_type() != BL::Object::dupli_type_FRAMES) if(top_level || b_ob.dupli_type() != BL::Object::dupli_type_FRAMES)
hide = true; hide_as_dupli_parent = true;
/* hide original object for duplis */ /* hide original object for duplis */
BL::Object parent = b_ob.parent(); BL::Object parent = b_ob.parent();
if(parent && object_render_hide_original(b_ob.type(), parent.dupli_type())) if(parent && object_render_hide_original(b_ob.type(), parent.dupli_type()))
if(parent_hide) if(parent_hide)
hide = true; hide_as_dupli_child_original = true;
hide_triangles = (hair_present && !show_emitter); if(show_emitter) {
return hide && !show_emitter; hide_triangles = false;
return (hide_as_dupli_parent || hide_as_dupli_child_original);
}
else if(hair_present) {
hide_triangles = true;
return hide_as_dupli_child_original;
}
else {
hide_triangles = false;
return (hide_as_dupli_parent || hide_as_dupli_child_original);
}
} }
static bool object_render_hide_duplis(BL::Object b_ob) static bool object_render_hide_duplis(BL::Object b_ob)