diff options
author | Janne Karhu <jhkarh@gmail.com> | 2011-02-23 13:42:27 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2011-02-23 13:42:27 +0300 |
commit | 5a70edc4afd2f878b1d62168a2dd86edfe66a5fb (patch) | |
tree | 99e311c87368b149704c42c129a052e21a5c5c17 /source | |
parent | 9416daf97eef06f90d5230eeac0a5995d06be00c (diff) |
Possible fix for [#26190] Changing particle amount crashes
* In some cases fluid particles could be born at the exact same locations. Now these cases are just ignored and such particles don't effect each other.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index c1a6558aea3..fd792168c6b 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2286,6 +2286,10 @@ static void particle_fluidsim(ParticleSystem *psys, int own_psys, ParticleData * /* pressure and near pressure */ for(n=own_psys?1:0; n<neighbours; n++) { + /* disregard particles at the exact same location */ + if(ptn[n].dist < FLT_EPSILON) + continue; + sub_v3_v3(ptn[n].co, pa->prev_state.co); mul_v3_fl(ptn[n].co, 1.f/ptn[n].dist); q = ptn[n].dist/h; @@ -2305,6 +2309,10 @@ static void particle_fluidsim(ParticleSystem *psys, int own_psys, ParticleData * /* main calculations */ for(n=own_psys?1:0; n<neighbours; n++) { + /* disregard particles at the exact same location */ + if(ptn[n].dist < FLT_EPSILON) + continue; + npa = psys->particles + ptn[n].index; rij = ptn[n].dist; |