[Bf-blender-cvs] [9837a32822b] master: Correction to previous commit re ID tags and undo.

Bastien Montagne noreply at git.blender.org
Tue Dec 20 05:07:17 CET 2022


Commit: 9837a32822b97f03a53588682db40ef84d8f7fc7
Author: Bastien Montagne
Date:   Tue Dec 20 13:05:47 2022 +0900
Branches: master
https://developer.blender.org/rB9837a32822b97f03a53588682db40ef84d8f7fc7

Correction to previous commit re ID tags and undo.

Explicitely separate handling of ID tags for undo read/write versus
regular .blend file read/write.

===================================================================

M	source/blender/blenloader/intern/readfile.cc
M	source/blender/blenloader/intern/writefile.cc

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.cc b/source/blender/blenloader/intern/readfile.cc
index 938041368f0..f7fffd82db4 100644
--- a/source/blender/blenloader/intern/readfile.cc
+++ b/source/blender/blenloader/intern/readfile.cc
@@ -2034,7 +2034,12 @@ static void direct_link_id_common(
   id->py_instance = nullptr;
 
   /* Initialize with provided tag. */
-  id->tag = tag | (id->tag & LIB_TAG_KEEP_ON_UNDO);
+  if (BLO_read_data_is_undo(reader)) {
+    id->tag = tag | (id->tag & LIB_TAG_KEEP_ON_UNDO);
+  }
+  else {
+    id->tag = tag;
+  }
 
   if (ID_IS_LINKED(id)) {
     id->library_weak_reference = nullptr;
diff --git a/source/blender/blenloader/intern/writefile.cc b/source/blender/blenloader/intern/writefile.cc
index 7e2840c3379..a964c9bd983 100644
--- a/source/blender/blenloader/intern/writefile.cc
+++ b/source/blender/blenloader/intern/writefile.cc
@@ -1253,7 +1253,12 @@ static bool write_file_handle(Main *mainvar,
         memcpy(id_buffer, id, idtype_struct_size);
 
         /* Clear runtime data to reduce false detection of changed data in undo/redo context. */
-        ((ID *)id_buffer)->tag &= LIB_TAG_KEEP_ON_UNDO;
+        if (wd->use_memfile) {
+          ((ID *)id_buffer)->tag &= LIB_TAG_KEEP_ON_UNDO;
+        }
+        else {
+          ((ID *)id_buffer)->tag = 0;
+        }
         ((ID *)id_buffer)->us = 0;
         ((ID *)id_buffer)->icon_id = 0;
         /* Those listbase data change every time we add/remove an ID, and also often when



More information about the Bf-blender-cvs mailing list