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-09-14 15:55:48 +0300
committerJeroen Bakker <jeroen@blender.org>2020-09-21 10:32:39 +0300
commit1442827a4ffc84272fe047931812af7718b90f30 (patch)
tree1ebb73a3b023fe44ce95a45dc913ac2e4b7c41e1
parentf822cd511c2314420aa225cf2fc245032b2c4953 (diff)
Fix T78392: [2.83.5, 2.90, 2.91] Crash on undo/ redo after changing modes.
During undo/redo read code is expected to clear the `OB_MODE_EDIT` bitflag of `Object.mode`, for some reasons. This was not done anymore for re-used Objects, we need to add a special handling case for that too. Should be backported to 2.90 and 2.83 (will probably not be straight forward for the latter).
-rw-r--r--source/blender/blenloader/intern/readfile.c3
-rw-r--r--source/blender/blenloader/intern/writefile.c9
2 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 134e23d36e8..2f73abf430e 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9153,6 +9153,9 @@ static void read_libblock_undo_restore_identical(
if (ob->proxy != NULL) {
ob->proxy->proxy_from = ob;
}
+ /* For undo we stay in object mode during undo presses, so keep editmode disabled for re-used
+ * data-blocks too. */
+ ob->mode &= ~OB_MODE_EDIT;
}
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 6f9f3eec31d..ad4460c552c 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1844,10 +1844,17 @@ static void write_shaderfxs(BlendWriter *writer, ListBase *fxbase)
static void write_object(BlendWriter *writer, Object *ob, const void *id_address)
{
- if (ob->id.us > 0 || BLO_write_is_undo(writer)) {
+ const bool is_undo = BLO_write_is_undo(writer);
+ if (ob->id.us > 0 || is_undo) {
/* Clean up, important in undo case to reduce false detection of changed datablocks. */
BKE_object_runtime_reset(ob);
+ if (is_undo) {
+ /* For undo we stay in object mode during undo presses, so keep editmode disabled on save as
+ * well, can help reducing false detection of changed datablocks. */
+ ob->mode &= ~OB_MODE_EDIT;
+ }
+
/* write LibData */
BLO_write_id_struct(writer, Object, id_address, &ob->id);
write_iddata(writer, &ob->id);