[Bf-blender-cvs] [6b410cecc8c] uuid-undo-experiments-swap-reread-datablocks: undo-experiments: better handling of updated flags.
Bastien Montagne
noreply at git.blender.org
Tue Mar 10 17:35:02 CET 2020
Commit: 6b410cecc8c2ab26f8f4f8ca42a719c844900ff0
Author: Bastien Montagne
Date: Tue Mar 10 14:39:46 2020 +0100
Branches: uuid-undo-experiments-swap-reread-datablocks
https://developer.blender.org/rB6b410cecc8c2ab26f8f4f8ca42a719c844900ff0
undo-experiments: better handling of updated flags.
this already fixes *some* of the depsgraph evaluation crash cases.
Unfortunately we are still missing some cases it'd seem.
===================================================================
M source/blender/blenloader/intern/readfile.c
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5d6dd49844e..a0a80486e4a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2762,10 +2762,13 @@ static void direct_link_id(FileData *fd, ID *id, ID *id_old)
}
}
else {
- /* We are coming from the past (i.e. do a redo), and we found an, we use saved 'accumulated
+ /* We are coming from the past (i.e. do a redo), we use saved 'accumulated
* recalc flags since last memfile undo step saving' as recalc flags of our newly read ID. */
id->recalc = id->recalc_undo_accumulated;
}
+ /* In any case, we need to flush the depsgraph's CoWs, as even if the ID address itself did not
+ * change, internal data most likely have. */
+ id->recalc |= ID_RECALC_COPY_ON_WRITE;
}
/* Link direct data of overrides. */
@@ -9212,6 +9215,24 @@ static BHead *read_libblock(FileData *fd,
*r_id = id_old;
}
+ /* Even though we re-use the old ID as-is, it does not mean that we are 100% safe from
+ * needing some depsgraph updates for it (it could depend on another ID which address did
+ * not change, but which actual content might have been re-read from the memfile). */
+ if (fd->undo_direction < 0) {
+ /* We are coming from the future (i.e. do an actual undo, and not a redo), we use our
+ * old reused ID's 'accumulated recalc flags since last memfile undo step saving' as
+ * recalc flags. */
+ id_old->recalc = id_old->recalc_undo_accumulated;
+ }
+ else {
+ /* We are coming from the past (i.e. do a redo), we use the saved 'accumulated recalc
+ * flags since last memfile undo step saving' from the newly read ID as recalc flags.
+ */
+ id_old->recalc = id->recalc_undo_accumulated;
+ }
+ /* There is no need to flush the depsgraph's CoWs here, since that ID's data itself did
+ * not change. */
+
MEM_freeN(id);
oldnewmap_free_unused(fd->datamap);
oldnewmap_clear(fd->datamap);
More information about the Bf-blender-cvs
mailing list