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/blenkernel/intern/screen.c | |
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/blenkernel/intern/screen.c')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index e44c5a6b40e..1e725a6afc4 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -255,18 +255,16 @@ static void screen_foreach_id(ID *id, LibraryForeachIDData *data) static void screen_blend_write(BlendWriter *writer, ID *id, const void *id_address) { bScreen *screen = (bScreen *)id; - /* Screens are reference counted, only saved if used by a workspace. */ - if (screen->id.us > 0 || BLO_write_is_undo(writer)) { - /* write LibData */ - /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */ - BLO_write_struct_at_address_with_filecode(writer, ID_SCRN, bScreen, id_address, screen); - BKE_id_blend_write(writer, &screen->id); - BKE_previewimg_blend_write(writer, screen->preview); + /* write LibData */ + /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */ + BLO_write_struct_at_address_with_filecode(writer, ID_SCRN, bScreen, id_address, screen); + BKE_id_blend_write(writer, &screen->id); - /* direct data */ - BKE_screen_area_map_blend_write(writer, AREAMAP_FROM_SCREEN(screen)); - } + BKE_previewimg_blend_write(writer, screen->preview); + + /* direct data */ + BKE_screen_area_map_blend_write(writer, AREAMAP_FROM_SCREEN(screen)); } /* Cannot use IDTypeInfo callback yet, because of the return value. */ |