[Bf-blender-cvs] [d1bc233ffef] master: Undo: Writefile: fix 'id changed' detected when resorting IDs.
Bastien Montagne
noreply at git.blender.org
Fri May 29 14:32:34 CEST 2020
Commit: d1bc233ffeff55568957f15ee129c3cbcb62bdf1
Author: Bastien Montagne
Date: Fri May 29 14:30:02 2020 +0200
Branches: master
https://developer.blender.org/rBd1bc233ffeff55568957f15ee129c3cbcb62bdf1
Undo: Writefile: fix 'id changed' detected when resorting IDs.
The ListBase next/prev pointers will change everytime you add or rename
an ID, also for 'neighbors' data-blocks in the list, causing unnecessary
'changed' detection.
This info is not needed in blendfile anyway, so just NULLify it.
===================================================================
M source/blender/blenloader/intern/writefile.c
===================================================================
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 33467317090..2ffc8505397 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -4141,6 +4141,11 @@ static bool write_file_handle(Main *mainvar,
memcpy(id_buffer, id, idtype_struct_size);
((ID *)id_buffer)->tag = 0;
+ /* Those listbase data change everytime we add/remove an ID, and also often when renaming
+ * one (due to re-sorting). This avoids generating a lot of false 'is changed' detections
+ * between undo steps. */
+ ((ID *)id_buffer)->prev = NULL;
+ ((ID *)id_buffer)->next = NULL;
switch ((ID_Type)GS(id->name)) {
case ID_WM:
More information about the Bf-blender-cvs
mailing list