diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-03-21 23:36:06 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-03-21 23:36:06 +0300 |
commit | df7b696b73ccd018909e005e2a583e1430e2a620 (patch) | |
tree | 5d67e9d68cfc41f00947f4f4955dd9909560ec4f /source/blender/blenkernel/intern/softbody.c | |
parent | dd4a8bff516bcc7c0dc14325cfff6ede17118e27 (diff) |
Big cleanup of particle system core, also some minor pointcache cleanup. Shouldn't contain any functional changes.
Diffstat (limited to 'source/blender/blenkernel/intern/softbody.c')
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index af40d9be643..4b19e71dfca 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -4058,17 +4058,13 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i /* check for changes in mesh, should only happen in case the mesh * structure changes during an animation */ if(sb->bpoint && numVerts != sb->totpoint) { - cache->flag &= ~PTCACHE_SIMULATION_VALID; - cache->simframe= 0; - cache->last_exact= 0; + BKE_ptcache_invalidate(cache); return; } /* clamp frame ranges */ if(framenr < startframe) { - cache->flag &= ~PTCACHE_SIMULATION_VALID; - cache->simframe= 0; - //cache->last_exact= 0; + BKE_ptcache_invalidate(cache); return; } else if(framenr > endframe) { @@ -4101,8 +4097,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i /* continue physics special case */ if(BKE_ptcache_get_continue_physics()) { - cache->flag &= ~PTCACHE_SIMULATION_VALID; - cache->simframe= 0; + BKE_ptcache_invalidate(cache); /* do simulation */ dtime = timescale; softbody_update_positions(ob, sb, vertexCos, numVerts); @@ -4121,8 +4116,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i /* first frame, no simulation to do, just set the positions */ softbody_update_positions(ob, sb, vertexCos, numVerts); - cache->simframe= framenr; - cache->flag |= PTCACHE_SIMULATION_VALID; + BKE_ptcache_validate(cache, framenr); cache->flag &= ~PTCACHE_REDO_NEEDED; return; } @@ -4133,8 +4127,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) { softbody_to_object(ob, vertexCos, numVerts, sb->local); - cache->simframe= framenr; - cache->flag |= PTCACHE_SIMULATION_VALID; + BKE_ptcache_validate(cache, framenr); if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED) BKE_ptcache_write_cache(&pid, framenr); @@ -4142,13 +4135,11 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i return; } else if(cache_result==PTCACHE_READ_OLD) { - cache->flag |= PTCACHE_SIMULATION_VALID; + ; /* do nothing */ } else if(ob->id.lib || (cache->flag & PTCACHE_BAKED)) { /* if baked and nothing in cache, do nothing */ - cache->flag &= ~PTCACHE_SIMULATION_VALID; - cache->simframe= 0; - cache->last_exact= 0; + BKE_ptcache_invalidate(cache); return; } @@ -4166,8 +4157,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i softbody_to_object(ob, vertexCos, numVerts, 0); - cache->simframe= framenr; - cache->flag |= PTCACHE_SIMULATION_VALID; + BKE_ptcache_validate(cache, framenr); BKE_ptcache_write_cache(&pid, framenr); } |