[Bf-blender-cvs] [a7dca135dc7] master: Fix loss of cloth disk cache on reload in library overrides.

Alexander Gavrilov noreply at git.blender.org
Tue Dec 28 12:57:28 CET 2021


Commit: a7dca135dc78b8c9644543ed99ef126971d74703
Author: Alexander Gavrilov
Date:   Tue Dec 28 13:22:23 2021 +0300
Branches: master
https://developer.blender.org/rBa7dca135dc78b8c9644543ed99ef126971d74703

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

===================================================================

M	source/blender/blenkernel/intern/pointcache.c

===================================================================

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



More information about the Bf-blender-cvs mailing list