diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-10 19:31:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-10 19:31:54 +0400 |
commit | b84c1dd59240560a6d681a3853c82eeac3b0d350 (patch) | |
tree | 07bd750bc7ed34ade4b3eec0969547d9199d644c /source/blender/compositor/nodes | |
parent | 2a1b7f7f8eaef4fd66d9031f8e906f5ba8a9a5b2 (diff) |
compositor: bokeh blur size input can now be an image, in this case it uses VariableSizeBokehBlurOperation class internally.
updated opencl too.
Diffstat (limited to 'source/blender/compositor/nodes')
-rw-r--r-- | source/blender/compositor/nodes/COM_BokehBlurNode.cpp | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp index f45572fe4ae..434fcf2a608 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp @@ -36,24 +36,42 @@ BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode) void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { - BokehBlurOperation *operation = new BokehBlurOperation(); InputSocket *inputSizeSocket = this->getInputSocket(2); bool connectedSizeSocket = inputSizeSocket->isConnected(); - const bNodeSocket *sock = this->getInputSocket(2)->getbNodeSocket(); - const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value; + if (connectedSizeSocket) { + VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); - 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()); + this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); + this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph); + this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph); + operation->setQuality(context->getQuality()); + operation->setbNode(this->getbNode()); + graph->addOperation(operation); + this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket()); + + operation->setThreshold(0.0f); + + /* TODO, we need to know the max input pixel of the input, this value is arbitrary! */ + operation->setMaxBlur(100.0f); + operation->setDoScaleSize(true); + } + else { + BokehBlurOperation *operation = new BokehBlurOperation(); + + 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); } } |