diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2021-12-28 13:22:23 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2021-12-28 14:56:09 +0300 |
commit | a7dca135dc78b8c9644543ed99ef126971d74703 (patch) | |
tree | 976ca53da75be0866ac9b38d8740421d5cfe4527 | |
parent | b29e33caa2b6102b813a8bf8d443180c8815c184 (diff) |
Fix loss of cloth disk cache on reload in library overrides.
If the override system creates an override record for the cache
name (no idea why though), it trashes the disk cache on file load.
The reason is that it tries to rename cache files in update handler
when assigning the name, and BLI_rename deletes the target file even
if both names are the same.
This is a safe fix that simply aborts the pointless rename attempt.
Differential Revision: https://developer.blender.org/D13679
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index df76f003498..38575f3048f 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -3505,6 +3505,11 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c char old_path_full[MAX_PTCACHE_FILE]; char ext[MAX_PTCACHE_PATH]; + /* If both names are the same, there is nothing to do. */ + if (STREQ(name_src, name_dst)) { + return; + } + /* save old name */ BLI_strncpy(old_name, pid->cache->name, sizeof(old_name)); |