diff options
Diffstat (limited to 'source/blender/compositor/nodes/COM_ViewLevelsNode.cpp')
-rw-r--r-- | source/blender/compositor/nodes/COM_ViewLevelsNode.cpp | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp index a515bfc7f47..30f51794e8d 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp @@ -31,52 +31,34 @@ ViewLevelsNode::ViewLevelsNode(bNode *editorNode) : Node(editorNode) /* pass */ } -void ViewLevelsNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) +void ViewLevelsNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { - InputSocket *input = this->getInputSocket(0); - bool firstOperationConnected = false; - if (input->isConnected()) { - OutputSocket *inputSocket = input->getConnection()->getFromSocket(); + NodeInput *input = this->getInputSocket(0); + if (input->isLinked()) { // add preview to inputSocket; - OutputSocket *socket = this->getOutputSocket(0); - if (socket->isConnected()) { - // calculate mean operation + /* calculate mean operation */ + { CalculateMeanOperation *operation = new CalculateMeanOperation(); - input->relinkConnections(operation->getInputSocket(0), 0, graph); - firstOperationConnected = true; operation->setSetting(this->getbNode()->custom1); - socket->relinkConnections(operation->getOutputSocket()); - graph->addOperation(operation); + + converter.addOperation(operation); + converter.mapInputSocket(input, operation->getInputSocket(0)); + converter.mapOutputSocket(this->getOutputSocket(0), operation->getOutputSocket()); } - socket = this->getOutputSocket(1); - if (socket->isConnected()) { - // calculate standard deviation operation + /* calculate standard deviation operation */ + { CalculateStandardDeviationOperation *operation = new CalculateStandardDeviationOperation(); - if (firstOperationConnected) { - addLink(graph, inputSocket, operation->getInputSocket(0)); - } - else { - input->relinkConnections(operation->getInputSocket(0), 0, graph); - } operation->setSetting(this->getbNode()->custom1); - socket->relinkConnections(operation->getOutputSocket()); - graph->addOperation(operation); + + converter.addOperation(operation); + converter.mapInputSocket(input, operation->getInputSocket(0)); + converter.mapOutputSocket(this->getOutputSocket(1), operation->getOutputSocket()); } } else { - SetValueOperation *meanOutput = new SetValueOperation(); - SetValueOperation *stdDevOutput = new SetValueOperation(); - - meanOutput->setValue(0.0f); - stdDevOutput->setValue(0.0f); - - this->getOutputSocket(0)->relinkConnections(meanOutput->getOutputSocket()); - this->getOutputSocket(1)->relinkConnections(stdDevOutput->getOutputSocket()); - - graph->addOperation(meanOutput); - graph->addOperation(stdDevOutput); + converter.addOutputValue(getOutputSocket(0), 0.0f); + converter.addOutputValue(getOutputSocket(1), 0.0f); } } - |