diff options
Diffstat (limited to 'source/blender/blenloader/intern/writefile.c')
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index a92404b2372..29366e3bae5 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -703,7 +703,7 @@ void IDP_WriteProperty(const IDProperty *prop, void *wd) IDP_WriteProperty_OnlyData(prop, wd); } -static void write_iddata(void *wd, const ID *id) +static void write_iddata(WriteData *wd, ID *id) { /* ID_WM's id->properties are considered runtime only, and never written in .blend file. */ if (id->properties && !ELEM(GS(id->name), ID_WM)) { @@ -731,6 +731,11 @@ static void write_iddata(void *wd, const ID *id) } } } + + /* Clear the accumulated recalc flags in case of undo step saving. */ + if (wd->use_memfile) { + id->recalc_undo_accumulated = 0; + } } static void write_previews(WriteData *wd, const PreviewImage *prv_orig) @@ -1131,6 +1136,11 @@ static void write_nodetree_nolib(WriteData *wd, bNodeTree *ntree) for (sock = ntree->outputs.first; sock; sock = sock->next) { write_node_socket_interface(wd, sock); } + + /* Clear the accumulated recalc flags in case of undo step saving. */ + if (wd->use_memfile) { + ntree->id.recalc_undo_accumulated = 0; + } } /** @@ -2425,6 +2435,11 @@ static void write_collection_nolib(WriteData *wd, Collection *collection) for (CollectionChild *child = collection->children.first; child; child = child->next) { writestruct(wd, DATA, CollectionChild, 1, child); } + + /* Clear the accumulated recalc flags in case of undo step saving. */ + if (wd->use_memfile) { + collection->id.recalc_undo_accumulated = 0; + } } static void write_collection(WriteData *wd, Collection *collection) @@ -4012,6 +4027,12 @@ static bool write_file_handle(Main *mainvar, if (do_override) { BKE_lib_override_library_operations_store_end(override_storage, id); } + + if (wd->use_memfile) { + /* Very important to do it after every ID write now, otherwise we cannot know whether a + * specific ID changed or not. */ + mywrite_flush(wd); + } } mywrite_flush(wd); |