diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-11-09 14:17:00 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-11-09 14:17:00 +0300 |
commit | b874bdc227e779c443976b1f512115aece0ddc77 (patch) | |
tree | e33850cbf8015a62c5a5f76d90d68ccde823a3fb /source/blender/blenkernel | |
parent | db4c2b80163731fddd7c1356f5503cd19610e772 (diff) |
Fix for [#24580] and [#24600]
* Particles didn't want to stay cached, even if there were no actual chages.
* Particle states weren't set properly for times before actual simulation start.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 2b045647661..3de01b61779 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -136,9 +136,12 @@ void psys_reset(ParticleSystem *psys, int mode) if(ELEM(mode, PSYS_RESET_ALL, PSYS_RESET_DEPSGRAPH)) { if(mode == PSYS_RESET_ALL || !(psys->flag & PSYS_EDITED)) { - psys_free_particles(psys); + /* don't free if not absolutely necessary */ + if(psys->totpart != psys->part->totpart) { + psys_free_particles(psys); + psys->totpart= 0; + } - psys->totpart= 0; psys->totkeyed= 0; psys->flag &= ~(PSYS_HAIR_DONE|PSYS_KEYED); @@ -3750,14 +3753,14 @@ static void system_step(ParticleSimulationData *sim, float cfra) /* simulation is only active during a specific period */ if(framenr < startframe) { - psys_reset(psys, PSYS_RESET_CACHE_MISS); + /* set correct particle state and reset particles */ + cached_step(sim, cfra); return; } else if(framenr > endframe) { framenr= endframe; } - - if(framenr == startframe) { + else if(framenr == startframe) { BKE_ptcache_id_reset(sim->scene, use_cache, PTCACHE_RESET_OUTDATED); BKE_ptcache_validate(cache, framenr); cache->flag &= ~PTCACHE_REDO_NEEDED; |