diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/blender_undo.c | 3 | ||||
-rw-r--r-- | source/blender/blenloader/BLO_undofile.h | 1 | ||||
-rw-r--r-- | source/blender/blenloader/intern/undofile.c | 8 |
3 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c index 99eb4dc9122..ab382d0e8ff 100644 --- a/source/blender/blenkernel/intern/blender_undo.c +++ b/source/blender/blenkernel/intern/blender_undo.c @@ -124,6 +124,9 @@ MemFileUndoData *BKE_memfile_undo_encode(Main *bmain, MemFileUndoData *mfu_prev) } else { MemFile *prevfile = (mfu_prev) ? &(mfu_prev->memfile) : NULL; + if (prevfile) { + BLO_memfile_clear_future(prevfile); + } /* success = */ /* UNUSED */ BLO_write_file_mem(bmain, prevfile, &mfu->memfile, G.fileflags); mfu->undo_size = mfu->memfile.size; } diff --git a/source/blender/blenloader/BLO_undofile.h b/source/blender/blenloader/BLO_undofile.h index 5f1142cc20e..f280b8f3b9c 100644 --- a/source/blender/blenloader/BLO_undofile.h +++ b/source/blender/blenloader/BLO_undofile.h @@ -60,6 +60,7 @@ extern void memfile_chunk_add(MemFile *memfile, /* exports */ extern void BLO_memfile_free(MemFile *memfile); extern void BLO_memfile_merge(MemFile *first, MemFile *second); +extern void BLO_memfile_clear_future(MemFile *memfile); /* utilities */ extern struct Main *BLO_memfile_main_get(struct MemFile *memfile, diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c index 06469a0c087..69c4ba2b1f2 100644 --- a/source/blender/blenloader/intern/undofile.c +++ b/source/blender/blenloader/intern/undofile.c @@ -92,6 +92,14 @@ void BLO_memfile_merge(MemFile *first, MemFile *second) BLO_memfile_free(first); } +/* Clear is_identical_future before adding next memfile. */ +void BLO_memfile_clear_future(MemFile *memfile) +{ + for (MemFileChunk *chunk = memfile->chunks.first; chunk; chunk = chunk->next) { + chunk->is_identical_future = false; + } +} + void memfile_chunk_add(MemFile *memfile, const char *buf, uint size, MemFileChunk **compchunk_step) { MemFileChunk *curchunk = MEM_mallocN(sizeof(MemFileChunk), "MemFileChunk"); |