Particles: Fix for missing particles in render if they're disabled for viewport

The issue was introduced in rB4b685e1 and it appears some crazy area still
accesses particles for render after deleting it's render data, which broke
viewport/render behavior.

This commit restores previous G.is_rendering logic and adds corresponding
checks to cache construction, so counting is all consistent.

Goes to the TODO list to either replace G.is_rendering with eval_ctx or to
make it so psys->renderdata always exists during render sync.
This commit is contained in:
Sergey Sharybin 2015-04-08 20:17:44 +05:00
parent 2d05466700
commit c523e82e31
1 changed files with 6 additions and 6 deletions

View File

@ -286,7 +286,7 @@ bool psys_check_enabled(Object *ob, ParticleSystem *psys)
return 0;
psmd = psys_get_modifier(ob, psys);
if (psys->renderdata) {
if (psys->renderdata || G.is_rendering) {
if (!(psmd->modifier.mode & eModifierMode_Render))
return 0;
}
@ -1955,7 +1955,7 @@ void psys_find_parents(ParticleSimulationData *sim)
int from = PART_FROM_FACE;
totparent = (int)(totchild * part->parents * 0.3f);
if (sim->psys->renderdata && part->child_nbr && part->ren_child_nbr)
if ((sim->psys->renderdata || G.is_rendering) && part->child_nbr && part->ren_child_nbr)
totparent *= (float)part->child_nbr / (float)part->ren_child_nbr;
/* hard limit, workaround for it being ignored above */
@ -2000,7 +2000,7 @@ static bool psys_thread_context_init_path(ParticleThreadContext *ctx, ParticleSi
if (psys_in_edit_mode(scene, psys)) {
ParticleEditSettings *pset = &scene->toolsettings->particle;
if (psys->renderdata == 0 && (psys->edit == NULL || pset->flag & PE_DRAW_PART) == 0)
if ((psys->renderdata == 0 && G.is_rendering == 0) && (psys->edit == NULL || pset->flag & PE_DRAW_PART) == 0)
totchild = 0;
segments = 1 << pset->draw_step;
@ -2009,14 +2009,14 @@ static bool psys_thread_context_init_path(ParticleThreadContext *ctx, ParticleSi
if (totchild && part->childtype == PART_CHILD_FACES) {
totparent = (int)(totchild * part->parents * 0.3f);
if (psys->renderdata && part->child_nbr && part->ren_child_nbr)
if ((psys->renderdata || G.is_rendering) && part->child_nbr && part->ren_child_nbr)
totparent *= (float)part->child_nbr / (float)part->ren_child_nbr;
/* part->parents could still be 0 so we can't test with totparent */
between = 1;
}
if (psys->renderdata)
if (psys->renderdata || G.is_rendering)
segments = 1 << part->ren_step;
else {
totchild = (int)((float)totchild * (float)part->disp / 100.0f);
@ -2470,7 +2470,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4];
float rotmat[3][3];
int k;
int segments = (int)pow(2.0, (double)(psys->renderdata ? part->ren_step : part->draw_step));
int segments = (int)pow(2.0, (double)((psys->renderdata || G.is_rendering) ? part->ren_step : part->draw_step));
int totpart = psys->totpart;
float length, vec[3];
float *vg_effector = NULL;