diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-04-07 11:50:11 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-04-07 11:52:42 +0300 |
commit | 4b685e1b90c555a222d524b16a482913865683aa (patch) | |
tree | 45bf57561ddea6ab955ae3430de25c9b20f4a9fd /source/blender/blenkernel/intern/particle.c | |
parent | 98f41066943d8b1cf9236d6b358d1e84c9e7cc4b (diff) |
Fix T44268: Particles: too many virtual parents + non-100 display% = crash
Issue was caused by mismatched logic in counting child/parent particles in
job initialization and actual job execution. Confusion here came from mixed
usage of psys->renderdata and G.is_rendering.
We need to get rid of G.is_rendering and use eval_ctx if it's really needed,
but we also might just use psys->renderdata check since it's expected psys
to have this structure anyway.
Diffstat (limited to 'source/blender/blenkernel/intern/particle.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 8d3f92182d4..fbd55928534 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -286,7 +286,7 @@ bool psys_check_enabled(Object *ob, ParticleSystem *psys) return 0; psmd = psys_get_modifier(ob, psys); - if (psys->renderdata || G.is_rendering) { + if (psys->renderdata) { 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 || G.is_rendering) && part->child_nbr && part->ren_child_nbr) + if (sim->psys->renderdata && 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 */ @@ -2009,7 +2009,7 @@ 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 || G.is_rendering) && part->child_nbr && part->ren_child_nbr) + if (psys->renderdata && 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 */ @@ -2288,6 +2288,7 @@ static void psys_thread_create_path(ParticleTask *task, struct ChildParticle *cp if (i >= ctx->totparent) { pa = &psys->particles[cpa->parent]; /* this is now threadsafe, virtual parents are calculated before rest of children */ + BLI_assert(cpa->parent < psys->totchildcache); par = cache[cpa->parent]; } } @@ -2335,6 +2336,7 @@ static void exec_child_path_cache(TaskPool *UNUSED(pool), void *taskdata, int UN cpa = psys->child + task->begin; for (i = task->begin; i < task->end; ++i, ++cpa) { + BLI_assert(i < psys->totchildcache); psys_thread_create_path(task, cpa, cache[i], i); } } |