[Bf-blender-cvs] [22677d8e1d8] master: Fix undo incorrectly detecting mesh as always changed after edits

Brecht Van Lommel noreply at git.blender.org
Mon Mar 30 20:11:11 CEST 2020


Commit: 22677d8e1d88aca4fe8fb89f51596fb3f7af6934
Author: Brecht Van Lommel
Date:   Sat Mar 28 21:50:56 2020 +0100
Branches: master
https://developer.blender.org/rB22677d8e1d88aca4fe8fb89f51596fb3f7af6934

Fix undo incorrectly detecting mesh as always changed after edits

Mesh writes a modified copy, which meant recalc_undo_accumulated was never
cleared on the actual datablock. Also clear mesh->runtime on write to avoid
detecting changes, since it's cleared on read anyway.

Differential Revision: https://developer.blender.org/D7274

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

M	source/blender/blenloader/intern/writefile.c

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

diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 599e592c77d..2c0dcd83cea 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -734,11 +734,6 @@ static void write_iddata(WriteData *wd, 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)
@@ -2213,6 +2208,7 @@ static void write_mesh(WriteData *wd, Mesh *mesh)
     mesh->mface = NULL;
     mesh->totface = 0;
     memset(&mesh->fdata, 0, sizeof(mesh->fdata));
+    memset(&mesh->runtime, 0, sizeof(mesh->runtime));
 
     /* Reduce xdata layers, fill xlayers with layers to be written.
      * This makes xdata invalid for Blender, which is why we made a
@@ -4142,6 +4138,9 @@ static bool write_file_handle(Main *mainvar,
           /* Very important to do it after every ID write now, otherwise we cannot know whether a
            * specific ID changed or not. */
           mywrite_flush(wd);
+
+          /* Clear the accumulated recalc flags in case of undo step saving. */
+          id->recalc_undo_accumulated = 0;
         }
       }



More information about the Bf-blender-cvs mailing list