From cc55f97da9cca7a27f2313b7405d3aad277029d7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 9 Dec 2015 19:31:39 +0500 Subject: Compositor: Add option to extend image bounds when blurring It is handy when doing some roto work and it's required to blur some mask or overaly before alpha-overing it on top of the footage. Quite straightforward option with the only limitation that variable size blur is not supported. Reviewers: campbellbarton Subscribers: hype, sebastian_k Differential Revision: https://developer.blender.org/D1663 --- source/blender/compositor/nodes/COM_BlurNode.cpp | 18 +++++++++++++----- source/blender/compositor/nodes/COM_BokehBlurNode.cpp | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'source/blender/compositor/nodes') diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp index f3d0c33d3b3..6fbfc24a6b6 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BlurNode.cpp @@ -46,13 +46,15 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon bool connectedSizeSocket = inputSizeSocket->isLinked(); const float size = this->getInputSocket(1)->getEditorValueFloat(); - + const bool extend_bounds = (editorNode->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0; + CompositorQuality quality = context.getQuality(); NodeOperation *input_operation = NULL, *output_operation = NULL; if (data->filtertype == R_FILTER_FAST_GAUSS) { FastGaussianBlurOperation *operationfgb = new FastGaussianBlurOperation(); operationfgb->setData(data); + operationfgb->setExtendBounds(extend_bounds); converter.addOperation(operationfgb); converter.mapInputSocket(getInputSocket(1), operationfgb->getInputSocket(1)); @@ -77,6 +79,7 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon operationx->setSize(1.0f); operationx->setFalloff(PROP_SMOOTH); operationx->setSubtract(false); + operationx->setExtendBounds(extend_bounds); converter.addOperation(operationx); converter.addLink(clamp->getOutputSocket(), operationx->getInputSocket(0)); @@ -87,14 +90,16 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon operationy->setSize(1.0f); operationy->setFalloff(PROP_SMOOTH); operationy->setSubtract(false); - + operationy->setExtendBounds(extend_bounds); + converter.addOperation(operationy); converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); GaussianBlurReferenceOperation *operation = new GaussianBlurReferenceOperation(); operation->setData(data); operation->setQuality(quality); - + operation->setExtendBounds(extend_bounds); + converter.addOperation(operation); converter.addLink(operationy->getOutputSocket(), operation->getInputSocket(1)); @@ -106,7 +111,8 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon operationx->setData(data); operationx->setQuality(quality); operationx->checkOpenCL(); - + operationx->setExtendBounds(extend_bounds); + converter.addOperation(operationx); converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); @@ -114,6 +120,7 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon operationy->setData(data); operationy->setQuality(quality); operationy->checkOpenCL(); + operationy->setExtendBounds(extend_bounds); converter.addOperation(operationy); converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); @@ -131,7 +138,8 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation(); operation->setData(data); operation->setQuality(quality); - + operation->setExtendBounds(extend_bounds); + converter.addOperation(operation); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp index 7ab05e438ec..91c26eecb73 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp @@ -41,6 +41,7 @@ void BokehBlurNode::convertToOperations(NodeConverter &converter, const Composit NodeInput *inputSizeSocket = this->getInputSocket(2); bool connectedSizeSocket = inputSizeSocket->isLinked(); + const bool extend_bounds = (b_node->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0; if ((b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) && connectedSizeSocket) { VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); @@ -58,6 +59,7 @@ void BokehBlurNode::convertToOperations(NodeConverter &converter, const Composit else { BokehBlurOperation *operation = new BokehBlurOperation(); operation->setQuality(context.getQuality()); + operation->setExtendBounds(extend_bounds); converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); -- cgit v1.2.3