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/light.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/light.c')
-rw-r--r-- | source/blender/blenkernel/intern/light.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c index d91d80ac683..c2b71b85973 100644 --- a/source/blender/blenkernel/intern/light.c +++ b/source/blender/blenkernel/intern/light.c @@ -136,27 +136,26 @@ static void light_foreach_id(ID *id, LibraryForeachIDData *data) static void light_blend_write(BlendWriter *writer, ID *id, const void *id_address) { Light *la = (Light *)id; - if (la->id.us > 0 || BLO_write_is_undo(writer)) { - /* write LibData */ - BLO_write_id_struct(writer, Light, id_address, &la->id); - BKE_id_blend_write(writer, &la->id); - if (la->adt) { - BKE_animdata_blend_write(writer, la->adt); - } + /* write LibData */ + BLO_write_id_struct(writer, Light, id_address, &la->id); + BKE_id_blend_write(writer, &la->id); - if (la->curfalloff) { - BKE_curvemapping_blend_write(writer, la->curfalloff); - } + if (la->adt) { + BKE_animdata_blend_write(writer, la->adt); + } - /* Node-tree is integral part of lights, no libdata. */ - if (la->nodetree) { - BLO_write_struct(writer, bNodeTree, la->nodetree); - ntreeBlendWrite(writer, la->nodetree); - } + if (la->curfalloff) { + BKE_curvemapping_blend_write(writer, la->curfalloff); + } - BKE_previewimg_blend_write(writer, la->preview); + /* Node-tree is integral part of lights, no libdata. */ + if (la->nodetree) { + BLO_write_struct(writer, bNodeTree, la->nodetree); + ntreeBlendWrite(writer, la->nodetree); } + + BKE_previewimg_blend_write(writer, la->preview); } static void light_blend_read_data(BlendDataReader *reader, ID *id) |