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
This commit is contained in:
Alexander Gavrilov 2021-12-28 13:22:23 +03:00
parent b29e33caa2
commit a7dca135dc
1 changed files with 5 additions and 0 deletions

View File

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