diff options
Diffstat (limited to 'source/blender/compositor/nodes/COM_NormalNode.cpp')
-rw-r--r-- | source/blender/compositor/nodes/COM_NormalNode.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/source/blender/compositor/nodes/COM_NormalNode.cpp b/source/blender/compositor/nodes/COM_NormalNode.cpp index 41b91f61328..d7c3fd11844 100644 --- a/source/blender/compositor/nodes/COM_NormalNode.cpp +++ b/source/blender/compositor/nodes/COM_NormalNode.cpp @@ -31,32 +31,29 @@ NormalNode::NormalNode(bNode *editorNode) : Node(editorNode) /* pass */ } -void NormalNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) +void NormalNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { - InputSocket *inputSocket = this->getInputSocket(0); - OutputSocket *outputSocket = this->getOutputSocket(0); - OutputSocket *outputSocketDotproduct = this->getOutputSocket(1); + NodeInput *inputSocket = this->getInputSocket(0); + NodeOutput *outputSocket = this->getOutputSocket(0); + NodeOutput *outputSocketDotproduct = this->getOutputSocket(1); SetVectorOperation *operationSet = new SetVectorOperation(); float normal[3]; outputSocket->getEditorValueVector(normal); - /* animation can break normalization, this restores it */ normalize_v3(normal); - operationSet->setX(normal[0]); operationSet->setY(normal[1]); operationSet->setZ(normal[2]); operationSet->setW(0.0f); + converter.addOperation(operationSet); + + converter.mapOutputSocket(outputSocket, operationSet->getOutputSocket(0)); - outputSocket->relinkConnections(operationSet->getOutputSocket(0)); - graph->addOperation(operationSet); + DotproductOperation *operation = new DotproductOperation(); + converter.addOperation(operation); - if (outputSocketDotproduct->isConnected()) { - DotproductOperation *operation = new DotproductOperation(); - outputSocketDotproduct->relinkConnections(operation->getOutputSocket(0)); - inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph); - addLink(graph, operationSet->getOutputSocket(0), operation->getInputSocket(1)); - graph->addOperation(operation); - } + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.addLink(operationSet->getOutputSocket(0), operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocketDotproduct, operation->getOutputSocket(0)); } |