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>2019-02-06 12:09:00 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-02-06 12:12:46 +0300
commita6ef823ac4686d1dfcb04b49344e4a7c09d378a0 (patch)
tree6a34b6a4ae536921698cb005443794a750dcffd8 /source/blender/blenkernel/intern/softbody.c
parentb294600ddcf17183869e61d878f2801efd52d65d (diff)
Fix T61124: Lag on physics simulation
Need to synchronize simulated frame back to original object. Solves the lag during transformation, but amount of floppyness is lower for some reason. Final animated object behaves the same as in older Blender though.
Diffstat (limited to 'source/blender/blenkernel/intern/softbody.c')
-rw-r--r--source/blender/blenkernel/intern/softbody.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 133d645a279..86791512dc6 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -3344,6 +3344,16 @@ static void softbody_step(struct Depsgraph *depsgraph, Scene *scene, Object *ob,
}
}
+static void sbStoreLastFrame(struct Depsgraph *depsgraph, Object *object, float framenr)
+{
+ if (!DEG_is_active(depsgraph)) {
+ return;
+ }
+ Object *object_orig = DEG_get_original_object(object);
+ object->soft->last_frame = framenr;
+ object_orig->soft->last_frame = framenr;
+}
+
/* simulates one step. framenr is in frames */
void sbObjectStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], int numVerts)
{
@@ -3415,7 +3425,7 @@ void sbObjectStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float c
BKE_ptcache_validate(cache, framenr);
cache->flag &= ~PTCACHE_REDO_NEEDED;
- sb->last_frame = framenr;
+ sbStoreLastFrame(depsgraph, ob, framenr);
return;
}
@@ -3436,7 +3446,7 @@ void sbObjectStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float c
if (cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED && can_write_cache)
BKE_ptcache_write(&pid, framenr);
- sb->last_frame = framenr;
+ sbStoreLastFrame(depsgraph, ob, framenr);
return;
}
@@ -3471,5 +3481,5 @@ void sbObjectStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float c
BKE_ptcache_validate(cache, framenr);
BKE_ptcache_write(&pid, framenr);
- sb->last_frame = framenr;
+ sbStoreLastFrame(depsgraph, ob, framenr);
}