From a7dca135dc78b8c9644543ed99ef126971d74703 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Tue, 28 Dec 2021 13:22:23 +0300 Subject: 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 --- source/blender/blenkernel/intern/pointcache.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/blenkernel') 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)); -- cgit v1.2.3