SoftBody: share point cache between CoW copies

This is the same approach as 98a0bcd425
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.
This commit is contained in:
2018-07-04 11:22:15 +02:00
parent 9e4d667c2c
commit 769c57b38a
9 changed files with 76 additions and 18 deletions

View File

@@ -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);
}