diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-09-27 16:24:12 +0400 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-09-27 16:24:12 +0400 |
commit | 8bc0cfc1ca988749365009eb01ac90dfec2baa50 (patch) | |
tree | 500ed6082742479fc765d30c75ad3ada7c468e57 /source | |
parent | d6c8b411446793dd23a54734ce8ee621a755ab3e (diff) |
Fix: Smoke wasn't using pointcache properly.
* The cache was reset almost constantly because smoke didn't save the first frame into cache. Although not necessary for smoke, it's vital to pointcache.
* Added info message to smoke cache panel for non saved files.
* Now smoke also only updates with a framestep of 1, so that scrubbing the timeline doesn't mess up the simulation.
* Among other things fixes report #23731.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index d2d8d5a6e07..d0fcde0da58 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1338,10 +1338,17 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM cache_wt = sds->point_cache[1]; BKE_ptcache_id_from_smoke_turbulence(&pid_wt, ob, smd); - if(!smd->domain->fluid) + if(!smd->domain->fluid || framenr == startframe) { BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); + BKE_ptcache_validate(cache, framenr); + cache->flag &= ~PTCACHE_REDO_NEEDED; + BKE_ptcache_id_reset(scene, &pid_wt, PTCACHE_RESET_OUTDATED); + if(cache_wt) { + BKE_ptcache_validate(cache_wt, framenr); + cache_wt->flag &= ~PTCACHE_REDO_NEEDED; + } } if(framenr < startframe) @@ -1368,6 +1375,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM if(cache_result == PTCACHE_READ_EXACT) { BKE_ptcache_validate(cache, framenr); + smd->time = framenr; if(sds->wt) { @@ -1388,14 +1396,21 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM else return; } - - /* only calculate something when we advanced a frame */ - if(framenr == smd->time) + /* only calculate something when we advanced a single frame */ + else if(framenr != (int)smd->time+1) return; tstart(); smoke_calc_domain(scene, ob, smd); + + /* if on second frame, write cache for first frame */ + /* this needs to be done for smoke too so that pointcache works properly */ + if((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) { + BKE_ptcache_write_cache(&pid, startframe); + if(sds->wt) + BKE_ptcache_write_cache(&pid_wt, startframe); + } // set new time smd->time = scene->r.cfra; |