Fix T47935: Hair particles; The display percentage parameter breaks after a render is done.

Follow same logic in `psys_render_restore` as in `psys_render_set` - if hair and
display percentage is not 100%, we have to recompute particles...

With regular 'emitter' particles just hiding some is fine (though using random here
will not give a precise proportion...).
This commit is contained in:
Bastien Montagne
2016-03-26 17:41:56 +01:00
parent 112f431c3b
commit 8fcf774167

View File

@@ -720,13 +720,19 @@ void psys_render_restore(Object *ob, ParticleSystem *psys)
disp = psys_get_current_display_percentage(psys);
if (disp != render_disp) {
PARTICLE_P;
/* Hair can and has to be recalculated if everything isn't displayed. */
if (psys->part->type == PART_HAIR) {
psys->recalc |= PSYS_RECALC_RESET;
}
else {
PARTICLE_P;
LOOP_PARTICLES {
if (psys_frand(psys, p) > disp)
pa->flag |= PARS_NO_DISP;
else
pa->flag &= ~PARS_NO_DISP;
LOOP_PARTICLES {
if (psys_frand(psys, p) > disp)
pa->flag |= PARS_NO_DISP;
else
pa->flag &= ~PARS_NO_DISP;
}
}
}
}