Fix T92778: Cloth Point Cache Name disappears after Make Library Override.

Cloth modifier had a unique, weird and weak way of copying its
pointcache, now make it use `BKE_ptcache_copy_list` like done for e.g.
particles or softbody data.
This commit is contained in:
Bastien Montagne 2021-11-04 17:15:34 +01:00
parent ffe115d1a8
commit 2eed1afd11
Notes: blender-bot 2023-02-14 02:27:56 +01:00
Referenced by issue #96931, Regression: Crash on load with library overrides + multiple cloth cache slots
Referenced by issue #92778, Cloth Point Cache Name disappears after Make Library Override
1 changed files with 3 additions and 7 deletions

View File

@ -201,13 +201,9 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
tclmd->point_cache = clmd->point_cache;
}
else {
tclmd->point_cache = BKE_ptcache_add(&tclmd->ptcaches);
if (clmd->point_cache != NULL) {
tclmd->point_cache->step = clmd->point_cache->step;
tclmd->point_cache->startframe = clmd->point_cache->startframe;
tclmd->point_cache->endframe = clmd->point_cache->endframe;
tclmd->point_cache->flag |= (clmd->point_cache->flag & PTCACHE_FLAGS_COPY);
}
const int clmd_point_cache_index = BLI_findindex(&clmd->ptcaches, clmd->point_cache);
BKE_ptcache_copy_list(&tclmd->ptcaches, &clmd->ptcaches, flag);
tclmd->point_cache = BLI_findlink(&tclmd->ptcaches, clmd_point_cache_index);
}
tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms);