Fix T59922: crash reading files with older renderlayers
authorPhilipp Oeser <info@graphics-engineer.com>
Fri, 28 Dec 2018 09:26:45 +0000 (10:26 +0100)
committerPhilipp Oeser <info@graphics-engineer.com>
Fri, 28 Dec 2018 10:32:33 +0000 (11:32 +0100)
- 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

source/blender/blenloader/intern/versioning_270.c
source/blender/makesdna/DNA_scene_types.h
source/blender/nodes/composite/nodes/node_composite_image.c

index 7e201aaf1d1d44604d41f64334ad2bf932c9a3f5..201e3bf1c51b2da62d29f06ef9d5ce5036ef3026 100644 (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;
index ad33c57b3c8ee7fef8773d5b3ad22a7bb032ae2e..2d0838a04c5fbbfe4b6c0112a7f05feac5915af8 100644 (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"
index 8d400ada0c7cf914c13c67b6044776e2ae6cf4a9..6cb7704d1a76a9bf27d35f77876e34d06b330206 100644 (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,