Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2009-09-05 03:06:15 +0400
committerJanne Karhu <jhkarh@gmail.com>2009-09-05 03:06:15 +0400
commitf09d6054100a17cc6129d035cf3634394f5e9377 (patch)
treec5d67a77bd266cb6a93158c38a3880dfe7086c6b /source/blender/blenkernel/intern/cloth.c
parentec5a8c010c8100a1709786f81d5b9b501383287a (diff)
Some particles cleanup & fixes:
- Some big refresh issues with softbody & cloth point cache usage should now be fixed. - Removed sticky objects from particles (better stuff will come back when I get to updating reactor particles). - Some initial easy memory efficiency cleanup for ParticleData struct. The ultimate goal is to get particles less memory hungry -> more particles possible in single scene. - Wrong path timing clamping caused hair particles to seem disappeared when changing between normal<->hair particles. - "Calculate to current frame" in cache buttons baked instead of the intended function. - Boids particle data is now a bit better organized.
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r--source/blender/blenkernel/intern/cloth.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index eafd9eb01fe..8be8df8e63b 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -496,23 +496,30 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
if(!do_init_cloth(ob, clmd, result, framenr))
return result;
+ if(framenr == startframe && cache->flag & PTCACHE_REDO_NEEDED) {
+ BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
+ cache->simframe= framenr;
+ cache->flag &= ~PTCACHE_REDO_NEEDED;
+ return result;
+ }
+
/* try to read from cache */
cache_result = BKE_ptcache_read_cache(&pid, (float)framenr, scene->r.frs_sec);
if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) {
- cache->flag |= PTCACHE_SIMULATION_VALID;
- cache->simframe= framenr;
-
implicit_set_positions(clmd);
cloth_to_object (ob, clmd, result);
+ cache->simframe= framenr;
+ cache->flag |= PTCACHE_SIMULATION_VALID;
+
+ if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
+ BKE_ptcache_write_cache(&pid, framenr);
+
return result;
}
else if(cache_result==PTCACHE_READ_OLD) {
- BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_FREE);
-
implicit_set_positions(clmd);
-
cache->flag |= PTCACHE_SIMULATION_VALID;
}
else if(ob->id.lib || (cache->flag & PTCACHE_BAKED)) {
@@ -524,12 +531,10 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
}
if(framenr == startframe) {
- if(cache->flag & PTCACHE_REDO_NEEDED) {
- BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
- do_init_cloth(ob, clmd, result, framenr);
- }
- cache->flag |= PTCACHE_SIMULATION_VALID;
+ implicit_set_positions(clmd);
+
cache->simframe= framenr;
+ cache->flag |= PTCACHE_SIMULATION_VALID;
/* don't write cache on first frame, but on second frame write
* cache for frame 1 and 2 */