diff options
Diffstat (limited to 'source/blender/compositor/nodes')
-rw-r--r-- | source/blender/compositor/nodes/COM_BokehBlurNode.cpp | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp index 0ea4b20c793..300193da842 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp @@ -37,32 +37,24 @@ BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode) void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { -// Object *camob = context->getScene()->camera; + BokehBlurOperation *operation = new BokehBlurOperation(); + InputSocket *inputSizeSocket = this->getInputSocket(2); + bool connectedSizeSocket = inputSizeSocket->isConnected(); -// if (this->getInputSocket(2)->isConnected()) { -// VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); -// ConvertDepthToRadiusOperation *converter = new ConvertDepthToRadiusOperation(); -// converter->setfStop(this->getbNode()->custom3); -// converter->setCameraObject(camob); -// operation->setMaxBlur((int)this->getbNode()->custom4); -// operation->setQuality(context->getQuality()); -// this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); -// this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph); -// this->getInputSocket(2)->relinkConnections(converter->getInputSocket(0), 2, graph); -// addLink(graph, converter->getOutputSocket(), operation->getInputSocket(2)); -// graph->addOperation(operation); -// graph->addOperation(converter); -// this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket()); -// } -// else { - BokehBlurOperation *operation = new BokehBlurOperation(); - this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); - this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph); - this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph); - operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value); - operation->setQuality(context->getQuality()); - operation->setbNode(this->getbNode()); - graph->addOperation(operation); - this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket()); -// } + const bNodeSocket *sock = this->getInputSocket(2)->getbNodeSocket(); + const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value; + + this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); + this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph); + this->getInputSocket(2)->relinkConnections(operation->getInputSocket(3), 2, graph); + this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph); + //operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value); + operation->setQuality(context->getQuality()); + operation->setbNode(this->getbNode()); + graph->addOperation(operation); + this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket()); + + if (!connectedSizeSocket) { + operation->setSize(size); + } } |