[Bf-blender-cvs] [0c7fc3a9618] blender2.8: Alembic import: assign cache_file handle to original datablock

Sybren A. Stüvel noreply at git.blender.org
Fri Jun 8 13:54:35 CEST 2018


Commit: 0c7fc3a9618c2bd410c45953f49f836ee866502c
Author: Sybren A. Stüvel
Date:   Fri Jun 8 13:52:18 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0c7fc3a9618c2bd410c45953f49f836ee866502c

Alembic import: assign cache_file handle to original datablock

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

M	source/blender/blenkernel/intern/cachefile.c
M	source/blender/modifiers/intern/MOD_meshsequencecache.c

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

diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c
index 89c6fad086d..d0cdfd6aeed 100644
--- a/source/blender/blenkernel/intern/cachefile.c
+++ b/source/blender/blenkernel/intern/cachefile.c
@@ -146,6 +146,9 @@ void BKE_cachefile_reload(const Main *bmain, CacheFile *cache_file)
 
 void BKE_cachefile_ensure_handle(const Main *bmain, CacheFile *cache_file)
 {
+	/* Assigning to a CoW copy is a bad idea; assign to the original instead. */
+	BLI_assert((cache_file->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0);
+
 	BLI_spin_lock(&spin);
 	if (cache_file->handle_mutex == NULL) {
 		cache_file->handle_mutex = BLI_mutex_alloc();
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index 5ebf67b8d5f..abd84799457 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -103,7 +103,7 @@ static Mesh *applyModifier(
 	const float time = BKE_cachefile_time_offset(mcmd->cache_file, frame, FPS);
 	const char *err_str = NULL;
 
-	CacheFile *cache_file = mcmd->cache_file;
+	CacheFile *cache_file = (CacheFile *)DEG_get_original_id(&mcmd->cache_file->id);
 
 	BKE_cachefile_ensure_handle(G.main, cache_file);



More information about the Bf-blender-cvs mailing list