Commit: b97a90468a2392a758c55e74a65341245fb3d641
Author: Stefan Werner
Date:   Fri Apr 7 10:56:46 2017 +0200
Branches: temp_cryptomatte
https://developer.blender.org/rBb97a90468a2392a758c55e74a65341245fb3d641

Compositor: Added image in/out features to Cryptomatte node

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

M       source/blender/compositor/nodes/COM_CryptomatteNode.cpp
M       source/blender/nodes/composite/nodes/node_composite_cryptomatte.c

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

diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp 
b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp
index ab3cfbc7562..d97dbb70365 100644
--- a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp
@@ -22,6 +22,8 @@
 
 #include "COM_CryptomatteNode.h"
 #include "COM_CryptomatteOperation.h"
+#include "COM_SetAlphaOperation.h"
+#include "COM_ConvertOperation.h"
 #include <iterator>
 
 CryptomatteNode::CryptomatteNode(bNode *editorNode) : Node(editorNode)
@@ -255,9 +257,13 @@ extern "C" void cryptomatte_remove(NodeCryptomatte*n, 
float f)
 
 void CryptomatteNode::convertToOperations(NodeConverter &converter, const 
CompositorContext &/*context*/) const
 {
-       CryptomatteOperation *operation = new CryptomatteOperation();
+       NodeInput *inputSocketImage = this->getInputSocket(0);
+       NodeOutput *outputSocketImage = this->getOutputSocket(0);
+       NodeOutput *outputSocketMatte = this->getOutputSocket(1);
+       NodeOutput *outputCryptoPick = this->getOutputSocket(2);
        
        bNode *node = this->getbNode();
+       CryptomatteOperation *operation = new CryptomatteOperation();
        NodeCryptomatte *cryptoMatteSettings = (NodeCryptomatte *)node->storage;
        if(cryptoMatteSettings) {
                std::string input = cryptoMatteSettings->matte_id;
@@ -283,9 +289,22 @@ void CryptomatteNode::convertToOperations(NodeConverter 
&converter, const Compos
        }
        
        converter.addOperation(operation);
-       NodeOutput *outputSocket = this->getOutputSocket(0);
        
        for(int i = 0; i < 6; i++)
-               converter.mapInputSocket(this->getInputSocket(i), 
operation->getInputSocket(i));
-       converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
+               converter.mapInputSocket(this->getInputSocket(i+1), 
operation->getInputSocket(i));
+       
+       SeparateChannelOperation *separateOperation = new 
SeparateChannelOperation;
+       separateOperation->setChannel(3);
+       converter.addOperation(separateOperation);
+       
+       SetAlphaOperation *operationAlpha = new SetAlphaOperation();
+       converter.addOperation(operationAlpha);
+       
+       converter.mapInputSocket(inputSocketImage, 
operationAlpha->getInputSocket(0));
+       converter.mapOutputSocket(outputSocketMatte, 
separateOperation->getOutputSocket(0));
+       converter.mapOutputSocket(outputSocketImage, 
operationAlpha->getOutputSocket(0));
+       converter.mapOutputSocket(outputCryptoPick, 
operation->getOutputSocket(0));
+       
+       converter.addLink(operation->getOutputSocket(0), 
separateOperation->getInputSocket(0));
+       converter.addLink(separateOperation->getOutputSocket(0), 
operationAlpha->getInputSocket(1));
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c 
b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
index 653480cdef3..bd4df0104ee 100644
--- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
@@ -36,6 +36,7 @@ extern void cryptomatte_add(NodeCryptomatte* n, float f);
 extern void cryptomatte_remove(NodeCryptomatte*n, float f);
 
 static bNodeSocketTemplate inputs[] = {
+       {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 
1.0f, 1.0f},
        {       SOCK_RGBA, 1, N_("Pass 1"),                     0.0f, 0.0f, 
0.0f, 1.0f},
        {       SOCK_RGBA, 1, N_("Pass 2"),                     0.0f, 0.0f, 
0.0f, 1.0f},
        {       SOCK_RGBA, 1, N_("Pass 3"),                     0.0f, 0.0f, 
0.0f, 1.0f},
@@ -45,7 +46,9 @@ static bNodeSocketTemplate inputs[] = {
        {       -1, 0, ""       }
 };
 static bNodeSocketTemplate outputs[] = {
-       {       SOCK_RGBA, 0, N_("Mask")},
+       {       SOCK_RGBA,      0, N_("Image")},
+       {       SOCK_FLOAT, 0, N_("Matte")},
+       {       SOCK_RGBA,      0, N_("CryptoPick")},
        {       -1, 0, ""       }
 };

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

Reply via email to