Commit: 3de45ee7fe451ab4267b824a569a2173660d2575
Author: Sergey Sharybin
Date:   Wed Apr 29 23:44:57 2015 +0500
Branches: master
https://developer.blender.org/rB3de45ee7fe451ab4267b824a569a2173660d2575

Fix T44132: Crash after open EXR format

Was own mistake on adding Alpha socket for Combined pass.

===================================================================

M       source/blender/compositor/nodes/COM_ImageNode.cpp
M       source/blender/nodes/composite/nodes/node_composite_image.c

===================================================================

diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp 
b/source/blender/compositor/nodes/COM_ImageNode.cpp
index fdd7503..572e63a 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -79,7 +79,6 @@ void ImageNode::convertToOperations(NodeConverter &converter, 
const CompositorCo
        int numberOfOutputs = this->getNumberOfOutputSockets();
        bool outputStraightAlpha = (editorNode->custom1 & 
CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0;
        BKE_image_user_frame_calc(imageuser, context.getFramenumber(), 0);
-       NodeOperation *combined_operation = NULL;
        /* force a load, we assume iuser index will be set OK anyway */
        if (image && image->type == IMA_TYPE_MULTILAYER) {
                bool is_multilayer_ok = false;
@@ -124,44 +123,40 @@ void ImageNode::convertToOperations(NodeConverter 
&converter, const CompositorCo
                                                }
                                        }
 
-                                       if (STREQ(bnodeSocket->identifier, 
"Alpha")) {
-                                               BLI_assert(combined_operation 
!= NULL);
-                                               NodeOutput *outputSocket = 
this->getOutputSocket(index);
-                                               SeparateChannelOperation 
*separate_operation;
-                                               separate_operation = new 
SeparateChannelOperation();
-                                               
separate_operation->setChannel(3);
-                                               
converter.addOperation(separate_operation);
-                                               
converter.addLink(combined_operation->getOutputSocket(), 
separate_operation->getInputSocket(0));
-                                               
converter.mapOutputSocket(outputSocket, separate_operation->getOutputSocket());
-                                               operation = separate_operation;
-                                       }
-                                       else {
-                                               if (rpass) {
-                                                       switch 
(rpass->channels) {
-                                                               case 1:
-                                                                       
operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, 
index,
-                                                                               
                      rpass->passtype, view, COM_DT_VALUE);
-                                                                       break;
-                                                                       /* 
using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
-                                                                       /* XXX 
any way to detect actual vector images? */
-                                                               case 3:
-                                                                       
operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, 
index,
-                                                                               
                      rpass->passtype, view, COM_DT_VECTOR);
-                                                                       break;
-                                                               case 4:
-                                                                       
operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, 
index,
-                                                                               
                      rpass->passtype, view, COM_DT_COLOR);
-                                                                       break;
-                                                               default:
-                                                                       /* 
dummy operation is added below */
-                                                                       break;
-                                                       }
-                                                       if (index == 0 && 
operation) {
-                                                               
converter.addPreview(operation->getOutputSocket());
-                                                       }
-                                                       if 
(STREQ(rpass->chan_id, "RGBA")) {
-                                                               
combined_operation = operation;
-                                                       }
+                                       if (rpass) {
+                                               switch (rpass->channels) {
+                                                       case 1:
+                                                               operation = 
doMultilayerCheck(converter, rl, image, imageuser, framenumber, index,
+                                                                               
              rpass->passtype, view, COM_DT_VALUE);
+                                                               break;
+                                                               /* using image 
operations for both 3 and 4 channels (RGB and RGBA respectively) */
+                                                               /* XXX any way 
to detect actual vector images? */
+                                                       case 3:
+                                                               operation = 
doMultilayerCheck(converter, rl, image, imageuser, framenumber, index,
+                                                                               
              rpass->passtype, view, COM_DT_VECTOR);
+                                                               break;
+                                                       case 4:
+                                                               operation = 
doMultilayerCheck(converter, rl, image, imageuser, framenumber, index,
+                                                                               
              rpass->passtype, view, COM_DT_COLOR);
+                                                               break;
+                                                       default:
+                                                               /* dummy 
operation is added below */
+                                                               break;
+                                               }
+                                               if (index == 0 && operation) {
+                                                       
converter.addPreview(operation->getOutputSocket());
+                                               }
+                                               if (rpass->passtype == 
SCE_PASS_COMBINED) {
+                                                       BLI_assert(operation != 
NULL);
+                                                       BLI_assert(index < 
numberOfOutputs - 1);
+                                                       NodeOutput 
*outputSocket = this->getOutputSocket(index + 1);
+                                                       
SeparateChannelOperation *separate_operation;
+                                                       separate_operation = 
new SeparateChannelOperation();
+                                                       
separate_operation->setChannel(3);
+                                                       
converter.addOperation(separate_operation);
+                                                       
converter.addLink(operation->getOutputSocket(), 
separate_operation->getInputSocket(0));
+                                                       
converter.mapOutputSocket(outputSocket, separate_operation->getOutputSocket());
+                                                       index++;
                                                }
                                        }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c 
b/source/blender/nodes/composite/nodes/node_composite_image.c
index 23d4706..19e9344 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -190,7 +190,7 @@ static void cmp_node_image_add_multilayer_outputs(bNodeTree 
*ntree, bNode *node,
                sockdata->pass_index = index;
                sockdata->pass_flag = rpass->passtype;
 
-               if (STREQ(rpass->chan_id, "RGBA")) {
+               if (rpass->passtype == SCE_PASS_COMBINED) {
                        sock = nodeAddStaticSocket(ntree, node, SOCK_OUT, 
SOCK_FLOAT, PROP_NONE, "Alpha", "Alpha");
                        sockdata = MEM_callocN(sizeof(NodeImageLayer), "node 
image layer");
                        sock->storage = sockdata;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to