Fix RigidBodyWorld copy using `NO_MAIN` instead of `COW` flag for cache handling.

We only want to share caches in case of CoW copying for the depsgraph,
not for regular `NO_MAIN` data.
This commit is contained in:
Bastien Montagne 2021-09-30 15:29:43 +02:00
parent 1a72744ddc
commit d754d85845
1 changed files with 2 additions and 2 deletions

View File

@ -1211,8 +1211,8 @@ RigidBodyWorld *BKE_rigidbody_world_copy(RigidBodyWorld *rbw, const int flag)
id_us_plus((ID *)rbw_copy->constraints);
}
if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) {
/* This is a regular copy, and not a CoW copy for depsgraph evaluation */
if ((flag & LIB_ID_COPY_SET_COPIED_ON_WRITE) == 0) {
/* This is a regular copy, and not a CoW copy for depsgraph evaluation. */
rbw_copy->shared = MEM_callocN(sizeof(*rbw_copy->shared), "RigidBodyWorld_Shared");
BKE_ptcache_copy_list(&rbw_copy->shared->ptcaches, &rbw->shared->ptcaches, LIB_ID_COPY_CACHES);
rbw_copy->shared->pointcache = rbw_copy->shared->ptcaches.first;