Fix T59922: crash reading files with older renderlayers

- own error in rB2c196de56bbb163048b08f321983234a5e72e804
- now introduce RE_PASSNAME_DEPRECATED placeholder for old passes
- also dont allocate NodeImageLayers for these

Reviewers: brecht

Maniphest Tasks: T59922

Differential Revision: https://developer.blender.org/D4132
This commit is contained in:
Philipp Oeser 2018-12-28 10:26:45 +01:00
parent 1e935b090b
commit c07ae0e821
Notes: blender-bot 2023-12-22 20:14:11 +01:00
Referenced by issue #59922, latest buildbot crashes when reading older files
3 changed files with 9 additions and 1 deletions

View File

@ -316,6 +316,10 @@ static void do_versions_compositor_render_passes_storage(bNode *node)
int pass_index = 0;
const char *sockname;
for (bNodeSocket *sock = node->outputs.first; sock && pass_index < 31; sock = sock->next, pass_index++) {
if ((pass_index >= 6 && pass_index <= 8) || (pass_index >= 11 && pass_index <= 13)) {
/* deprecated passes */
continue;
}
if (sock->storage == NULL) {
NodeImageLayer *sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer");
sock->storage = sockdata;

View File

@ -266,6 +266,8 @@ typedef enum eScenePassType {
SCE_PASS_ROUGHNESS = (1u << 31u),
} eScenePassType;
#define RE_PASSNAME_DEPRECATED "Deprecated"
#define RE_PASSNAME_COMBINED "Combined"
#define RE_PASSNAME_Z "Depth"
#define RE_PASSNAME_VECTOR "Vector"

View File

@ -354,7 +354,9 @@ const char *node_cmp_rlayers_sock_to_pass(int sock_index)
{
const char *sock_to_passname[] = {
RE_PASSNAME_COMBINED, RE_PASSNAME_COMBINED,
RE_PASSNAME_Z, RE_PASSNAME_NORMAL, RE_PASSNAME_UV, RE_PASSNAME_VECTOR, RE_PASSNAME_SHADOW, RE_PASSNAME_AO,
RE_PASSNAME_Z, RE_PASSNAME_NORMAL, RE_PASSNAME_UV, RE_PASSNAME_VECTOR, RE_PASSNAME_DEPRECATED,
RE_PASSNAME_DEPRECATED, RE_PASSNAME_DEPRECATED, RE_PASSNAME_SHADOW, RE_PASSNAME_AO,
RE_PASSNAME_DEPRECATED, RE_PASSNAME_DEPRECATED, RE_PASSNAME_DEPRECATED,
RE_PASSNAME_INDEXOB, RE_PASSNAME_INDEXMA, RE_PASSNAME_MIST, RE_PASSNAME_EMIT, RE_PASSNAME_ENVIRONMENT,
RE_PASSNAME_DIFFUSE_DIRECT, RE_PASSNAME_DIFFUSE_INDIRECT, RE_PASSNAME_DIFFUSE_COLOR,
RE_PASSNAME_GLOSSY_DIRECT, RE_PASSNAME_GLOSSY_INDIRECT, RE_PASSNAME_GLOSSY_COLOR,