Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
| Show All 13 Lines | |||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
| * | * | ||||
| * Copyright 2011, Blender Foundation. | * Copyright 2011, Blender Foundation. | ||||
| */ | */ | ||||
| #include "COM_DifferenceMatteNode.h" | #include "COM_DifferenceMatteNode.h" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| #include "COM_DifferenceMatteOperation.h" | #include "COM_DifferenceMatteOperation.h" | ||||
| #include "COM_SetAlphaOperation.h" | #include "COM_SetAlphaMultiplyOperation.h" | ||||
| DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode) : Node(editorNode) | DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode) : Node(editorNode) | ||||
| { | { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| void DifferenceMatteNode::convertToOperations(NodeConverter &converter, | void DifferenceMatteNode::convertToOperations(NodeConverter &converter, | ||||
| const CompositorContext & /*context*/) const | const CompositorContext & /*context*/) const | ||||
| { | { | ||||
| NodeInput *inputSocket = this->getInputSocket(0); | NodeInput *inputSocket = this->getInputSocket(0); | ||||
| NodeInput *inputSocket2 = this->getInputSocket(1); | NodeInput *inputSocket2 = this->getInputSocket(1); | ||||
| NodeOutput *outputSocketImage = this->getOutputSocket(0); | NodeOutput *outputSocketImage = this->getOutputSocket(0); | ||||
| NodeOutput *outputSocketMatte = this->getOutputSocket(1); | NodeOutput *outputSocketMatte = this->getOutputSocket(1); | ||||
| bNode *editorNode = this->getbNode(); | bNode *editorNode = this->getbNode(); | ||||
| DifferenceMatteOperation *operationSet = new DifferenceMatteOperation(); | DifferenceMatteOperation *operationSet = new DifferenceMatteOperation(); | ||||
| operationSet->setSettings((NodeChroma *)editorNode->storage); | operationSet->setSettings((NodeChroma *)editorNode->storage); | ||||
| converter.addOperation(operationSet); | converter.addOperation(operationSet); | ||||
| converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); | converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); | ||||
| converter.mapInputSocket(inputSocket2, operationSet->getInputSocket(1)); | converter.mapInputSocket(inputSocket2, operationSet->getInputSocket(1)); | ||||
| converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); | converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); | ||||
| SetAlphaOperation *operation = new SetAlphaOperation(); | SetAlphaMultiplyOperation *operation = new SetAlphaMultiplyOperation(); | ||||
| converter.addOperation(operation); | converter.addOperation(operation); | ||||
| converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); | converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); | ||||
| converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); | converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); | ||||
| converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); | converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); | ||||
| converter.addPreview(operation->getOutputSocket()); | converter.addPreview(operation->getOutputSocket()); | ||||
| } | } | ||||