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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-01-09 18:08:06 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-01-09 18:08:06 +0400
commit8198880d44ca3a7af4f3bbd16097beceb30ec029 (patch)
tree593a1fc06bbbf21c1ef518d8ed3b3ad1fe43c727 /source/blender/blenkernel/intern/cloth.c
parentec58ff19adfc8c117a289139f3060a52277aaf47 (diff)
Fix #29793: Physics go crazy if frames get skipped
Calculate cloth and softbody only for single frame time deltas (like it's already done for smoke)
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r--source/blender/blenkernel/intern/cloth.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 4d5dce14b27..73428c889dc 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -47,7 +47,6 @@
#include "BKE_modifier.h"
#include "BKE_pointcache.h"
-
#ifdef _WIN32
void tstart ( void )
{}
@@ -377,6 +376,8 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
}
implicit_set_positions(clmd);
+
+ clmd->clothObject->last_frame= MINFRAME-1;
}
return 1;
@@ -477,6 +478,8 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
do_step_cloth(ob, clmd, dm, framenr);
cloth_to_object(ob, clmd, result);
+ clmd->clothObject->last_frame= framenr;
+
return result;
}
@@ -498,6 +501,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
do_init_cloth(ob, clmd, dm, framenr);
BKE_ptcache_validate(cache, framenr);
cache->flag &= ~PTCACHE_REDO_NEEDED;
+ clmd->clothObject->last_frame= framenr;
return result;
}
@@ -513,6 +517,8 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
BKE_ptcache_write(&pid, framenr);
+ clmd->clothObject->last_frame= framenr;
+
return result;
}
else if(cache_result==PTCACHE_READ_OLD) {
@@ -524,6 +530,9 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
return result;
}
+ if(framenr!=clmd->clothObject->last_frame+1)
+ return result;
+
/* if on second frame, write cache for first frame */
if(cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
BKE_ptcache_write(&pid, startframe);
@@ -540,6 +549,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
BKE_ptcache_write(&pid, framenr);
cloth_to_object (ob, clmd, result);
+ clmd->clothObject->last_frame= framenr;
return result;
}