diff options
author | Bastien Montagne <bastien@blender.org> | 2021-08-19 12:13:55 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-08-19 16:09:33 +0300 |
commit | 0f49e4832cf2afad437aa16ebbbe37191de9af71 (patch) | |
tree | b4b8aeb04e1aecc5246d11c240b740a88dcf9699 /source/blender/blenloader/intern | |
parent | d5776f48297e79467407164fe9cb4042dbeccb31 (diff) |
Cleanup: Blendwrite: Move code deciding if an ID should be written out of ID callbacks.
This was not really useful, and added estra useless steps in case and ID
should not actually be written.
Further more, it prevented clearing the usercount on write, which can be
cause a false positive 'chanhged' detection in undo/redo case.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 225548f3832..337279ae84b 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -982,6 +982,14 @@ static bool write_file_handle(Main *mainvar, BLI_assert( (id->tag & (LIB_TAG_NO_MAIN | LIB_TAG_NO_USER_REFCOUNT | LIB_TAG_NOT_ALLOCATED)) == 0); + /* We only write unused IDs in undo case. + * NOTE: All Scenes, WindowManagers and WorkSpaces should always be written to disk, so + * their usercount should never be NULL currently. */ + if (id->us == 0 && !wd->use_memfile) { + BLI_assert(!ELEM(GS(id->name), ID_SCE, ID_WM, ID_WS)); + continue; + } + const bool do_override = !ELEM(override_storage, NULL, bmain) && ID_IS_OVERRIDE_LIBRARY_REAL(id); |