Fix CPU compositor crashes when rendering older files

How to reproduce:
1. Save blend file in 4.2 with preview active for composite or viewer node (see attached example file)
2. Load blend file and render
3. Observe crash

Preview for composite and viewer node was removed in https://projects.blender.org/blender/blender/pulls/127044, but versioning was not addressed in that PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/128292
This commit is contained in:
Habib Gahbiche
2024-10-03 19:40:11 +02:00
committed by Habib Gahbiche
parent 167830da20
commit 0d2f5183d3

View File

@@ -4898,6 +4898,18 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
}
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type != NTREE_COMPOSIT) {
continue;
}
LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) {
if (node->type == CMP_NODE_VIEWER || node->type == CMP_NODE_COMPOSITE) {
node->flag &= ~NODE_PREVIEW;
}
}
}
FOREACH_NODETREE_END;
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 403, 29)) {