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
This commit is contained in:
Brecht Van Lommel 2020-03-28 21:50:56 +01:00
parent f4982b555c
commit 22677d8e1d
1 changed files with 4 additions and 5 deletions

View File

@ -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;
}
}