Fix #119911: Compositor saved in 4.2 does not work in 4.1

Blend files with compositor node trees saves in 4.2 do not work in older
version. This is because 4.2 removed the chunk size property of the node
tree, so it is set to zero, which is invalid in older versions. To fix
this, we add it again as a deprecated DNA member, and set it to default
value upon write.

Pull Request: https://projects.blender.org/blender/blender/pulls/120246
This commit is contained in:
Omar Emara 2024-04-04 13:14:10 +02:00 committed by Omar Emara
parent 6956a609c9
commit b0bebd6265
2 changed files with 10 additions and 7 deletions

View File

@ -1136,13 +1136,12 @@ static void scene_blend_write(BlendWriter *writer, ID *id, const void *id_addres
if (sce->nodetree) {
BLO_write_init_id_buffer_from_id(
temp_embedded_id_buffer, &sce->nodetree->id, BLO_write_is_undo(writer));
BLO_write_struct_at_address(writer,
bNodeTree,
sce->nodetree,
BLO_write_get_id_buffer_temp_id(temp_embedded_id_buffer));
ntreeBlendWrite(
writer,
reinterpret_cast<bNodeTree *>(BLO_write_get_id_buffer_temp_id(temp_embedded_id_buffer)));
bNodeTree *temp_nodetree = reinterpret_cast<bNodeTree *>(
BLO_write_get_id_buffer_temp_id(temp_embedded_id_buffer));
/* Set deprecated chunksize for forward compatibility. */
temp_nodetree->chunksize = 256;
BLO_write_struct_at_address(writer, bNodeTree, sce->nodetree, temp_nodetree);
ntreeBlendWrite(writer, temp_nodetree);
}
BKE_color_managed_view_settings_blend_write(writer, &sce->view_settings);

View File

@ -681,11 +681,15 @@ typedef struct bNodeTree {
short edit_quality;
/** Quality setting when rendering. */
short render_quality;
/** Tile size for compositor engine. */
int chunksize DNA_DEPRECATED;
/** Execution mode to use for compositor engine. */
int execution_mode;
/** Execution mode to use for compositor engine. */
int precision;
char _pad[4];
rctf viewer_border;
/**