Fix undo misdetecting identical future chunk in some cases
Clear is_identical_future before adding a next undo step, to avoid wrong values for cases where we undo and then add a step with different changes than what was previously the next step. Ref D7274
This commit is contained in:
@@ -124,6 +124,9 @@ MemFileUndoData *BKE_memfile_undo_encode(Main *bmain, MemFileUndoData *mfu_prev)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MemFile *prevfile = (mfu_prev) ? &(mfu_prev->memfile) : NULL;
|
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);
|
/* success = */ /* UNUSED */ BLO_write_file_mem(bmain, prevfile, &mfu->memfile, G.fileflags);
|
||||||
mfu->undo_size = mfu->memfile.size;
|
mfu->undo_size = mfu->memfile.size;
|
||||||
}
|
}
|
||||||
|
@@ -60,6 +60,7 @@ extern void memfile_chunk_add(MemFile *memfile,
|
|||||||
/* exports */
|
/* exports */
|
||||||
extern void BLO_memfile_free(MemFile *memfile);
|
extern void BLO_memfile_free(MemFile *memfile);
|
||||||
extern void BLO_memfile_merge(MemFile *first, MemFile *second);
|
extern void BLO_memfile_merge(MemFile *first, MemFile *second);
|
||||||
|
extern void BLO_memfile_clear_future(MemFile *memfile);
|
||||||
|
|
||||||
/* utilities */
|
/* utilities */
|
||||||
extern struct Main *BLO_memfile_main_get(struct MemFile *memfile,
|
extern struct Main *BLO_memfile_main_get(struct MemFile *memfile,
|
||||||
|
@@ -92,6 +92,14 @@ void BLO_memfile_merge(MemFile *first, MemFile *second)
|
|||||||
BLO_memfile_free(first);
|
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)
|
void memfile_chunk_add(MemFile *memfile, const char *buf, uint size, MemFileChunk **compchunk_step)
|
||||||
{
|
{
|
||||||
MemFileChunk *curchunk = MEM_mallocN(sizeof(MemFileChunk), "MemFileChunk");
|
MemFileChunk *curchunk = MEM_mallocN(sizeof(MemFileChunk), "MemFileChunk");
|
||||||
|
Reference in New Issue
Block a user