Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2020-07-03 16:27:12 +0300
committerBastien Montagne <bastien@blender.org>2020-07-03 16:28:09 +0300
commitc9975088a908d0321271185661309e23e8bc1fb4 (patch)
tree41ed00898abd0648709bd7f8d1e1ed2c80ffe425 /source/blender/blenloader
parent1e255ce0319d6cf45b6951a2a87590d2ca236e9f (diff)
Move volume to new cache management system for undo.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readblenentry.c6
-rw-r--r--source/blender/blenloader/intern/readfile.c16
2 files changed, 9 insertions, 13 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 4af9399573a..e1350f9de66 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -399,9 +399,6 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain,
/* makes lookup of existing video clips in old main */
blo_make_movieclip_pointer_map(fd, oldmain);
- /* make lookups of existing volume data in old main */
- blo_make_volume_pointer_map(fd, oldmain);
-
/* removed packed data from this trick - it's internal data that needs saves */
blo_cache_storage_init(fd, oldmain);
@@ -419,9 +416,6 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain,
/* ensures relinked movie clips are not freed */
blo_end_movieclip_pointer_map(fd, oldmain);
- /* ensures relinked volumes are not freed */
- blo_end_volume_pointer_map(fd, oldmain);
-
/* Still in-use libraries have already been moved from oldmain to new mainlist,
* but oldmain itself shall *never* be 'transferred' to new mainlist! */
BLI_assert(old_mainlist.first == oldmain);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 31843efaaf8..5a2b8da6ef9 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4360,9 +4360,10 @@ static void direct_link_text(BlendDataReader *reader, Text *text)
static void lib_link_image(BlendLibReader *UNUSED(reader), Image *ima)
{
- /* Images have some kind of 'main' cache, when NULL we should also clear all others.
- * XXX It is not ideal to do that from here, but for now it will do. We have to do it after all
- * cache pointers have been potentially remapped (in undo case) or NULL-ified. */
+ /* Images have some kind of 'main' cache, when NULL we should also clear all others. */
+ /* Needs to be done *after* cache pointers are restored (call to
+ * `foreach_cache`/`blo_cache_storage_entry_restore_in_new`), easier for now to do it in
+ * lib_link... */
if (ima->cache == NULL) {
BKE_image_free_buffers(ima);
}
@@ -8946,6 +8947,11 @@ static void direct_link_pointcloud(BlendDataReader *reader, PointCloud *pointclo
static void lib_link_volume(BlendLibReader *reader, Volume *volume)
{
+ /* Needs to be done *after* cache pointers are restored (call to
+ * `foreach_cache`/`blo_cache_storage_entry_restore_in_new`), easier for now to do it in
+ * lib_link... */
+ BKE_volume_init_grids(volume);
+
for (int a = 0; a < volume->totcol; a++) {
BLO_read_id_address(reader, volume->id.lib, &volume->mat[a]);
}
@@ -8957,11 +8963,7 @@ static void direct_link_volume(BlendDataReader *reader, Volume *volume)
direct_link_animdata(reader, volume->adt);
volume->packedfile = direct_link_packedfile(reader, volume->packedfile);
- volume->runtime.grids = (reader->fd->volumemap) ?
- newvolumeadr(reader->fd, volume->runtime.grids) :
- NULL;
volume->runtime.frame = 0;
- BKE_volume_init_grids(volume);
/* materials */
BLO_read_pointer_array(reader, (void **)&volume->mat);