diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-07-04 12:22:15 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-07-04 12:33:27 +0300 |
commit | 769c57b38a707397ac7fdda15b1deb561194b66c (patch) | |
tree | c618131eb63627c5a353c8ba1437c359b72ddbad /source/blender/blenloader/intern/writefile.c | |
parent | 9e4d667c2cfd4a81f9a69628b69facd8fd4e0a01 (diff) |
SoftBody: share point cache between CoW copies
This is the same approach as 98a0bcd4252e952fa5438e9d1b69b0204f8a8746
applied to soft body simulation. In short, CoW copies share the point cache,
and treat it as read-only except when the depsgraph is active.
Diffstat (limited to 'source/blender/blenloader/intern/writefile.c')
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index e7bca4c7e5b..146494e6196 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1816,9 +1816,13 @@ static void write_object(WriteData *wd, Object *ob) write_motionpath(wd, ob->mpath); writestruct(wd, DATA, PartDeflect, 1, ob->pd); - writestruct(wd, DATA, SoftBody, 1, ob->soft); if (ob->soft) { - write_pointcaches(wd, &ob->soft->ptcaches); + /* Set deprecated pointers to prevent crashes of older Blenders */ + ob->soft->pointcache = ob->soft->shared->pointcache; + ob->soft->ptcaches = ob->soft->shared->ptcaches; + writestruct(wd, DATA, SoftBody, 1, ob->soft); + writestruct(wd, DATA, SoftBody_Shared, 1, ob->soft->shared); + write_pointcaches(wd, &(ob->soft->shared->ptcaches)); writestruct(wd, DATA, EffectorWeights, 1, ob->soft->effector_weights); } |