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.
This commit is contained in:
Bastien Montagne 2022-12-20 13:05:47 +09:00
parent 194cc8410b
commit 9837a32822
2 changed files with 12 additions and 2 deletions

View File

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

View File

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