From d1bc233ffeff55568957f15ee129c3cbcb62bdf1 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 29 May 2020 14:30:02 +0200 Subject: [PATCH] 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. --- source/blender/blenloader/intern/writefile.c | 5 +++++ 1 file changed, 5 insertions(+) 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: