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/readfile.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/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 79a552a5b86..2a48bf8fc5a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5437,7 +5437,18 @@ static void direct_link_object(FileData *fd, Object *ob) if (!sb->effector_weights) sb->effector_weights = BKE_add_effector_weights(NULL); - direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, 0); + sb->shared = newdataadr(fd, sb->shared); + if (sb->shared == NULL) { + /* Link deprecated caches if they exist, so we can use them for versioning. + * We should only do this when sb->shared == NULL, because those pointers + * are always set (for compatibility with older Blenders). We mustn't link + * the same pointcache twice. */ + direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, false); + } + else { + /* link caches */ + direct_link_pointcache_list(fd, &sb->shared->ptcaches, &sb->shared->pointcache, false); + } } ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */ |