diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/compositor/nodes | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/compositor/nodes')
164 files changed, 3592 insertions, 3385 deletions
diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp index ba370e38fa6..db05043a925 100644 --- a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp +++ b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp @@ -24,43 +24,43 @@ #include "COM_AlphaOverPremultiplyOperation.h" #include "COM_SetValueOperation.h" -#include "DNA_material_types.h" // the ramp types +#include "DNA_material_types.h" // the ramp types -void AlphaOverNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void AlphaOverNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *color1Socket = this->getInputSocket(1); - NodeInput *color2Socket = this->getInputSocket(2); - bNode *editorNode = this->getbNode(); + NodeInput *color1Socket = this->getInputSocket(1); + NodeInput *color2Socket = this->getInputSocket(2); + bNode *editorNode = this->getbNode(); - MixBaseOperation *convertProg; - NodeTwoFloats *ntf = (NodeTwoFloats *)editorNode->storage; - if (ntf->x != 0.0f) { - AlphaOverMixedOperation *mixOperation = new AlphaOverMixedOperation(); - mixOperation->setX(ntf->x); - convertProg = mixOperation; + MixBaseOperation *convertProg; + NodeTwoFloats *ntf = (NodeTwoFloats *)editorNode->storage; + if (ntf->x != 0.0f) { + AlphaOverMixedOperation *mixOperation = new AlphaOverMixedOperation(); + mixOperation->setX(ntf->x); + convertProg = mixOperation; + } + else if (editorNode->custom1) { + convertProg = new AlphaOverKeyOperation(); + } + else { + convertProg = new AlphaOverPremultiplyOperation(); + } - } - else if (editorNode->custom1) { - convertProg = new AlphaOverKeyOperation(); - } - else { - convertProg = new AlphaOverPremultiplyOperation(); - } + convertProg->setUseValueAlphaMultiply(false); + if (color1Socket->isLinked()) { + convertProg->setResolutionInputSocketIndex(1); + } + else if (color2Socket->isLinked()) { + convertProg->setResolutionInputSocketIndex(2); + } + else { + convertProg->setResolutionInputSocketIndex(0); + } - convertProg->setUseValueAlphaMultiply(false); - if (color1Socket->isLinked()) { - convertProg->setResolutionInputSocketIndex(1); - } - else if (color2Socket->isLinked()) { - convertProg->setResolutionInputSocketIndex(2); - } - else { - convertProg->setResolutionInputSocketIndex(0); - } - - converter.addOperation(convertProg); - converter.mapInputSocket(getInputSocket(0), convertProg->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), convertProg->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), convertProg->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), convertProg->getOutputSocket(0)); + converter.addOperation(convertProg); + converter.mapInputSocket(getInputSocket(0), convertProg->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), convertProg->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(2), convertProg->getInputSocket(2)); + converter.mapOutputSocket(getOutputSocket(0), convertProg->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.h b/source/blender/compositor/nodes/COM_AlphaOverNode.h index b064d257c81..27e868e6f25 100644 --- a/source/blender/compositor/nodes/COM_AlphaOverNode.h +++ b/source/blender/compositor/nodes/COM_AlphaOverNode.h @@ -26,9 +26,11 @@ * \ingroup Node */ class AlphaOverNode : public Node { -public: - AlphaOverNode(bNode *editorNode) : Node(editorNode) {} - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + AlphaOverNode(bNode *editorNode) : Node(editorNode) + { + } + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp index 6a73b043b0e..453b1180467 100644 --- a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp @@ -23,18 +23,19 @@ BilateralBlurNode::BilateralBlurNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void BilateralBlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void BilateralBlurNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - NodeBilateralBlurData *data = (NodeBilateralBlurData *)this->getbNode()->storage; - BilateralBlurOperation *operation = new BilateralBlurOperation(); - operation->setQuality(context.getQuality()); - operation->setData(data); + NodeBilateralBlurData *data = (NodeBilateralBlurData *)this->getbNode()->storage; + BilateralBlurOperation *operation = new BilateralBlurOperation(); + operation->setQuality(context.getQuality()); + operation->setData(data); - converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.addOperation(operation); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.h b/source/blender/compositor/nodes/COM_BilateralBlurNode.h index 6d0120780e1..abed491c891 100644 --- a/source/blender/compositor/nodes/COM_BilateralBlurNode.h +++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class BilateralBlurNode : public Node { -public: - BilateralBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + BilateralBlurNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp index 92ab468c5c8..a43441a2b13 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BlurNode.cpp @@ -31,139 +31,140 @@ BlurNode::BlurNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void BlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void BlurNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - NodeBlurData *data = (NodeBlurData *)editorNode->storage; - NodeInput *inputSizeSocket = this->getInputSocket(1); - 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)); - - input_operation = operationfgb; - output_operation = operationfgb; - } - else if (editorNode->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) { - MathAddOperation *clamp = new MathAddOperation(); - SetValueOperation *zero = new SetValueOperation(); - zero->setValue(0.0f); - clamp->setUseClamp(true); - - converter.addOperation(clamp); - converter.addOperation(zero); - converter.mapInputSocket(getInputSocket(1), clamp->getInputSocket(0)); - converter.addLink(zero->getOutputSocket(), clamp->getInputSocket(1)); - - GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); - operationx->setData(data); - operationx->setQuality(quality); - 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)); - - GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); - operationy->setData(data); - operationy->setQuality(quality); - 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)); - - output_operation = operation; - input_operation = operation; - } - else if (!data->bokeh) { - GaussianXBlurOperation *operationx = new GaussianXBlurOperation(); - operationx->setData(data); - operationx->setQuality(quality); - operationx->checkOpenCL(); - operationx->setExtendBounds(extend_bounds); - - converter.addOperation(operationx); - converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); - - GaussianYBlurOperation *operationy = new GaussianYBlurOperation(); - operationy->setData(data); - operationy->setQuality(quality); - operationy->checkOpenCL(); - operationy->setExtendBounds(extend_bounds); - - converter.addOperation(operationy); - converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); - converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); - - if (!connectedSizeSocket) { - operationx->setSize(size); - operationy->setSize(size); - } - - input_operation = operationx; - output_operation = operationy; - } - else { - GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation(); - operation->setData(data); - operation->setQuality(quality); - operation->setExtendBounds(extend_bounds); - - converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - - if (!connectedSizeSocket) { - operation->setSize(size); - } - - input_operation = operation; - output_operation = operation; - } - - if (data->gamma) { - GammaCorrectOperation *correct = new GammaCorrectOperation(); - GammaUncorrectOperation *inverse = new GammaUncorrectOperation(); - converter.addOperation(correct); - converter.addOperation(inverse); - - converter.mapInputSocket(getInputSocket(0), correct->getInputSocket(0)); - converter.addLink(correct->getOutputSocket(), input_operation->getInputSocket(0)); - converter.addLink(output_operation->getOutputSocket(), inverse->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), inverse->getOutputSocket()); - - converter.addPreview(inverse->getOutputSocket()); - } - else { - converter.mapInputSocket(getInputSocket(0), input_operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), output_operation->getOutputSocket()); - - converter.addPreview(output_operation->getOutputSocket()); - } + bNode *editorNode = this->getbNode(); + NodeBlurData *data = (NodeBlurData *)editorNode->storage; + NodeInput *inputSizeSocket = this->getInputSocket(1); + 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)); + + input_operation = operationfgb; + output_operation = operationfgb; + } + else if (editorNode->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) { + MathAddOperation *clamp = new MathAddOperation(); + SetValueOperation *zero = new SetValueOperation(); + zero->setValue(0.0f); + clamp->setUseClamp(true); + + converter.addOperation(clamp); + converter.addOperation(zero); + converter.mapInputSocket(getInputSocket(1), clamp->getInputSocket(0)); + converter.addLink(zero->getOutputSocket(), clamp->getInputSocket(1)); + + GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); + operationx->setData(data); + operationx->setQuality(quality); + 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)); + + GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); + operationy->setData(data); + operationy->setQuality(quality); + 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)); + + output_operation = operation; + input_operation = operation; + } + else if (!data->bokeh) { + GaussianXBlurOperation *operationx = new GaussianXBlurOperation(); + operationx->setData(data); + operationx->setQuality(quality); + operationx->checkOpenCL(); + operationx->setExtendBounds(extend_bounds); + + converter.addOperation(operationx); + converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); + + GaussianYBlurOperation *operationy = new GaussianYBlurOperation(); + operationy->setData(data); + operationy->setQuality(quality); + operationy->checkOpenCL(); + operationy->setExtendBounds(extend_bounds); + + converter.addOperation(operationy); + converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); + converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); + + if (!connectedSizeSocket) { + operationx->setSize(size); + operationy->setSize(size); + } + + input_operation = operationx; + output_operation = operationy; + } + else { + GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation(); + operation->setData(data); + operation->setQuality(quality); + operation->setExtendBounds(extend_bounds); + + converter.addOperation(operation); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + + if (!connectedSizeSocket) { + operation->setSize(size); + } + + input_operation = operation; + output_operation = operation; + } + + if (data->gamma) { + GammaCorrectOperation *correct = new GammaCorrectOperation(); + GammaUncorrectOperation *inverse = new GammaUncorrectOperation(); + converter.addOperation(correct); + converter.addOperation(inverse); + + converter.mapInputSocket(getInputSocket(0), correct->getInputSocket(0)); + converter.addLink(correct->getOutputSocket(), input_operation->getInputSocket(0)); + converter.addLink(output_operation->getOutputSocket(), inverse->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(), inverse->getOutputSocket()); + + converter.addPreview(inverse->getOutputSocket()); + } + else { + converter.mapInputSocket(getInputSocket(0), input_operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(), output_operation->getOutputSocket()); + + converter.addPreview(output_operation->getOutputSocket()); + } } diff --git a/source/blender/compositor/nodes/COM_BlurNode.h b/source/blender/compositor/nodes/COM_BlurNode.h index a8931f42b42..f0d6cad320e 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.h +++ b/source/blender/compositor/nodes/COM_BlurNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class BlurNode : public Node { -public: - BlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + BlurNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp index c20ca9181d1..56b5d35cbf5 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp @@ -27,50 +27,51 @@ BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void BokehBlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void BokehBlurNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *b_node = this->getbNode(); + bNode *b_node = this->getbNode(); - NodeInput *inputSizeSocket = this->getInputSocket(2); + NodeInput *inputSizeSocket = this->getInputSocket(2); - bool connectedSizeSocket = inputSizeSocket->isLinked(); - const bool extend_bounds = (b_node->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0; + 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(); - operation->setQuality(context.getQuality()); - operation->setThreshold(0.0f); - operation->setMaxBlur(b_node->custom4); - operation->setDoScaleSize(true); + if ((b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) && connectedSizeSocket) { + VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); + operation->setQuality(context.getQuality()); + operation->setThreshold(0.0f); + operation->setMaxBlur(b_node->custom4); + operation->setDoScaleSize(true); - converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); - } - else { - BokehBlurOperation *operation = new BokehBlurOperation(); - operation->setQuality(context.getQuality()); - operation->setExtendBounds(extend_bounds); + converter.addOperation(operation); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + } + else { + BokehBlurOperation *operation = new BokehBlurOperation(); + operation->setQuality(context.getQuality()); + operation->setExtendBounds(extend_bounds); - converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.addOperation(operation); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - // NOTE: on the bokeh blur operation the sockets are switched. - // for this reason the next two lines are correct. - // Fix for T43771 - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(3)); - converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(2)); + // NOTE: on the bokeh blur operation the sockets are switched. + // for this reason the next two lines are correct. + // Fix for T43771 + converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(3)); + converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); - if (!connectedSizeSocket) { - operation->setSize(this->getInputSocket(2)->getEditorValueFloat()); - } - } + if (!connectedSizeSocket) { + operation->setSize(this->getInputSocket(2)->getEditorValueFloat()); + } + } } diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.h b/source/blender/compositor/nodes/COM_BokehBlurNode.h index 0edb48accf0..e2f728fb30b 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.h +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class BokehBlurNode : public Node { -public: - BokehBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + BokehBlurNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.cpp b/source/blender/compositor/nodes/COM_BokehImageNode.cpp index f8527144cc1..87fe4979c1d 100644 --- a/source/blender/compositor/nodes/COM_BokehImageNode.cpp +++ b/source/blender/compositor/nodes/COM_BokehImageNode.cpp @@ -22,16 +22,17 @@ BokehImageNode::BokehImageNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void BokehImageNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void BokehImageNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - BokehImageOperation *operation = new BokehImageOperation(); - operation->setData((NodeBokehImage *)this->getbNode()->storage); + BokehImageOperation *operation = new BokehImageOperation(); + operation->setData((NodeBokehImage *)this->getbNode()->storage); - converter.addOperation(operation); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.addOperation(operation); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - converter.addPreview(operation->getOutputSocket(0)); + converter.addPreview(operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.h b/source/blender/compositor/nodes/COM_BokehImageNode.h index d84a31a1bc2..3e78e8d5185 100644 --- a/source/blender/compositor/nodes/COM_BokehImageNode.h +++ b/source/blender/compositor/nodes/COM_BokehImageNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class BokehImageNode : public Node { -public: - BokehImageNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + BokehImageNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp index a161440cba4..98b4811743f 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp @@ -25,46 +25,47 @@ BoxMaskNode::BoxMaskNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void BoxMaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void BoxMaskNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *inputSocket = this->getInputSocket(0); + NodeOutput *outputSocket = this->getOutputSocket(0); - BoxMaskOperation *operation; - operation = new BoxMaskOperation(); - operation->setData((NodeBoxMask *)this->getbNode()->storage); - operation->setMaskType(this->getbNode()->custom1); - converter.addOperation(operation); + BoxMaskOperation *operation; + operation = new BoxMaskOperation(); + operation->setData((NodeBoxMask *)this->getbNode()->storage); + operation->setMaskType(this->getbNode()->custom1); + converter.addOperation(operation); - if (inputSocket->isLinked()) { - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); - } - else { - /* Value operation to produce original transparent image */ - SetValueOperation *valueOperation = new SetValueOperation(); - valueOperation->setValue(0.0f); - converter.addOperation(valueOperation); + if (inputSocket->isLinked()) { + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + } + else { + /* Value operation to produce original transparent image */ + SetValueOperation *valueOperation = new SetValueOperation(); + valueOperation->setValue(0.0f); + converter.addOperation(valueOperation); - /* Scale that image up to render resolution */ - const RenderData *rd = context.getRenderData(); - ScaleFixedSizeOperation *scaleOperation = new ScaleFixedSizeOperation(); + /* Scale that image up to render resolution */ + const RenderData *rd = context.getRenderData(); + ScaleFixedSizeOperation *scaleOperation = new ScaleFixedSizeOperation(); - scaleOperation->setIsAspect(false); - scaleOperation->setIsCrop(false); - scaleOperation->setOffset(0.0f, 0.0f); - scaleOperation->setNewWidth(rd->xsch * rd->size / 100.0f); - scaleOperation->setNewHeight(rd->ysch * rd->size / 100.0f); - scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); - converter.addOperation(scaleOperation); + scaleOperation->setIsAspect(false); + scaleOperation->setIsCrop(false); + scaleOperation->setOffset(0.0f, 0.0f); + scaleOperation->setNewWidth(rd->xsch * rd->size / 100.0f); + scaleOperation->setNewHeight(rd->ysch * rd->size / 100.0f); + scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + converter.addOperation(scaleOperation); - converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0)); - converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - } + converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0)); + converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + } - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); } diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.h b/source/blender/compositor/nodes/COM_BoxMaskNode.h index 4ba0aac98b6..0d39014bbd0 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.h +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class BoxMaskNode : public Node { -public: - BoxMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + BoxMaskNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.cpp b/source/blender/compositor/nodes/COM_BrightnessNode.cpp index 26e6106051a..fcd2a6de1f4 100644 --- a/source/blender/compositor/nodes/COM_BrightnessNode.cpp +++ b/source/blender/compositor/nodes/COM_BrightnessNode.cpp @@ -22,18 +22,19 @@ BrightnessNode::BrightnessNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void BrightnessNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void BrightnessNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *bnode = this->getbNode(); - BrightnessOperation *operation = new BrightnessOperation(); - operation->setUsePremultiply((bnode->custom1 & 1) != 0); - converter.addOperation(operation); + bNode *bnode = this->getbNode(); + BrightnessOperation *operation = new BrightnessOperation(); + operation->setUsePremultiply((bnode->custom1 & 1) != 0); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.h b/source/blender/compositor/nodes/COM_BrightnessNode.h index 787c735ac7a..8529fc17d9c 100644 --- a/source/blender/compositor/nodes/COM_BrightnessNode.h +++ b/source/blender/compositor/nodes/COM_BrightnessNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class BrightnessNode : public Node { -public: - BrightnessNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + BrightnessNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp index e7e575b3276..d320a6645e1 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp @@ -24,71 +24,72 @@ ChannelMatteNode::ChannelMatteNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ChannelMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ChannelMatteNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = this->getbNode(); + bNode *node = this->getbNode(); - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); + NodeInput *inputSocketImage = this->getInputSocket(0); + NodeOutput *outputSocketImage = this->getOutputSocket(0); + NodeOutput *outputSocketMatte = this->getOutputSocket(1); - NodeOperation *convert = NULL, *inv_convert = NULL; - /* colorspace */ - switch (node->custom1) { - case CMP_NODE_CHANNEL_MATTE_CS_RGB: - break; - case CMP_NODE_CHANNEL_MATTE_CS_HSV: /* HSV */ - convert = new ConvertRGBToHSVOperation(); - inv_convert = new ConvertHSVToRGBOperation(); - break; - case CMP_NODE_CHANNEL_MATTE_CS_YUV: /* YUV */ - convert = new ConvertRGBToYUVOperation(); - inv_convert = new ConvertYUVToRGBOperation(); - break; - case CMP_NODE_CHANNEL_MATTE_CS_YCC: /* YCC */ - convert = new ConvertRGBToYCCOperation(); - ((ConvertRGBToYCCOperation *)convert)->setMode(BLI_YCC_ITU_BT709); - inv_convert = new ConvertYCCToRGBOperation(); - ((ConvertYCCToRGBOperation *)inv_convert)->setMode(BLI_YCC_ITU_BT709); - break; - default: - break; - } + NodeOperation *convert = NULL, *inv_convert = NULL; + /* colorspace */ + switch (node->custom1) { + case CMP_NODE_CHANNEL_MATTE_CS_RGB: + break; + case CMP_NODE_CHANNEL_MATTE_CS_HSV: /* HSV */ + convert = new ConvertRGBToHSVOperation(); + inv_convert = new ConvertHSVToRGBOperation(); + break; + case CMP_NODE_CHANNEL_MATTE_CS_YUV: /* YUV */ + convert = new ConvertRGBToYUVOperation(); + inv_convert = new ConvertYUVToRGBOperation(); + break; + case CMP_NODE_CHANNEL_MATTE_CS_YCC: /* YCC */ + convert = new ConvertRGBToYCCOperation(); + ((ConvertRGBToYCCOperation *)convert)->setMode(BLI_YCC_ITU_BT709); + inv_convert = new ConvertYCCToRGBOperation(); + ((ConvertYCCToRGBOperation *)inv_convert)->setMode(BLI_YCC_ITU_BT709); + break; + default: + break; + } - ChannelMatteOperation *operation = new ChannelMatteOperation(); - /* pass the ui properties to the operation */ - operation->setSettings((NodeChroma *)node->storage, node->custom2); - converter.addOperation(operation); + ChannelMatteOperation *operation = new ChannelMatteOperation(); + /* pass the ui properties to the operation */ + operation->setSettings((NodeChroma *)node->storage, node->custom2); + converter.addOperation(operation); - SetAlphaOperation *operationAlpha = new SetAlphaOperation(); - converter.addOperation(operationAlpha); + SetAlphaOperation *operationAlpha = new SetAlphaOperation(); + converter.addOperation(operationAlpha); - if (convert != NULL) { - converter.addOperation(convert); + if (convert != NULL) { + converter.addOperation(convert); - converter.mapInputSocket(inputSocketImage, convert->getInputSocket(0)); - converter.addLink(convert->getOutputSocket(), operation->getInputSocket(0)); - converter.addLink(convert->getOutputSocket(), operationAlpha->getInputSocket(0)); - } - else { - converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0)); - converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); - } + converter.mapInputSocket(inputSocketImage, convert->getInputSocket(0)); + converter.addLink(convert->getOutputSocket(), operation->getInputSocket(0)); + converter.addLink(convert->getOutputSocket(), operationAlpha->getInputSocket(0)); + } + else { + converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0)); + converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); + } - converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); - converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); + converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); + converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); - if (inv_convert != NULL) { - converter.addOperation(inv_convert); - converter.addLink(operationAlpha->getOutputSocket(0), inv_convert->getInputSocket(0)); - converter.mapOutputSocket(outputSocketImage, inv_convert->getOutputSocket()); - converter.addPreview(inv_convert->getOutputSocket()); - } - else { - converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); - converter.addPreview(operationAlpha->getOutputSocket()); - } + if (inv_convert != NULL) { + converter.addOperation(inv_convert); + converter.addLink(operationAlpha->getOutputSocket(0), inv_convert->getInputSocket(0)); + converter.mapOutputSocket(outputSocketImage, inv_convert->getOutputSocket()); + converter.addPreview(inv_convert->getOutputSocket()); + } + else { + converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); + converter.addPreview(operationAlpha->getOutputSocket()); + } } diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.h b/source/blender/compositor/nodes/COM_ChannelMatteNode.h index 94d01e40a72..e6cd8bf6f0d 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.h +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ChannelMatteNode : public Node { -public: - ChannelMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ChannelMatteNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* COM_ChannelMatteNODE_H */ +#endif /* COM_ChannelMatteNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp index 5d758628a24..75d161d7d4d 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp @@ -24,41 +24,42 @@ ChromaMatteNode::ChromaMatteNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ChromaMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ChromaMatteNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorsnode = getbNode(); + bNode *editorsnode = getbNode(); - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeInput *inputSocketKey = this->getInputSocket(1); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); + NodeInput *inputSocketImage = this->getInputSocket(0); + NodeInput *inputSocketKey = this->getInputSocket(1); + NodeOutput *outputSocketImage = this->getOutputSocket(0); + NodeOutput *outputSocketMatte = this->getOutputSocket(1); - ConvertRGBToYCCOperation *operationRGBToYCC_Image = new ConvertRGBToYCCOperation(); - ConvertRGBToYCCOperation *operationRGBToYCC_Key = new ConvertRGBToYCCOperation(); - operationRGBToYCC_Image->setMode(BLI_YCC_ITU_BT709); - operationRGBToYCC_Key->setMode(BLI_YCC_ITU_BT709); - converter.addOperation(operationRGBToYCC_Image); - converter.addOperation(operationRGBToYCC_Key); + ConvertRGBToYCCOperation *operationRGBToYCC_Image = new ConvertRGBToYCCOperation(); + ConvertRGBToYCCOperation *operationRGBToYCC_Key = new ConvertRGBToYCCOperation(); + operationRGBToYCC_Image->setMode(BLI_YCC_ITU_BT709); + operationRGBToYCC_Key->setMode(BLI_YCC_ITU_BT709); + converter.addOperation(operationRGBToYCC_Image); + converter.addOperation(operationRGBToYCC_Key); - ChromaMatteOperation *operation = new ChromaMatteOperation(); - operation->setSettings((NodeChroma *)editorsnode->storage); - converter.addOperation(operation); + ChromaMatteOperation *operation = new ChromaMatteOperation(); + operation->setSettings((NodeChroma *)editorsnode->storage); + converter.addOperation(operation); - SetAlphaOperation *operationAlpha = new SetAlphaOperation(); - converter.addOperation(operationAlpha); + SetAlphaOperation *operationAlpha = new SetAlphaOperation(); + converter.addOperation(operationAlpha); - converter.mapInputSocket(inputSocketImage, operationRGBToYCC_Image->getInputSocket(0)); - converter.mapInputSocket(inputSocketKey, operationRGBToYCC_Key->getInputSocket(0)); - converter.addLink(operationRGBToYCC_Image->getOutputSocket(), operation->getInputSocket(0)); - converter.addLink(operationRGBToYCC_Key->getOutputSocket(), operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket()); + converter.mapInputSocket(inputSocketImage, operationRGBToYCC_Image->getInputSocket(0)); + converter.mapInputSocket(inputSocketKey, operationRGBToYCC_Key->getInputSocket(0)); + converter.addLink(operationRGBToYCC_Image->getOutputSocket(), operation->getInputSocket(0)); + converter.addLink(operationRGBToYCC_Key->getOutputSocket(), operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket()); - converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); - converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); - converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); + converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); + converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); + converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); - converter.addPreview(operationAlpha->getOutputSocket()); + converter.addPreview(operationAlpha->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.h b/source/blender/compositor/nodes/COM_ChromaMatteNode.h index b86b1aa734c..cfb6f23ebcb 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.h +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ChromaMatteNode : public Node { -public: - ChromaMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ChromaMatteNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* COM_ChromaMatteNODE_H */ +#endif /* COM_ChromaMatteNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp index 4fab93c07a1..64503ca306b 100644 --- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp @@ -25,48 +25,49 @@ ColorBalanceNode::ColorBalanceNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ColorBalanceNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ColorBalanceNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = this->getbNode(); - NodeColorBalance *n = (NodeColorBalance *)node->storage; + bNode *node = this->getbNode(); + NodeColorBalance *n = (NodeColorBalance *)node->storage; - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputImageSocket = this->getInputSocket(1); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *inputSocket = this->getInputSocket(0); + NodeInput *inputImageSocket = this->getInputSocket(1); + NodeOutput *outputSocket = this->getOutputSocket(0); - NodeOperation *operation; - if (node->custom1 == 0) { - ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation(); + NodeOperation *operation; + if (node->custom1 == 0) { + ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation(); - float lift_lgg[3], gamma_inv[3]; - for (int c = 0; c < 3; c++) { - lift_lgg[c] = 2.0f - n->lift[c]; - gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f; - } + float lift_lgg[3], gamma_inv[3]; + for (int c = 0; c < 3; c++) { + lift_lgg[c] = 2.0f - n->lift[c]; + gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f; + } - operationLGG->setGain(n->gain); - operationLGG->setLift(lift_lgg); - operationLGG->setGammaInv(gamma_inv); - operation = operationLGG; - } - else { - ColorBalanceASCCDLOperation *operationCDL = new ColorBalanceASCCDLOperation(); + operationLGG->setGain(n->gain); + operationLGG->setLift(lift_lgg); + operationLGG->setGammaInv(gamma_inv); + operation = operationLGG; + } + else { + ColorBalanceASCCDLOperation *operationCDL = new ColorBalanceASCCDLOperation(); - float offset[3]; - copy_v3_fl(offset, n->offset_basis); - add_v3_v3(offset, n->offset); + float offset[3]; + copy_v3_fl(offset, n->offset_basis); + add_v3_v3(offset, n->offset); - operationCDL->setOffset(offset); - operationCDL->setPower(n->power); - operationCDL->setSlope(n->slope); - operation = operationCDL; - } - converter.addOperation(operation); + operationCDL->setOffset(offset); + operationCDL->setPower(n->power); + operationCDL->setSlope(n->slope); + operation = operationCDL; + } + converter.addOperation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputImageSocket, operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapInputSocket(inputImageSocket, operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.h b/source/blender/compositor/nodes/COM_ColorBalanceNode.h index a5e48ed8e0f..482b34e7809 100644 --- a/source/blender/compositor/nodes/COM_ColorBalanceNode.h +++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ColorBalanceNode : public Node { -public: - ColorBalanceNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ColorBalanceNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* COM_ColorBalanceNODE_H */ +#endif /* COM_ColorBalanceNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp index 6881a047fc5..3c2bf0aad07 100644 --- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp @@ -22,21 +22,22 @@ ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ColorCorrectionNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ColorCorrectionNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorNode = getbNode(); + bNode *editorNode = getbNode(); - ColorCorrectionOperation *operation = new ColorCorrectionOperation(); - operation->setData((NodeColorCorrection *)editorNode->storage); - operation->setRedChannelEnabled((editorNode->custom1 & 1) > 0); - operation->setGreenChannelEnabled((editorNode->custom1 & 2) > 0); - operation->setBlueChannelEnabled((editorNode->custom1 & 4) > 0); - converter.addOperation(operation); + ColorCorrectionOperation *operation = new ColorCorrectionOperation(); + operation->setData((NodeColorCorrection *)editorNode->storage); + operation->setRedChannelEnabled((editorNode->custom1 & 1) > 0); + operation->setGreenChannelEnabled((editorNode->custom1 & 2) > 0); + operation->setBlueChannelEnabled((editorNode->custom1 & 4) > 0); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h index 9f3f1e3a84e..0275106095e 100644 --- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h +++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ColorCorrectionNode : public Node { -public: - ColorCorrectionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ColorCorrectionNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.cpp b/source/blender/compositor/nodes/COM_ColorCurveNode.cpp index 1e77f254c8e..e1888f3f0bc 100644 --- a/source/blender/compositor/nodes/COM_ColorCurveNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorCurveNode.cpp @@ -22,35 +22,36 @@ ColorCurveNode::ColorCurveNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ColorCurveNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ColorCurveNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - if (this->getInputSocket(2)->isLinked() || this->getInputSocket(3)->isLinked()) { - ColorCurveOperation *operation = new ColorCurveOperation(); - operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); - converter.addOperation(operation); + if (this->getInputSocket(2)->isLinked() || this->getInputSocket(3)->isLinked()) { + ColorCurveOperation *operation = new ColorCurveOperation(); + operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); + converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); - } - else { - ConstantLevelColorCurveOperation *operation = new ConstantLevelColorCurveOperation(); - float col[4]; - this->getInputSocket(2)->getEditorValueColor(col); - operation->setBlackLevel(col); - this->getInputSocket(3)->getEditorValueColor(col); - operation->setWhiteLevel(col); - operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); - converter.addOperation(operation); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + } + else { + ConstantLevelColorCurveOperation *operation = new ConstantLevelColorCurveOperation(); + float col[4]; + this->getInputSocket(2)->getEditorValueColor(col); + operation->setBlackLevel(col); + this->getInputSocket(3)->getEditorValueColor(col); + operation->setWhiteLevel(col); + operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); - } + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + } } diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.h b/source/blender/compositor/nodes/COM_ColorCurveNode.h index fcf3c56698e..2a529e5713e 100644 --- a/source/blender/compositor/nodes/COM_ColorCurveNode.h +++ b/source/blender/compositor/nodes/COM_ColorCurveNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ColorCurveNode : public Node { -public: - ColorCurveNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ColorCurveNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp index e9b9280f5d7..f5cb84975e9 100644 --- a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp @@ -24,39 +24,40 @@ ColorMatteNode::ColorMatteNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ColorMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ColorMatteNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorsnode = getbNode(); + bNode *editorsnode = getbNode(); - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeInput *inputSocketKey = this->getInputSocket(1); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); + NodeInput *inputSocketImage = this->getInputSocket(0); + NodeInput *inputSocketKey = this->getInputSocket(1); + NodeOutput *outputSocketImage = this->getOutputSocket(0); + NodeOutput *outputSocketMatte = this->getOutputSocket(1); - ConvertRGBToHSVOperation *operationRGBToHSV_Image = new ConvertRGBToHSVOperation(); - ConvertRGBToHSVOperation *operationRGBToHSV_Key = new ConvertRGBToHSVOperation(); - converter.addOperation(operationRGBToHSV_Image); - converter.addOperation(operationRGBToHSV_Key); + ConvertRGBToHSVOperation *operationRGBToHSV_Image = new ConvertRGBToHSVOperation(); + ConvertRGBToHSVOperation *operationRGBToHSV_Key = new ConvertRGBToHSVOperation(); + converter.addOperation(operationRGBToHSV_Image); + converter.addOperation(operationRGBToHSV_Key); - ColorMatteOperation *operation = new ColorMatteOperation(); - operation->setSettings((NodeChroma *)editorsnode->storage); - converter.addOperation(operation); + ColorMatteOperation *operation = new ColorMatteOperation(); + operation->setSettings((NodeChroma *)editorsnode->storage); + converter.addOperation(operation); - SetAlphaOperation *operationAlpha = new SetAlphaOperation(); - converter.addOperation(operationAlpha); + SetAlphaOperation *operationAlpha = new SetAlphaOperation(); + converter.addOperation(operationAlpha); - converter.mapInputSocket(inputSocketImage, operationRGBToHSV_Image->getInputSocket(0)); - converter.mapInputSocket(inputSocketKey, operationRGBToHSV_Key->getInputSocket(0)); - converter.addLink(operationRGBToHSV_Image->getOutputSocket(), operation->getInputSocket(0)); - converter.addLink(operationRGBToHSV_Key->getOutputSocket(), operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); + converter.mapInputSocket(inputSocketImage, operationRGBToHSV_Image->getInputSocket(0)); + converter.mapInputSocket(inputSocketKey, operationRGBToHSV_Key->getInputSocket(0)); + converter.addLink(operationRGBToHSV_Image->getOutputSocket(), operation->getInputSocket(0)); + converter.addLink(operationRGBToHSV_Key->getOutputSocket(), operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); - converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); - converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); - converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); + converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); + converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); + converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); - converter.addPreview(operationAlpha->getOutputSocket()); + converter.addPreview(operationAlpha->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.h b/source/blender/compositor/nodes/COM_ColorMatteNode.h index 39f142f5fe8..1f02a091307 100644 --- a/source/blender/compositor/nodes/COM_ColorMatteNode.h +++ b/source/blender/compositor/nodes/COM_ColorMatteNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ColorMatteNode : public Node { -public: - ColorMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ColorMatteNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* COM_ColorMatteNODE_H */ +#endif /* COM_ColorMatteNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ColorNode.cpp b/source/blender/compositor/nodes/COM_ColorNode.cpp index 45909515101..6bc700e3aa1 100644 --- a/source/blender/compositor/nodes/COM_ColorNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorNode.cpp @@ -22,17 +22,18 @@ ColorNode::ColorNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ColorNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ColorNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - SetColorOperation *operation = new SetColorOperation(); - NodeOutput *output = this->getOutputSocket(0); - float col[4]; - output->getEditorValueColor(col); - operation->setChannels(col); - converter.addOperation(operation); + SetColorOperation *operation = new SetColorOperation(); + NodeOutput *output = this->getOutputSocket(0); + float col[4]; + output->getEditorValueColor(col); + operation->setChannels(col); + converter.addOperation(operation); - converter.mapOutputSocket(output, operation->getOutputSocket()); + converter.mapOutputSocket(output, operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ColorNode.h b/source/blender/compositor/nodes/COM_ColorNode.h index d10a150cbf0..5c7580a9ec9 100644 --- a/source/blender/compositor/nodes/COM_ColorNode.h +++ b/source/blender/compositor/nodes/COM_ColorNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ColorNode : public Node { -public: - ColorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ColorNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.cpp b/source/blender/compositor/nodes/COM_ColorRampNode.cpp index 3f9b7095103..0745f32218d 100644 --- a/source/blender/compositor/nodes/COM_ColorRampNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorRampNode.cpp @@ -25,27 +25,28 @@ ColorRampNode::ColorRampNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ColorRampNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ColorRampNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); - NodeOutput *outputSocketAlpha = this->getOutputSocket(1); - bNode *editorNode = this->getbNode(); + NodeInput *inputSocket = this->getInputSocket(0); + NodeOutput *outputSocket = this->getOutputSocket(0); + NodeOutput *outputSocketAlpha = this->getOutputSocket(1); + bNode *editorNode = this->getbNode(); - ColorRampOperation *operation = new ColorRampOperation(); - operation->setColorBand((ColorBand *)editorNode->storage); - converter.addOperation(operation); + ColorRampOperation *operation = new ColorRampOperation(); + operation->setColorBand((ColorBand *)editorNode->storage); + converter.addOperation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - SeparateChannelOperation *operation2 = new SeparateChannelOperation(); - operation2->setChannel(3); - converter.addOperation(operation2); + SeparateChannelOperation *operation2 = new SeparateChannelOperation(); + operation2->setChannel(3); + converter.addOperation(operation2); - converter.addLink(operation->getOutputSocket(), operation2->getInputSocket(0)); - converter.mapOutputSocket(outputSocketAlpha, operation2->getOutputSocket()); + converter.addLink(operation->getOutputSocket(), operation2->getInputSocket(0)); + converter.mapOutputSocket(outputSocketAlpha, operation2->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.h b/source/blender/compositor/nodes/COM_ColorRampNode.h index fe4af608f2c..3f7a188e549 100644 --- a/source/blender/compositor/nodes/COM_ColorRampNode.h +++ b/source/blender/compositor/nodes/COM_ColorRampNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ColorRampNode : public Node { -public: - ColorRampNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ColorRampNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* COM_ColorRampNODE_H */ +#endif /* COM_ColorRampNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp index 7253c5b4ca5..d1a3099e998 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp @@ -22,25 +22,26 @@ ColorSpillNode::ColorSpillNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ColorSpillNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ColorSpillNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorsnode = getbNode(); + bNode *editorsnode = getbNode(); - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeInput *inputSocketFac = this->getInputSocket(1); - NodeOutput *outputSocketImage = this->getOutputSocket(0); + NodeInput *inputSocketImage = this->getInputSocket(0); + NodeInput *inputSocketFac = this->getInputSocket(1); + NodeOutput *outputSocketImage = this->getOutputSocket(0); - ColorSpillOperation *operation; - operation = new ColorSpillOperation(); - operation->setSettings((NodeColorspill *)editorsnode->storage); - operation->setSpillChannel(editorsnode->custom1 - 1); // Channel for spilling - operation->setSpillMethod(editorsnode->custom2); // Channel method - converter.addOperation(operation); + ColorSpillOperation *operation; + operation = new ColorSpillOperation(); + operation->setSettings((NodeColorspill *)editorsnode->storage); + operation->setSpillChannel(editorsnode->custom1 - 1); // Channel for spilling + operation->setSpillMethod(editorsnode->custom2); // Channel method + converter.addOperation(operation); - converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0)); - converter.mapInputSocket(inputSocketFac, operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); + converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0)); + converter.mapInputSocket(inputSocketFac, operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.h b/source/blender/compositor/nodes/COM_ColorSpillNode.h index fee2d8fa9e3..4678d1dd7b1 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.h +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ColorSpillNode : public Node { -public: - ColorSpillNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ColorSpillNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* COM_ColorSpillNODE_H */ +#endif /* COM_ColorSpillNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp index 371a4085481..4115bad5d3f 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp @@ -23,17 +23,18 @@ ColorToBWNode::ColorToBWNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ColorToBWNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ColorToBWNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *colorSocket = this->getInputSocket(0); - NodeOutput *valueSocket = this->getOutputSocket(0); + NodeInput *colorSocket = this->getInputSocket(0); + NodeOutput *valueSocket = this->getOutputSocket(0); - ConvertColorToBWOperation *convertProg = new ConvertColorToBWOperation(); - converter.addOperation(convertProg); + ConvertColorToBWOperation *convertProg = new ConvertColorToBWOperation(); + converter.addOperation(convertProg); - converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0)); - converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0)); + converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0)); + converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.h b/source/blender/compositor/nodes/COM_ColorToBWNode.h index 179dda5092f..d811cab8019 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.h +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.h @@ -26,8 +26,8 @@ * \ingroup Node */ class ColorToBWNode : public Node { -public: - ColorToBWNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ColorToBWNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.cpp b/source/blender/compositor/nodes/COM_CombineColorNode.cpp index 4c5cdbc2d9c..2f9b14db6af 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.cpp +++ b/source/blender/compositor/nodes/COM_CombineColorNode.cpp @@ -20,72 +20,70 @@ #include "COM_ConvertOperation.h" - -CombineColorNode::CombineColorNode(bNode *editorNode) : - Node(editorNode) +CombineColorNode::CombineColorNode(bNode *editorNode) : Node(editorNode) { } -void CombineColorNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void CombineColorNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - NodeInput *inputRSocket = this->getInputSocket(0); - NodeInput *inputGSocket = this->getInputSocket(1); - NodeInput *inputBSocket = this->getInputSocket(2); - NodeInput *inputASocket = this->getInputSocket(3); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *inputRSocket = this->getInputSocket(0); + NodeInput *inputGSocket = this->getInputSocket(1); + NodeInput *inputBSocket = this->getInputSocket(2); + NodeInput *inputASocket = this->getInputSocket(3); + NodeOutput *outputSocket = this->getOutputSocket(0); - CombineChannelsOperation *operation = new CombineChannelsOperation(); - if (inputRSocket->isLinked()) { - operation->setResolutionInputSocketIndex(0); - } - else if (inputGSocket->isLinked()) { - operation->setResolutionInputSocketIndex(1); - } - else if (inputBSocket->isLinked()) { - operation->setResolutionInputSocketIndex(2); - } - else { - operation->setResolutionInputSocketIndex(3); - } - converter.addOperation(operation); + CombineChannelsOperation *operation = new CombineChannelsOperation(); + if (inputRSocket->isLinked()) { + operation->setResolutionInputSocketIndex(0); + } + else if (inputGSocket->isLinked()) { + operation->setResolutionInputSocketIndex(1); + } + else if (inputBSocket->isLinked()) { + operation->setResolutionInputSocketIndex(2); + } + else { + operation->setResolutionInputSocketIndex(3); + } + converter.addOperation(operation); - converter.mapInputSocket(inputRSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputGSocket, operation->getInputSocket(1)); - converter.mapInputSocket(inputBSocket, operation->getInputSocket(2)); - converter.mapInputSocket(inputASocket, operation->getInputSocket(3)); + converter.mapInputSocket(inputRSocket, operation->getInputSocket(0)); + converter.mapInputSocket(inputGSocket, operation->getInputSocket(1)); + converter.mapInputSocket(inputBSocket, operation->getInputSocket(2)); + converter.mapInputSocket(inputASocket, operation->getInputSocket(3)); - NodeOperation *color_conv = getColorConverter(context); - if (color_conv) { - converter.addOperation(color_conv); + NodeOperation *color_conv = getColorConverter(context); + if (color_conv) { + converter.addOperation(color_conv); - converter.addLink(operation->getOutputSocket(), color_conv->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, color_conv->getOutputSocket()); - } - else { - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); - } + converter.addLink(operation->getOutputSocket(), color_conv->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, color_conv->getOutputSocket()); + } + else { + converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + } } - -NodeOperation *CombineRGBANode::getColorConverter(const CompositorContext &/*context*/) const +NodeOperation *CombineRGBANode::getColorConverter(const CompositorContext & /*context*/) const { - return NULL; /* no conversion needed */ + return NULL; /* no conversion needed */ } -NodeOperation *CombineHSVANode::getColorConverter(const CompositorContext &/*context*/) const +NodeOperation *CombineHSVANode::getColorConverter(const CompositorContext & /*context*/) const { - return new ConvertHSVToRGBOperation(); + return new ConvertHSVToRGBOperation(); } -NodeOperation *CombineYCCANode::getColorConverter(const CompositorContext &/*context*/) const +NodeOperation *CombineYCCANode::getColorConverter(const CompositorContext & /*context*/) const { - ConvertYCCToRGBOperation *operation = new ConvertYCCToRGBOperation(); - bNode *editorNode = this->getbNode(); - operation->setMode(editorNode->custom1); - return operation; + ConvertYCCToRGBOperation *operation = new ConvertYCCToRGBOperation(); + bNode *editorNode = this->getbNode(); + operation->setMode(editorNode->custom1); + return operation; } -NodeOperation *CombineYUVANode::getColorConverter(const CompositorContext &/*context*/) const +NodeOperation *CombineYUVANode::getColorConverter(const CompositorContext & /*context*/) const { - return new ConvertYUVToRGBOperation(); + return new ConvertYUVToRGBOperation(); } diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.h b/source/blender/compositor/nodes/COM_CombineColorNode.h index 870a13b7492..203a8e84306 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.h +++ b/source/blender/compositor/nodes/COM_CombineColorNode.h @@ -22,48 +22,48 @@ #include "COM_Node.h" class CombineColorNode : public Node { -public: - CombineColorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + CombineColorNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; -protected: - virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0; + protected: + virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0; }; class CombineRGBANode : public CombineColorNode { -public: - CombineRGBANode(bNode *editorNode) : - CombineColorNode(editorNode) - {} + public: + CombineRGBANode(bNode *editorNode) : CombineColorNode(editorNode) + { + } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const; }; class CombineHSVANode : public CombineColorNode { -public: - CombineHSVANode(bNode *editorNode) : - CombineColorNode(editorNode) - {} + public: + CombineHSVANode(bNode *editorNode) : CombineColorNode(editorNode) + { + } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const; }; class CombineYCCANode : public CombineColorNode { -public: - CombineYCCANode(bNode *editorNode) : - CombineColorNode(editorNode) - {} + public: + CombineYCCANode(bNode *editorNode) : CombineColorNode(editorNode) + { + } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const; }; class CombineYUVANode : public CombineColorNode { -public: - CombineYUVANode(bNode *editorNode) : - CombineColorNode(editorNode) - {} + public: + CombineYUVANode(bNode *editorNode) : CombineColorNode(editorNode) + { + } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp index e0a6dc4aaeb..30072d6a5a7 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.cpp +++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp @@ -22,38 +22,38 @@ CompositorNode::CompositorNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void CompositorNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void CompositorNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC) || - context.isRendering(); - bool ignore_alpha = (editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0; + bNode *editorNode = this->getbNode(); + bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC) || context.isRendering(); + bool ignore_alpha = (editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0; - NodeInput *imageSocket = this->getInputSocket(0); - NodeInput *alphaSocket = this->getInputSocket(1); - NodeInput *depthSocket = this->getInputSocket(2); + NodeInput *imageSocket = this->getInputSocket(0); + NodeInput *alphaSocket = this->getInputSocket(1); + NodeInput *depthSocket = this->getInputSocket(2); - CompositorOperation *compositorOperation = new CompositorOperation(); - compositorOperation->setScene(context.getScene()); - compositorOperation->setSceneName(context.getScene()->id.name); - compositorOperation->setRenderData(context.getRenderData()); - compositorOperation->setViewName(context.getViewName()); - compositorOperation->setbNodeTree(context.getbNodeTree()); - /* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */ - compositorOperation->setUseAlphaInput(ignore_alpha || alphaSocket->isLinked()); - compositorOperation->setActive(is_active); + CompositorOperation *compositorOperation = new CompositorOperation(); + compositorOperation->setScene(context.getScene()); + compositorOperation->setSceneName(context.getScene()->id.name); + compositorOperation->setRenderData(context.getRenderData()); + compositorOperation->setViewName(context.getViewName()); + compositorOperation->setbNodeTree(context.getbNodeTree()); + /* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */ + compositorOperation->setUseAlphaInput(ignore_alpha || alphaSocket->isLinked()); + compositorOperation->setActive(is_active); - converter.addOperation(compositorOperation); - converter.mapInputSocket(imageSocket, compositorOperation->getInputSocket(0)); - /* only use alpha link if "use alpha" is enabled */ - if (ignore_alpha) - converter.addInputValue(compositorOperation->getInputSocket(1), 1.0f); - else - converter.mapInputSocket(alphaSocket, compositorOperation->getInputSocket(1)); - converter.mapInputSocket(depthSocket, compositorOperation->getInputSocket(2)); + converter.addOperation(compositorOperation); + converter.mapInputSocket(imageSocket, compositorOperation->getInputSocket(0)); + /* only use alpha link if "use alpha" is enabled */ + if (ignore_alpha) + converter.addInputValue(compositorOperation->getInputSocket(1), 1.0f); + else + converter.mapInputSocket(alphaSocket, compositorOperation->getInputSocket(1)); + converter.mapInputSocket(depthSocket, compositorOperation->getInputSocket(2)); - converter.addNodeInputPreview(imageSocket); + converter.addNodeInputPreview(imageSocket); } diff --git a/source/blender/compositor/nodes/COM_CompositorNode.h b/source/blender/compositor/nodes/COM_CompositorNode.h index a3a28903405..8fb2a5a5cf5 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.h +++ b/source/blender/compositor/nodes/COM_CompositorNode.h @@ -26,8 +26,8 @@ * \ingroup Node */ class CompositorNode : public Node { -public: - CompositorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + CompositorNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp index 30856814d5f..da8985de5ac 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp @@ -20,21 +20,22 @@ #include "COM_ConvertOperation.h" #include "COM_ExecutionSystem.h" -void ConvertAlphaNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ConvertAlphaNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeOperation *operation = NULL; - bNode *node = this->getbNode(); + NodeOperation *operation = NULL; + bNode *node = this->getbNode(); - /* value hardcoded in rna_nodetree.c */ - if (node->custom1 == 1) { - operation = new ConvertPremulToStraightOperation(); - } - else { - operation = new ConvertStraightToPremulOperation(); - } + /* value hardcoded in rna_nodetree.c */ + if (node->custom1 == 1) { + operation = new ConvertPremulToStraightOperation(); + } + else { + operation = new ConvertStraightToPremulOperation(); + } - converter.addOperation(operation); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h index 0de34e1ae88..8fdeae39ada 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h @@ -26,9 +26,11 @@ * \ingroup Node */ class ConvertAlphaNode : public Node { -public: - ConvertAlphaNode(bNode *editorNode) : Node(editorNode) {} - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ConvertAlphaNode(bNode *editorNode) : Node(editorNode) + { + } + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_CornerPinNode.cpp b/source/blender/compositor/nodes/COM_CornerPinNode.cpp index 3eefd53e3e8..9a9ecb755af 100644 --- a/source/blender/compositor/nodes/COM_CornerPinNode.cpp +++ b/source/blender/compositor/nodes/COM_CornerPinNode.cpp @@ -24,31 +24,32 @@ CornerPinNode::CornerPinNode(bNode *editorNode) : Node(editorNode) { } -void CornerPinNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void CornerPinNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *input_image = this->getInputSocket(0); - /* note: socket order differs between UI node and operations: - * bNode uses intuitive order following top-down layout: - * upper-left, upper-right, lower-left, lower-right - * Operations use same order as the tracking blenkernel functions expect: - * lower-left, lower-right, upper-right, upper-left - */ - const int node_corner_index[4] = { 3, 4, 2, 1 }; + NodeInput *input_image = this->getInputSocket(0); + /* note: socket order differs between UI node and operations: + * bNode uses intuitive order following top-down layout: + * upper-left, upper-right, lower-left, lower-right + * Operations use same order as the tracking blenkernel functions expect: + * lower-left, lower-right, upper-right, upper-left + */ + const int node_corner_index[4] = {3, 4, 2, 1}; - NodeOutput *output_warped_image = this->getOutputSocket(0); - NodeOutput *output_plane = this->getOutputSocket(1); + NodeOutput *output_warped_image = this->getOutputSocket(0); + NodeOutput *output_plane = this->getOutputSocket(1); - PlaneCornerPinWarpImageOperation *warp_image_operation = new PlaneCornerPinWarpImageOperation(); - converter.addOperation(warp_image_operation); - PlaneCornerPinMaskOperation *plane_mask_operation = new PlaneCornerPinMaskOperation(); - converter.addOperation(plane_mask_operation); + PlaneCornerPinWarpImageOperation *warp_image_operation = new PlaneCornerPinWarpImageOperation(); + converter.addOperation(warp_image_operation); + PlaneCornerPinMaskOperation *plane_mask_operation = new PlaneCornerPinMaskOperation(); + converter.addOperation(plane_mask_operation); - converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0)); - for (int i = 0; i < 4; ++i) { - NodeInput *corner_input = getInputSocket(node_corner_index[i]); - converter.mapInputSocket(corner_input, warp_image_operation->getInputSocket(i + 1)); - converter.mapInputSocket(corner_input, plane_mask_operation->getInputSocket(i)); - } - converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket()); - converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket()); + converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0)); + for (int i = 0; i < 4; ++i) { + NodeInput *corner_input = getInputSocket(node_corner_index[i]); + converter.mapInputSocket(corner_input, warp_image_operation->getInputSocket(i + 1)); + converter.mapInputSocket(corner_input, plane_mask_operation->getInputSocket(i)); + } + converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket()); + converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_CornerPinNode.h b/source/blender/compositor/nodes/COM_CornerPinNode.h index de7b98c598f..ea62dea12de 100644 --- a/source/blender/compositor/nodes/COM_CornerPinNode.h +++ b/source/blender/compositor/nodes/COM_CornerPinNode.h @@ -29,9 +29,9 @@ extern "C" { * \ingroup Node */ class CornerPinNode : public Node { -public: - CornerPinNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + CornerPinNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif /* __COM_CORNERPINNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_CropNode.cpp b/source/blender/compositor/nodes/COM_CropNode.cpp index a7b4090463b..0f0883b0151 100644 --- a/source/blender/compositor/nodes/COM_CropNode.cpp +++ b/source/blender/compositor/nodes/COM_CropNode.cpp @@ -19,29 +19,29 @@ #include "COM_CropNode.h" #include "COM_CropOperation.h" - CropNode::CropNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void CropNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void CropNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = getbNode(); - NodeTwoXYs *cropSettings = (NodeTwoXYs *)node->storage; - bool relative = (bool)node->custom2; - bool cropImage = (bool)node->custom1; - CropBaseOperation *operation; - if (cropImage) { - operation = new CropImageOperation(); - } - else { - operation = new CropOperation(); - } - operation->setCropSettings(cropSettings); - operation->setRelative(relative); - converter.addOperation(operation); + bNode *node = getbNode(); + NodeTwoXYs *cropSettings = (NodeTwoXYs *)node->storage; + bool relative = (bool)node->custom2; + bool cropImage = (bool)node->custom1; + CropBaseOperation *operation; + if (cropImage) { + operation = new CropImageOperation(); + } + else { + operation = new CropOperation(); + } + operation->setCropSettings(cropSettings); + operation->setRelative(relative); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_CropNode.h b/source/blender/compositor/nodes/COM_CropNode.h index 9e24fc492bc..295d4fb77e1 100644 --- a/source/blender/compositor/nodes/COM_CropNode.h +++ b/source/blender/compositor/nodes/COM_CropNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class CropNode : public Node { -public: - CropNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + CropNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp index ad15911062c..4219fd49d44 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp @@ -27,91 +27,91 @@ CryptomatteNode::CryptomatteNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } /* This is taken from the Cryptomatte specification 1.0. */ static inline float hash_to_float(uint32_t hash) { - uint32_t mantissa = hash & (( 1 << 23) - 1); - uint32_t exponent = (hash >> 23) & ((1 << 8) - 1); - exponent = max(exponent, (uint32_t) 1); - exponent = min(exponent, (uint32_t) 254); - exponent = exponent << 23; - uint32_t sign = (hash >> 31); - sign = sign << 31; - uint32_t float_bits = sign | exponent | mantissa; - float f; - /* Bit casting relies on equal size for both types. */ - BLI_STATIC_ASSERT(sizeof(float) == sizeof(uint32_t), "float and uint32_t are not the same size") - ::memcpy(&f, &float_bits, sizeof(float)); - return f; + uint32_t mantissa = hash & ((1 << 23) - 1); + uint32_t exponent = (hash >> 23) & ((1 << 8) - 1); + exponent = max(exponent, (uint32_t)1); + exponent = min(exponent, (uint32_t)254); + exponent = exponent << 23; + uint32_t sign = (hash >> 31); + sign = sign << 31; + uint32_t float_bits = sign | exponent | mantissa; + float f; + /* Bit casting relies on equal size for both types. */ + BLI_STATIC_ASSERT(sizeof(float) == sizeof(uint32_t), "float and uint32_t are not the same size") + ::memcpy(&f, &float_bits, sizeof(float)); + return f; } -void CryptomatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void CryptomatteNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); - NodeOutput *outputSocketPick = this->getOutputSocket(2); + NodeInput *inputSocketImage = this->getInputSocket(0); + NodeOutput *outputSocketImage = this->getOutputSocket(0); + NodeOutput *outputSocketMatte = this->getOutputSocket(1); + NodeOutput *outputSocketPick = this->getOutputSocket(2); - bNode *node = this->getbNode(); - NodeCryptomatte *cryptoMatteSettings = (NodeCryptomatte *)node->storage; + bNode *node = this->getbNode(); + NodeCryptomatte *cryptoMatteSettings = (NodeCryptomatte *)node->storage; - CryptomatteOperation *operation = new CryptomatteOperation(getNumberOfInputSockets() - 1); - if (cryptoMatteSettings) { - if (cryptoMatteSettings->matte_id) { - /* Split the string by commas, ignoring white space. */ - std::string input = cryptoMatteSettings->matte_id; - std::istringstream ss(input); - while (ss.good()) { - std::string token; - getline(ss, token, ','); - /* Ignore empty tokens. */ - if (token.length() > 0) { - size_t first = token.find_first_not_of(' '); - size_t last = token.find_last_not_of(' '); - if (first == std::string::npos || last == std::string::npos) { - break; - } - token = token.substr(first, (last - first + 1)); - if (*token.begin() == '<' && *(--token.end()) == '>') { - operation->addObjectIndex(atof(token.substr(1, token.length() - 2).c_str())); - } - else { - uint32_t hash = BLI_hash_mm3((const unsigned char *)token.c_str(), token.length(), 0); - operation->addObjectIndex(hash_to_float(hash)); - } - } - } - } - } + CryptomatteOperation *operation = new CryptomatteOperation(getNumberOfInputSockets() - 1); + if (cryptoMatteSettings) { + if (cryptoMatteSettings->matte_id) { + /* Split the string by commas, ignoring white space. */ + std::string input = cryptoMatteSettings->matte_id; + std::istringstream ss(input); + while (ss.good()) { + std::string token; + getline(ss, token, ','); + /* Ignore empty tokens. */ + if (token.length() > 0) { + size_t first = token.find_first_not_of(' '); + size_t last = token.find_last_not_of(' '); + if (first == std::string::npos || last == std::string::npos) { + break; + } + token = token.substr(first, (last - first + 1)); + if (*token.begin() == '<' && *(--token.end()) == '>') { + operation->addObjectIndex(atof(token.substr(1, token.length() - 2).c_str())); + } + else { + uint32_t hash = BLI_hash_mm3((const unsigned char *)token.c_str(), token.length(), 0); + operation->addObjectIndex(hash_to_float(hash)); + } + } + } + } + } - converter.addOperation(operation); + converter.addOperation(operation); - for (int i = 0; i < getNumberOfInputSockets() - 1; ++i) { - converter.mapInputSocket(this->getInputSocket(i + 1), operation->getInputSocket(i)); - } + for (int i = 0; i < getNumberOfInputSockets() - 1; ++i) { + converter.mapInputSocket(this->getInputSocket(i + 1), operation->getInputSocket(i)); + } - SeparateChannelOperation *separateOperation = new SeparateChannelOperation; - separateOperation->setChannel(3); - converter.addOperation(separateOperation); + SeparateChannelOperation *separateOperation = new SeparateChannelOperation; + separateOperation->setChannel(3); + converter.addOperation(separateOperation); - SetAlphaOperation *operationAlpha = new SetAlphaOperation(); - converter.addOperation(operationAlpha); + SetAlphaOperation *operationAlpha = new SetAlphaOperation(); + converter.addOperation(operationAlpha); - converter.addLink(operation->getOutputSocket(0), separateOperation->getInputSocket(0)); - converter.addLink(separateOperation->getOutputSocket(0), operationAlpha->getInputSocket(1)); + converter.addLink(operation->getOutputSocket(0), separateOperation->getInputSocket(0)); + converter.addLink(separateOperation->getOutputSocket(0), operationAlpha->getInputSocket(1)); - SetAlphaOperation *clearAlphaOperation = new SetAlphaOperation(); - converter.addOperation(clearAlphaOperation); - converter.addInputValue(clearAlphaOperation->getInputSocket(1), 1.0f); + SetAlphaOperation *clearAlphaOperation = new SetAlphaOperation(); + converter.addOperation(clearAlphaOperation); + converter.addInputValue(clearAlphaOperation->getInputSocket(1), 1.0f); - converter.addLink(operation->getOutputSocket(0), clearAlphaOperation->getInputSocket(0)); - - converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); - converter.mapOutputSocket(outputSocketMatte, separateOperation->getOutputSocket(0)); - converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket(0)); - converter.mapOutputSocket(outputSocketPick, clearAlphaOperation->getOutputSocket(0)); + converter.addLink(operation->getOutputSocket(0), clearAlphaOperation->getInputSocket(0)); + converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); + converter.mapOutputSocket(outputSocketMatte, separateOperation->getOutputSocket(0)); + converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket(0)); + converter.mapOutputSocket(outputSocketPick, clearAlphaOperation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.h b/source/blender/compositor/nodes/COM_CryptomatteNode.h index 3a4aa3b94d0..91f8051f125 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.h +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class CryptomatteNode : public Node { -public: - CryptomatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + CryptomatteNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cpp b/source/blender/compositor/nodes/COM_DefocusNode.cpp index 371921ff345..5e83372a70a 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.cpp +++ b/source/blender/compositor/nodes/COM_DefocusNode.cpp @@ -32,109 +32,110 @@ DefocusNode::DefocusNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void DefocusNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void DefocusNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *node = this->getbNode(); - NodeDefocus *data = (NodeDefocus *)node->storage; - Scene *scene = node->id ? (Scene *)node->id : context.getScene(); - Object *camob = scene ? scene->camera : NULL; - - NodeOperation *radiusOperation; - if (data->no_zbuf) { - MathMultiplyOperation *multiply = new MathMultiplyOperation(); - SetValueOperation *multiplier = new SetValueOperation(); - multiplier->setValue(data->scale); - SetValueOperation *maxRadius = new SetValueOperation(); - maxRadius->setValue(data->maxblur); - MathMinimumOperation *minimize = new MathMinimumOperation(); - - converter.addOperation(multiply); - converter.addOperation(multiplier); - converter.addOperation(maxRadius); - converter.addOperation(minimize); - - converter.mapInputSocket(getInputSocket(1), multiply->getInputSocket(0)); - converter.addLink(multiplier->getOutputSocket(), multiply->getInputSocket(1)); - converter.addLink(multiply->getOutputSocket(), minimize->getInputSocket(0)); - converter.addLink(maxRadius->getOutputSocket(), minimize->getInputSocket(1)); - - radiusOperation = minimize; - } - else { - ConvertDepthToRadiusOperation *radius_op = new ConvertDepthToRadiusOperation(); - radius_op->setCameraObject(camob); - radius_op->setfStop(data->fstop); - radius_op->setMaxRadius(data->maxblur); - converter.addOperation(radius_op); - - converter.mapInputSocket(getInputSocket(1), radius_op->getInputSocket(0)); - - FastGaussianBlurValueOperation *blur = new FastGaussianBlurValueOperation(); - /* maintain close pixels so far Z values don't bleed into the foreground */ - blur->setOverlay(FAST_GAUSS_OVERLAY_MIN); - converter.addOperation(blur); - - converter.addLink(radius_op->getOutputSocket(0), blur->getInputSocket(0)); - radius_op->setPostBlur(blur); - - radiusOperation = blur; - } - - NodeBokehImage *bokehdata = new NodeBokehImage(); - bokehdata->angle = data->rotation; - bokehdata->rounding = 0.0f; - bokehdata->flaps = data->bktype; - if (data->bktype < 3) { - bokehdata->flaps = 5; - bokehdata->rounding = 1.0f; - } - bokehdata->catadioptric = 0.0f; - bokehdata->lensshift = 0.0f; - - BokehImageOperation *bokeh = new BokehImageOperation(); - bokeh->setData(bokehdata); - bokeh->deleteDataOnFinish(); - converter.addOperation(bokeh); + bNode *node = this->getbNode(); + NodeDefocus *data = (NodeDefocus *)node->storage; + Scene *scene = node->id ? (Scene *)node->id : context.getScene(); + Object *camob = scene ? scene->camera : NULL; + + NodeOperation *radiusOperation; + if (data->no_zbuf) { + MathMultiplyOperation *multiply = new MathMultiplyOperation(); + SetValueOperation *multiplier = new SetValueOperation(); + multiplier->setValue(data->scale); + SetValueOperation *maxRadius = new SetValueOperation(); + maxRadius->setValue(data->maxblur); + MathMinimumOperation *minimize = new MathMinimumOperation(); + + converter.addOperation(multiply); + converter.addOperation(multiplier); + converter.addOperation(maxRadius); + converter.addOperation(minimize); + + converter.mapInputSocket(getInputSocket(1), multiply->getInputSocket(0)); + converter.addLink(multiplier->getOutputSocket(), multiply->getInputSocket(1)); + converter.addLink(multiply->getOutputSocket(), minimize->getInputSocket(0)); + converter.addLink(maxRadius->getOutputSocket(), minimize->getInputSocket(1)); + + radiusOperation = minimize; + } + else { + ConvertDepthToRadiusOperation *radius_op = new ConvertDepthToRadiusOperation(); + radius_op->setCameraObject(camob); + radius_op->setfStop(data->fstop); + radius_op->setMaxRadius(data->maxblur); + converter.addOperation(radius_op); + + converter.mapInputSocket(getInputSocket(1), radius_op->getInputSocket(0)); + + FastGaussianBlurValueOperation *blur = new FastGaussianBlurValueOperation(); + /* maintain close pixels so far Z values don't bleed into the foreground */ + blur->setOverlay(FAST_GAUSS_OVERLAY_MIN); + converter.addOperation(blur); + + converter.addLink(radius_op->getOutputSocket(0), blur->getInputSocket(0)); + radius_op->setPostBlur(blur); + + radiusOperation = blur; + } + + NodeBokehImage *bokehdata = new NodeBokehImage(); + bokehdata->angle = data->rotation; + bokehdata->rounding = 0.0f; + bokehdata->flaps = data->bktype; + if (data->bktype < 3) { + bokehdata->flaps = 5; + bokehdata->rounding = 1.0f; + } + bokehdata->catadioptric = 0.0f; + bokehdata->lensshift = 0.0f; + + BokehImageOperation *bokeh = new BokehImageOperation(); + bokeh->setData(bokehdata); + bokeh->deleteDataOnFinish(); + converter.addOperation(bokeh); #ifdef COM_DEFOCUS_SEARCH - InverseSearchRadiusOperation *search = new InverseSearchRadiusOperation(); - search->setMaxBlur(data->maxblur); - converter.addOperation(search); + InverseSearchRadiusOperation *search = new InverseSearchRadiusOperation(); + search->setMaxBlur(data->maxblur); + converter.addOperation(search); - converter.addLink(radiusOperation->getOutputSocket(0), search->getInputSocket(0)); + converter.addLink(radiusOperation->getOutputSocket(0), search->getInputSocket(0)); #endif - VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); - if (data->preview) - operation->setQuality(COM_QUALITY_LOW); - else - operation->setQuality(context.getQuality()); - operation->setMaxBlur(data->maxblur); - operation->setThreshold(data->bthresh); - converter.addOperation(operation); - - converter.addLink(bokeh->getOutputSocket(), operation->getInputSocket(1)); - converter.addLink(radiusOperation->getOutputSocket(), operation->getInputSocket(2)); + VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); + if (data->preview) + operation->setQuality(COM_QUALITY_LOW); + else + operation->setQuality(context.getQuality()); + operation->setMaxBlur(data->maxblur); + operation->setThreshold(data->bthresh); + converter.addOperation(operation); + + converter.addLink(bokeh->getOutputSocket(), operation->getInputSocket(1)); + converter.addLink(radiusOperation->getOutputSocket(), operation->getInputSocket(2)); #ifdef COM_DEFOCUS_SEARCH - converter.addLink(search->getOutputSocket(), operation->getInputSocket(3)); + converter.addLink(search->getOutputSocket(), operation->getInputSocket(3)); #endif - if (data->gamco) { - GammaCorrectOperation *correct = new GammaCorrectOperation(); - converter.addOperation(correct); - GammaUncorrectOperation *inverse = new GammaUncorrectOperation(); - converter.addOperation(inverse); - - converter.mapInputSocket(getInputSocket(0), correct->getInputSocket(0)); - converter.addLink(correct->getOutputSocket(), operation->getInputSocket(0)); - converter.addLink(operation->getOutputSocket(), inverse->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), inverse->getOutputSocket()); - } - else { - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); - } + if (data->gamco) { + GammaCorrectOperation *correct = new GammaCorrectOperation(); + converter.addOperation(correct); + GammaUncorrectOperation *inverse = new GammaUncorrectOperation(); + converter.addOperation(inverse); + + converter.mapInputSocket(getInputSocket(0), correct->getInputSocket(0)); + converter.addLink(correct->getOutputSocket(), operation->getInputSocket(0)); + converter.addLink(operation->getOutputSocket(), inverse->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(), inverse->getOutputSocket()); + } + else { + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); + } } diff --git a/source/blender/compositor/nodes/COM_DefocusNode.h b/source/blender/compositor/nodes/COM_DefocusNode.h index 201cbdac2dc..f2589c7ae1a 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.h +++ b/source/blender/compositor/nodes/COM_DefocusNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class DefocusNode : public Node { -public: - DefocusNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + DefocusNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.cpp b/source/blender/compositor/nodes/COM_DespeckleNode.cpp index 255fc996032..16de1bd29d7 100644 --- a/source/blender/compositor/nodes/COM_DespeckleNode.cpp +++ b/source/blender/compositor/nodes/COM_DespeckleNode.cpp @@ -24,24 +24,25 @@ DespeckleNode::DespeckleNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void DespeckleNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void DespeckleNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorNode = this->getbNode(); - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputImageSocket = this->getInputSocket(1); - NodeOutput *outputSocket = this->getOutputSocket(0); + bNode *editorNode = this->getbNode(); + NodeInput *inputSocket = this->getInputSocket(0); + NodeInput *inputImageSocket = this->getInputSocket(1); + NodeOutput *outputSocket = this->getOutputSocket(0); - DespeckleOperation *operation = new DespeckleOperation(); - operation->setThreshold(editorNode->custom3); - operation->setThresholdNeighbor(editorNode->custom4); - converter.addOperation(operation); + DespeckleOperation *operation = new DespeckleOperation(); + operation->setThreshold(editorNode->custom3); + operation->setThresholdNeighbor(editorNode->custom4); + converter.addOperation(operation); - converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputSocket, operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0)); + converter.mapInputSocket(inputSocket, operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); - converter.addPreview(operation->getOutputSocket(0)); + converter.addPreview(operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.h b/source/blender/compositor/nodes/COM_DespeckleNode.h index f5071417587..ee510a0568c 100644 --- a/source/blender/compositor/nodes/COM_DespeckleNode.h +++ b/source/blender/compositor/nodes/COM_DespeckleNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class DespeckleNode : public Node { -public: - DespeckleNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + DespeckleNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp index 0e104b69da7..b579502e068 100644 --- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp @@ -23,31 +23,32 @@ DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void DifferenceMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void DifferenceMatteNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputSocket2 = this->getInputSocket(1); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); - bNode *editorNode = this->getbNode(); + NodeInput *inputSocket = this->getInputSocket(0); + NodeInput *inputSocket2 = this->getInputSocket(1); + NodeOutput *outputSocketImage = this->getOutputSocket(0); + NodeOutput *outputSocketMatte = this->getOutputSocket(1); + bNode *editorNode = this->getbNode(); - DifferenceMatteOperation *operationSet = new DifferenceMatteOperation(); - operationSet->setSettings((NodeChroma *)editorNode->storage); - converter.addOperation(operationSet); + DifferenceMatteOperation *operationSet = new DifferenceMatteOperation(); + operationSet->setSettings((NodeChroma *)editorNode->storage); + converter.addOperation(operationSet); - converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); - converter.mapInputSocket(inputSocket2, operationSet->getInputSocket(1)); - converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); + converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); + converter.mapInputSocket(inputSocket2, operationSet->getInputSocket(1)); + converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); - SetAlphaOperation *operation = new SetAlphaOperation(); - converter.addOperation(operation); + SetAlphaOperation *operation = new SetAlphaOperation(); + converter.addOperation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); - converter.addPreview(operation->getOutputSocket()); + converter.addPreview(operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h index ea44a4f86a2..3a86a0bbf85 100644 --- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h +++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class DifferenceMatteNode : public Node { -public: - DifferenceMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + DifferenceMatteNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* COM_DifferenceMatteNODE_H */ +#endif /* COM_DifferenceMatteNODE_H */ diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp index bab54993eaf..cde94b23ed8 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp @@ -26,121 +26,122 @@ DilateErodeNode::DilateErodeNode(bNode *editorNode) : Node(editorNode) { - /* initialize node data */ - NodeBlurData *data = &m_alpha_blur; - memset(data, 0, sizeof(NodeBlurData)); - data->filtertype = R_FILTER_GAUSS; - - if (editorNode->custom2 > 0) { - data->sizex = data->sizey = editorNode->custom2; - } - else { - data->sizex = data->sizey = -editorNode->custom2; - } + /* initialize node data */ + NodeBlurData *data = &m_alpha_blur; + memset(data, 0, sizeof(NodeBlurData)); + data->filtertype = R_FILTER_GAUSS; + + if (editorNode->custom2 > 0) { + data->sizex = data->sizey = editorNode->custom2; + } + else { + data->sizex = data->sizey = -editorNode->custom2; + } } -void DilateErodeNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void DilateErodeNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) { - DilateErodeThresholdOperation *operation = new DilateErodeThresholdOperation(); - operation->setDistance(editorNode->custom2); - operation->setInset(editorNode->custom3); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - - if (editorNode->custom3 < 2.0f) { - AntiAliasOperation *antiAlias = new AntiAliasOperation(); - converter.addOperation(antiAlias); - - converter.addLink(operation->getOutputSocket(), antiAlias->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), antiAlias->getOutputSocket(0)); - } - else { - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - } - else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) { - if (editorNode->custom2 > 0) { - DilateDistanceOperation *operation = new DilateDistanceOperation(); - operation->setDistance(editorNode->custom2); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - else { - ErodeDistanceOperation *operation = new ErodeDistanceOperation(); - operation->setDistance(-editorNode->custom2); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - } - else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_FEATHER) { - /* this uses a modified gaussian blur function otherwise its far too slow */ - CompositorQuality quality = context.getQuality(); - - GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); - operationx->setData(&m_alpha_blur); - operationx->setQuality(quality); - operationx->setFalloff(PROP_SMOOTH); - converter.addOperation(operationx); - - converter.mapInputSocket(getInputSocket(0), operationx->getInputSocket(0)); - // converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); // no size input yet - - GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); - operationy->setData(&m_alpha_blur); - operationy->setQuality(quality); - operationy->setFalloff(PROP_SMOOTH); - converter.addOperation(operationy); - - converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); - // converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); // no size input yet - converter.mapOutputSocket(getOutputSocket(0), operationy->getOutputSocket()); - - converter.addPreview(operationy->getOutputSocket()); - - /* TODO? */ - /* see gaussian blue node for original usage */ + bNode *editorNode = this->getbNode(); + if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) { + DilateErodeThresholdOperation *operation = new DilateErodeThresholdOperation(); + operation->setDistance(editorNode->custom2); + operation->setInset(editorNode->custom3); + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + + if (editorNode->custom3 < 2.0f) { + AntiAliasOperation *antiAlias = new AntiAliasOperation(); + converter.addOperation(antiAlias); + + converter.addLink(operation->getOutputSocket(), antiAlias->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), antiAlias->getOutputSocket(0)); + } + else { + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + } + else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) { + if (editorNode->custom2 > 0) { + DilateDistanceOperation *operation = new DilateDistanceOperation(); + operation->setDistance(editorNode->custom2); + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + else { + ErodeDistanceOperation *operation = new ErodeDistanceOperation(); + operation->setDistance(-editorNode->custom2); + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + } + else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_FEATHER) { + /* this uses a modified gaussian blur function otherwise its far too slow */ + CompositorQuality quality = context.getQuality(); + + GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); + operationx->setData(&m_alpha_blur); + operationx->setQuality(quality); + operationx->setFalloff(PROP_SMOOTH); + converter.addOperation(operationx); + + converter.mapInputSocket(getInputSocket(0), operationx->getInputSocket(0)); + // converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); // no size input yet + + GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); + operationy->setData(&m_alpha_blur); + operationy->setQuality(quality); + operationy->setFalloff(PROP_SMOOTH); + converter.addOperation(operationy); + + converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); + // converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); // no size input yet + converter.mapOutputSocket(getOutputSocket(0), operationy->getOutputSocket()); + + converter.addPreview(operationy->getOutputSocket()); + + /* TODO? */ + /* see gaussian blue node for original usage */ #if 0 - if (!connectedSizeSocket) { - operationx->setSize(size); - operationy->setSize(size); - } + if (!connectedSizeSocket) { + operationx->setSize(size); + operationy->setSize(size); + } #else - operationx->setSize(1.0f); - operationy->setSize(1.0f); + operationx->setSize(1.0f); + operationy->setSize(1.0f); #endif - operationx->setSubtract(editorNode->custom2 < 0); - operationy->setSubtract(editorNode->custom2 < 0); - - if (editorNode->storage) { - NodeDilateErode *data_storage = (NodeDilateErode *)editorNode->storage; - operationx->setFalloff(data_storage->falloff); - operationy->setFalloff(data_storage->falloff); - } - } - else { - if (editorNode->custom2 > 0) { - DilateStepOperation *operation = new DilateStepOperation(); - operation->setIterations(editorNode->custom2); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - else { - ErodeStepOperation *operation = new ErodeStepOperation(); - operation->setIterations(-editorNode->custom2); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - } + operationx->setSubtract(editorNode->custom2 < 0); + operationy->setSubtract(editorNode->custom2 < 0); + + if (editorNode->storage) { + NodeDilateErode *data_storage = (NodeDilateErode *)editorNode->storage; + operationx->setFalloff(data_storage->falloff); + operationy->setFalloff(data_storage->falloff); + } + } + else { + if (editorNode->custom2 > 0) { + DilateStepOperation *operation = new DilateStepOperation(); + operation->setIterations(editorNode->custom2); + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + else { + ErodeStepOperation *operation = new ErodeStepOperation(); + operation->setIterations(-editorNode->custom2); + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + } } diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.h b/source/blender/compositor/nodes/COM_DilateErodeNode.h index 565680c0c86..0093d78ca5b 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.h +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.h @@ -26,10 +26,11 @@ * \ingroup Node */ class DilateErodeNode : public Node { - NodeBlurData m_alpha_blur; /* only used for blurring alpha, since the dilate/erode node doesn't have this */ -public: - DilateErodeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + NodeBlurData + m_alpha_blur; /* only used for blurring alpha, since the dilate/erode node doesn't have this */ + public: + DilateErodeNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp index 7e627ac8d41..faae759ba0c 100644 --- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp @@ -23,17 +23,18 @@ DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void DirectionalBlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void DirectionalBlurNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - NodeDBlurData *data = (NodeDBlurData *)this->getbNode()->storage; - DirectionalBlurOperation *operation = new DirectionalBlurOperation(); - operation->setQuality(context.getQuality()); - operation->setData(data); - converter.addOperation(operation); + NodeDBlurData *data = (NodeDBlurData *)this->getbNode()->storage; + DirectionalBlurOperation *operation = new DirectionalBlurOperation(); + operation->setQuality(context.getQuality()); + operation->setData(data); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h index 63a27aefc4e..0f9249a83a5 100644 --- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h +++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class DirectionalBlurNode : public Node { -public: - DirectionalBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + DirectionalBlurNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_DisplaceNode.cpp b/source/blender/compositor/nodes/COM_DisplaceNode.cpp index afd3280d44a..6ff273b14b7 100644 --- a/source/blender/compositor/nodes/COM_DisplaceNode.cpp +++ b/source/blender/compositor/nodes/COM_DisplaceNode.cpp @@ -23,21 +23,22 @@ DisplaceNode::DisplaceNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void DisplaceNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void DisplaceNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - NodeOperation *operation; - if (context.getQuality() == COM_QUALITY_LOW) - operation = new DisplaceSimpleOperation(); - else - operation = new DisplaceOperation(); - converter.addOperation(operation); + NodeOperation *operation; + if (context.getQuality() == COM_QUALITY_LOW) + operation = new DisplaceSimpleOperation(); + else + operation = new DisplaceOperation(); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); + converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_DisplaceNode.h b/source/blender/compositor/nodes/COM_DisplaceNode.h index b162d76209f..e6a13e06772 100644 --- a/source/blender/compositor/nodes/COM_DisplaceNode.h +++ b/source/blender/compositor/nodes/COM_DisplaceNode.h @@ -26,8 +26,8 @@ * \ingroup Node */ class DisplaceNode : public Node { -public: - DisplaceNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + DisplaceNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp index 3c1e73da148..5f001f723e8 100644 --- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp @@ -25,73 +25,74 @@ DistanceMatteNode::DistanceMatteNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void DistanceMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void DistanceMatteNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorsnode = getbNode(); - NodeChroma *storage = (NodeChroma *)editorsnode->storage; - - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeInput *inputSocketKey = this->getInputSocket(1); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); - - SetAlphaOperation *operationAlpha = new SetAlphaOperation(); - converter.addOperation(operationAlpha); - - /* work in RGB color space */ - NodeOperation *operation; - if (storage->channel == 1) { - DistanceRGBMatteOperation *matte = new DistanceRGBMatteOperation(); - matte->setSettings(storage); - converter.addOperation(matte); - - converter.mapInputSocket(inputSocketImage, matte->getInputSocket(0)); - converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); - - converter.mapInputSocket(inputSocketKey, matte->getInputSocket(1)); - - operation = matte; - } - /* work in YCbCr color space */ - else { - DistanceYCCMatteOperation *matte = new DistanceYCCMatteOperation(); - matte->setSettings(storage); - converter.addOperation(matte); - - ConvertRGBToYCCOperation *operationYCCImage = new ConvertRGBToYCCOperation(); - ConvertRGBToYCCOperation *operationYCCMatte = new ConvertRGBToYCCOperation(); - operationYCCImage->setMode(BLI_YCC_ITU_BT709); - operationYCCMatte->setMode(BLI_YCC_ITU_BT709); - converter.addOperation(operationYCCImage); - converter.addOperation(operationYCCMatte); - - converter.mapInputSocket(inputSocketImage, operationYCCImage->getInputSocket(0)); - converter.addLink(operationYCCImage->getOutputSocket(), matte->getInputSocket(0)); - converter.addLink(operationYCCImage->getOutputSocket(), operationAlpha->getInputSocket(0)); - - converter.mapInputSocket(inputSocketKey, operationYCCMatte->getInputSocket(0)); - converter.addLink(operationYCCMatte->getOutputSocket(), matte->getInputSocket(1)); - - operation = matte; - } - - converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); - converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); - - if (storage->channel != 1) { - ConvertYCCToRGBOperation *inv_convert = new ConvertYCCToRGBOperation(); - inv_convert->setMode(BLI_YCC_ITU_BT709); - - converter.addOperation(inv_convert); - converter.addLink(operationAlpha->getOutputSocket(0), inv_convert->getInputSocket(0)); - converter.mapOutputSocket(outputSocketImage, inv_convert->getOutputSocket()); - converter.addPreview(inv_convert->getOutputSocket()); - } - else { - converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); - converter.addPreview(operationAlpha->getOutputSocket()); - } + bNode *editorsnode = getbNode(); + NodeChroma *storage = (NodeChroma *)editorsnode->storage; + + NodeInput *inputSocketImage = this->getInputSocket(0); + NodeInput *inputSocketKey = this->getInputSocket(1); + NodeOutput *outputSocketImage = this->getOutputSocket(0); + NodeOutput *outputSocketMatte = this->getOutputSocket(1); + + SetAlphaOperation *operationAlpha = new SetAlphaOperation(); + converter.addOperation(operationAlpha); + + /* work in RGB color space */ + NodeOperation *operation; + if (storage->channel == 1) { + DistanceRGBMatteOperation *matte = new DistanceRGBMatteOperation(); + matte->setSettings(storage); + converter.addOperation(matte); + + converter.mapInputSocket(inputSocketImage, matte->getInputSocket(0)); + converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); + + converter.mapInputSocket(inputSocketKey, matte->getInputSocket(1)); + + operation = matte; + } + /* work in YCbCr color space */ + else { + DistanceYCCMatteOperation *matte = new DistanceYCCMatteOperation(); + matte->setSettings(storage); + converter.addOperation(matte); + + ConvertRGBToYCCOperation *operationYCCImage = new ConvertRGBToYCCOperation(); + ConvertRGBToYCCOperation *operationYCCMatte = new ConvertRGBToYCCOperation(); + operationYCCImage->setMode(BLI_YCC_ITU_BT709); + operationYCCMatte->setMode(BLI_YCC_ITU_BT709); + converter.addOperation(operationYCCImage); + converter.addOperation(operationYCCMatte); + + converter.mapInputSocket(inputSocketImage, operationYCCImage->getInputSocket(0)); + converter.addLink(operationYCCImage->getOutputSocket(), matte->getInputSocket(0)); + converter.addLink(operationYCCImage->getOutputSocket(), operationAlpha->getInputSocket(0)); + + converter.mapInputSocket(inputSocketKey, operationYCCMatte->getInputSocket(0)); + converter.addLink(operationYCCMatte->getOutputSocket(), matte->getInputSocket(1)); + + operation = matte; + } + + converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); + converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); + + if (storage->channel != 1) { + ConvertYCCToRGBOperation *inv_convert = new ConvertYCCToRGBOperation(); + inv_convert->setMode(BLI_YCC_ITU_BT709); + + converter.addOperation(inv_convert); + converter.addLink(operationAlpha->getOutputSocket(0), inv_convert->getInputSocket(0)); + converter.mapOutputSocket(outputSocketImage, inv_convert->getOutputSocket()); + converter.addPreview(inv_convert->getOutputSocket()); + } + else { + converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); + converter.addPreview(operationAlpha->getOutputSocket()); + } } diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.h b/source/blender/compositor/nodes/COM_DistanceMatteNode.h index 84a525c58a7..baba9bb8c97 100644 --- a/source/blender/compositor/nodes/COM_DistanceMatteNode.h +++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class DistanceMatteNode : public Node { -public: - DistanceMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + DistanceMatteNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* COM_DistanceMatteNODE_H */ +#endif /* COM_DistanceMatteNODE_H */ diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp index 9ed9b532bdc..907a9f49353 100644 --- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp @@ -22,20 +22,21 @@ DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void DoubleEdgeMaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void DoubleEdgeMaskNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - DoubleEdgeMaskOperation *operation; - bNode *bnode = this->getbNode(); + DoubleEdgeMaskOperation *operation; + bNode *bnode = this->getbNode(); - operation = new DoubleEdgeMaskOperation(); - operation->setAdjecentOnly(bnode->custom1); - operation->setKeepInside(bnode->custom2); - converter.addOperation(operation); + operation = new DoubleEdgeMaskOperation(); + operation->setAdjecentOnly(bnode->custom1); + operation->setKeepInside(bnode->custom2); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h index 45a10492ba2..c45d42675f3 100644 --- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h +++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class DoubleEdgeMaskNode : public Node { -public: - DoubleEdgeMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + DoubleEdgeMaskNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp index d44ac848864..349d0908a98 100644 --- a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp @@ -25,45 +25,46 @@ EllipseMaskNode::EllipseMaskNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void EllipseMaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void EllipseMaskNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *inputSocket = this->getInputSocket(0); + NodeOutput *outputSocket = this->getOutputSocket(0); - EllipseMaskOperation *operation; - operation = new EllipseMaskOperation(); - operation->setData((NodeEllipseMask *)this->getbNode()->storage); - operation->setMaskType(this->getbNode()->custom1); - converter.addOperation(operation); + EllipseMaskOperation *operation; + operation = new EllipseMaskOperation(); + operation->setData((NodeEllipseMask *)this->getbNode()->storage); + operation->setMaskType(this->getbNode()->custom1); + converter.addOperation(operation); - if (inputSocket->isLinked()) { - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); - } - else { - /* Value operation to produce original transparent image */ - SetValueOperation *valueOperation = new SetValueOperation(); - valueOperation->setValue(0.0f); - converter.addOperation(valueOperation); + if (inputSocket->isLinked()) { + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + } + else { + /* Value operation to produce original transparent image */ + SetValueOperation *valueOperation = new SetValueOperation(); + valueOperation->setValue(0.0f); + converter.addOperation(valueOperation); - /* Scale that image up to render resolution */ - const RenderData *rd = context.getRenderData(); - ScaleFixedSizeOperation *scaleOperation = new ScaleFixedSizeOperation(); - scaleOperation->setIsAspect(false); - scaleOperation->setIsCrop(false); - scaleOperation->setOffset(0.0f, 0.0f); - scaleOperation->setNewWidth(rd->xsch * rd->size / 100.0f); - scaleOperation->setNewHeight(rd->ysch * rd->size / 100.0f); - scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); - converter.addOperation(scaleOperation); + /* Scale that image up to render resolution */ + const RenderData *rd = context.getRenderData(); + ScaleFixedSizeOperation *scaleOperation = new ScaleFixedSizeOperation(); + scaleOperation->setIsAspect(false); + scaleOperation->setIsCrop(false); + scaleOperation->setOffset(0.0f, 0.0f); + scaleOperation->setNewWidth(rd->xsch * rd->size / 100.0f); + scaleOperation->setNewHeight(rd->ysch * rd->size / 100.0f); + scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + converter.addOperation(scaleOperation); - converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0)); - converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - } + converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0)); + converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + } - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); } diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.h b/source/blender/compositor/nodes/COM_EllipseMaskNode.h index c4cef996137..b7093bf68fa 100644 --- a/source/blender/compositor/nodes/COM_EllipseMaskNode.h +++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class EllipseMaskNode : public Node { -public: - EllipseMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + EllipseMaskNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_FilterNode.cpp b/source/blender/compositor/nodes/COM_FilterNode.cpp index 14a2bb4fe38..1972cabc7c4 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.cpp +++ b/source/blender/compositor/nodes/COM_FilterNode.cpp @@ -25,55 +25,72 @@ FilterNode::FilterNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void FilterNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void FilterNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputImageSocket = this->getInputSocket(1); - NodeOutput *outputSocket = this->getOutputSocket(0); - ConvolutionFilterOperation *operation = NULL; + NodeInput *inputSocket = this->getInputSocket(0); + NodeInput *inputImageSocket = this->getInputSocket(1); + NodeOutput *outputSocket = this->getOutputSocket(0); + ConvolutionFilterOperation *operation = NULL; - switch (this->getbNode()->custom1) { - case CMP_FILT_SOFT: - operation = new ConvolutionFilterOperation(); - operation->set3x3Filter(1 / 16.0f, 2 / 16.0f, 1 / 16.0f, 2 / 16.0f, 4 / 16.0f, 2 / 16.0f, 1 / 16.0f, 2 / 16.0f, 1 / 16.0f); - break; - case CMP_FILT_SHARP: - operation = new ConvolutionFilterOperation(); - operation->set3x3Filter(-1, -1, -1, -1, 9, -1, -1, -1, -1); - break; - case CMP_FILT_LAPLACE: - operation = new ConvolutionEdgeFilterOperation(); - operation->set3x3Filter(-1 / 8.0f, -1 / 8.0f, -1 / 8.0f, -1 / 8.0f, 1.0f, -1 / 8.0f, -1 / 8.0f, -1 / 8.0f, -1 / 8.0f); - break; - case CMP_FILT_SOBEL: - operation = new ConvolutionEdgeFilterOperation(); - operation->set3x3Filter(1, 2, 1, 0, 0, 0, -1, -2, -1); - break; - case CMP_FILT_PREWITT: - operation = new ConvolutionEdgeFilterOperation(); - operation->set3x3Filter(1, 1, 1, 0, 0, 0, -1, -1, -1); - break; - case CMP_FILT_KIRSCH: - operation = new ConvolutionEdgeFilterOperation(); - operation->set3x3Filter(5, 5, 5, -3, -3, -3, -2, -2, -2); - break; - case CMP_FILT_SHADOW: - operation = new ConvolutionFilterOperation(); - operation->set3x3Filter(1, 2, 1, 0, 1, 0, -1, -2, -1); - break; - default: - operation = new ConvolutionFilterOperation(); - operation->set3x3Filter(0, 0, 0, 0, 1, 0, 0, 0, 0); - break; - } - converter.addOperation(operation); + switch (this->getbNode()->custom1) { + case CMP_FILT_SOFT: + operation = new ConvolutionFilterOperation(); + operation->set3x3Filter(1 / 16.0f, + 2 / 16.0f, + 1 / 16.0f, + 2 / 16.0f, + 4 / 16.0f, + 2 / 16.0f, + 1 / 16.0f, + 2 / 16.0f, + 1 / 16.0f); + break; + case CMP_FILT_SHARP: + operation = new ConvolutionFilterOperation(); + operation->set3x3Filter(-1, -1, -1, -1, 9, -1, -1, -1, -1); + break; + case CMP_FILT_LAPLACE: + operation = new ConvolutionEdgeFilterOperation(); + operation->set3x3Filter(-1 / 8.0f, + -1 / 8.0f, + -1 / 8.0f, + -1 / 8.0f, + 1.0f, + -1 / 8.0f, + -1 / 8.0f, + -1 / 8.0f, + -1 / 8.0f); + break; + case CMP_FILT_SOBEL: + operation = new ConvolutionEdgeFilterOperation(); + operation->set3x3Filter(1, 2, 1, 0, 0, 0, -1, -2, -1); + break; + case CMP_FILT_PREWITT: + operation = new ConvolutionEdgeFilterOperation(); + operation->set3x3Filter(1, 1, 1, 0, 0, 0, -1, -1, -1); + break; + case CMP_FILT_KIRSCH: + operation = new ConvolutionEdgeFilterOperation(); + operation->set3x3Filter(5, 5, 5, -3, -3, -3, -2, -2, -2); + break; + case CMP_FILT_SHADOW: + operation = new ConvolutionFilterOperation(); + operation->set3x3Filter(1, 2, 1, 0, 1, 0, -1, -2, -1); + break; + default: + operation = new ConvolutionFilterOperation(); + operation->set3x3Filter(0, 0, 0, 0, 1, 0, 0, 0, 0); + break; + } + converter.addOperation(operation); - converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputSocket, operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0)); + converter.mapInputSocket(inputSocket, operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); - converter.addPreview(operation->getOutputSocket(0)); + converter.addPreview(operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_FilterNode.h b/source/blender/compositor/nodes/COM_FilterNode.h index b1aa0099fbc..d0e824051bb 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.h +++ b/source/blender/compositor/nodes/COM_FilterNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class FilterNode : public Node { -public: - FilterNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + FilterNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* __COM_FILTERNODE_H__ */ +#endif /* __COM_FILTERNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_FlipNode.cpp b/source/blender/compositor/nodes/COM_FlipNode.cpp index 16473c6586d..59b881bfcf7 100644 --- a/source/blender/compositor/nodes/COM_FlipNode.cpp +++ b/source/blender/compositor/nodes/COM_FlipNode.cpp @@ -23,30 +23,31 @@ FlipNode::FlipNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void FlipNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void FlipNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); - FlipOperation *operation = new FlipOperation(); - switch (this->getbNode()->custom1) { - case 0: /// \TODO: I didn't find any constants in the old implementation, should I introduce them. - operation->setFlipX(true); - operation->setFlipY(false); - break; - case 1: - operation->setFlipX(false); - operation->setFlipY(true); - break; - case 2: - operation->setFlipX(true); - operation->setFlipY(true); - break; - } + NodeInput *inputSocket = this->getInputSocket(0); + NodeOutput *outputSocket = this->getOutputSocket(0); + FlipOperation *operation = new FlipOperation(); + switch (this->getbNode()->custom1) { + case 0: /// \TODO: I didn't find any constants in the old implementation, should I introduce them. + operation->setFlipX(true); + operation->setFlipY(false); + break; + case 1: + operation->setFlipX(false); + operation->setFlipY(true); + break; + case 2: + operation->setFlipX(true); + operation->setFlipY(true); + break; + } - converter.addOperation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.addOperation(operation); + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_FlipNode.h b/source/blender/compositor/nodes/COM_FlipNode.h index a62482ab7fd..2122961dac9 100644 --- a/source/blender/compositor/nodes/COM_FlipNode.h +++ b/source/blender/compositor/nodes/COM_FlipNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class FlipNode : public Node { -public: - FlipNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + FlipNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_GammaNode.cpp b/source/blender/compositor/nodes/COM_GammaNode.cpp index 9ba9a305a3d..0c60c871864 100644 --- a/source/blender/compositor/nodes/COM_GammaNode.cpp +++ b/source/blender/compositor/nodes/COM_GammaNode.cpp @@ -22,15 +22,16 @@ GammaNode::GammaNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void GammaNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void GammaNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - GammaOperation *operation = new GammaOperation(); - converter.addOperation(operation); + GammaOperation *operation = new GammaOperation(); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_GammaNode.h b/source/blender/compositor/nodes/COM_GammaNode.h index a54623e1b94..46573fc4b3f 100644 --- a/source/blender/compositor/nodes/COM_GammaNode.h +++ b/source/blender/compositor/nodes/COM_GammaNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class GammaNode : public Node { -public: - GammaNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + GammaNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_GlareNode.cpp b/source/blender/compositor/nodes/COM_GlareNode.cpp index 73e3f6b82c8..6a65486a97f 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cpp +++ b/source/blender/compositor/nodes/COM_GlareNode.cpp @@ -29,54 +29,54 @@ GlareNode::GlareNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void GlareNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void GlareNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = this->getbNode(); - NodeGlare *glare = (NodeGlare *)node->storage; + bNode *node = this->getbNode(); + NodeGlare *glare = (NodeGlare *)node->storage; - GlareBaseOperation *glareoperation = NULL; - switch (glare->type) { - default: - case 3: - glareoperation = new GlareGhostOperation(); - break; - case 2: // streaks - glareoperation = new GlareStreaksOperation(); - break; - case 1: // fog glow - glareoperation = new GlareFogGlowOperation(); - break; - case 0: // simple star - glareoperation = new GlareSimpleStarOperation(); - break; - } - BLI_assert(glareoperation); - glareoperation->setGlareSettings(glare); + GlareBaseOperation *glareoperation = NULL; + switch (glare->type) { + default: + case 3: + glareoperation = new GlareGhostOperation(); + break; + case 2: // streaks + glareoperation = new GlareStreaksOperation(); + break; + case 1: // fog glow + glareoperation = new GlareFogGlowOperation(); + break; + case 0: // simple star + glareoperation = new GlareSimpleStarOperation(); + break; + } + BLI_assert(glareoperation); + glareoperation->setGlareSettings(glare); - GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); - thresholdOperation->setGlareSettings(glare); + GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); + thresholdOperation->setGlareSettings(glare); - SetValueOperation *mixvalueoperation = new SetValueOperation(); - mixvalueoperation->setValue(0.5f + glare->mix * 0.5f); + SetValueOperation *mixvalueoperation = new SetValueOperation(); + mixvalueoperation->setValue(0.5f + glare->mix * 0.5f); - MixGlareOperation *mixoperation = new MixGlareOperation(); - mixoperation->setResolutionInputSocketIndex(1); - mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT); + MixGlareOperation *mixoperation = new MixGlareOperation(); + mixoperation->setResolutionInputSocketIndex(1); + mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT); - converter.addOperation(glareoperation); - converter.addOperation(thresholdOperation); - converter.addOperation(mixvalueoperation); - converter.addOperation(mixoperation); + converter.addOperation(glareoperation); + converter.addOperation(thresholdOperation); + converter.addOperation(mixvalueoperation); + converter.addOperation(mixoperation); - converter.mapInputSocket(getInputSocket(0), thresholdOperation->getInputSocket(0)); - converter.addLink(thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0)); - - converter.addLink(mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(0), mixoperation->getInputSocket(1)); - converter.addLink(glareoperation->getOutputSocket(), mixoperation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(), mixoperation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), thresholdOperation->getInputSocket(0)); + converter.addLink(thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0)); + converter.addLink(mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(0), mixoperation->getInputSocket(1)); + converter.addLink(glareoperation->getOutputSocket(), mixoperation->getInputSocket(2)); + converter.mapOutputSocket(getOutputSocket(), mixoperation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_GlareNode.h b/source/blender/compositor/nodes/COM_GlareNode.h index f67a418c8b6..051ae1d1dc3 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.h +++ b/source/blender/compositor/nodes/COM_GlareNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class GlareNode : public Node { -public: - GlareNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + GlareNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp index b0f87c27d8d..b1157242e10 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp @@ -28,36 +28,37 @@ HueSaturationValueCorrectNode::HueSaturationValueCorrectNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void HueSaturationValueCorrectNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void HueSaturationValueCorrectNode::convertToOperations( + NodeConverter &converter, const CompositorContext & /*context*/) const { - NodeInput *valueSocket = this->getInputSocket(0); - NodeInput *colorSocket = this->getInputSocket(1); - NodeOutput *outputSocket = this->getOutputSocket(0); - bNode *editorsnode = getbNode(); - CurveMapping *storage = (CurveMapping *)editorsnode->storage; - - ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation(); - converter.addOperation(rgbToHSV); - - ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation(); - converter.addOperation(hsvToRGB); - - HueSaturationValueCorrectOperation *changeHSV = new HueSaturationValueCorrectOperation(); - changeHSV->setCurveMapping(storage); - converter.addOperation(changeHSV); - - MixBlendOperation *blend = new MixBlendOperation(); - blend->setResolutionInputSocketIndex(1); - converter.addOperation(blend); - - converter.mapInputSocket(colorSocket, rgbToHSV->getInputSocket(0)); - converter.addLink(rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0)); - converter.addLink(changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0)); - converter.addLink(hsvToRGB->getOutputSocket(), blend->getInputSocket(2)); - converter.mapInputSocket(colorSocket, blend->getInputSocket(1)); - converter.mapInputSocket(valueSocket, blend->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, blend->getOutputSocket()); + NodeInput *valueSocket = this->getInputSocket(0); + NodeInput *colorSocket = this->getInputSocket(1); + NodeOutput *outputSocket = this->getOutputSocket(0); + bNode *editorsnode = getbNode(); + CurveMapping *storage = (CurveMapping *)editorsnode->storage; + + ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation(); + converter.addOperation(rgbToHSV); + + ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation(); + converter.addOperation(hsvToRGB); + + HueSaturationValueCorrectOperation *changeHSV = new HueSaturationValueCorrectOperation(); + changeHSV->setCurveMapping(storage); + converter.addOperation(changeHSV); + + MixBlendOperation *blend = new MixBlendOperation(); + blend->setResolutionInputSocketIndex(1); + converter.addOperation(blend); + + converter.mapInputSocket(colorSocket, rgbToHSV->getInputSocket(0)); + converter.addLink(rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0)); + converter.addLink(changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0)); + converter.addLink(hsvToRGB->getOutputSocket(), blend->getInputSocket(2)); + converter.mapInputSocket(colorSocket, blend->getInputSocket(1)); + converter.mapInputSocket(valueSocket, blend->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, blend->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h index 73be77bbce6..270d29cc41b 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h @@ -26,8 +26,8 @@ * \ingroup Node */ class HueSaturationValueCorrectNode : public Node { -public: - HueSaturationValueCorrectNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + HueSaturationValueCorrectNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp index 33415978818..8aae5f0409c 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp @@ -28,39 +28,40 @@ HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void HueSaturationValueNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void HueSaturationValueNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *colorSocket = this->getInputSocket(0); - NodeInput *hueSocket = this->getInputSocket(1); - NodeInput *saturationSocket = this->getInputSocket(2); - NodeInput *valueSocket = this->getInputSocket(3); - NodeInput *facSocket = this->getInputSocket(4); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *colorSocket = this->getInputSocket(0); + NodeInput *hueSocket = this->getInputSocket(1); + NodeInput *saturationSocket = this->getInputSocket(2); + NodeInput *valueSocket = this->getInputSocket(3); + NodeInput *facSocket = this->getInputSocket(4); + NodeOutput *outputSocket = this->getOutputSocket(0); - ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation(); - converter.addOperation(rgbToHSV); + ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation(); + converter.addOperation(rgbToHSV); - ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation(); - converter.addOperation(hsvToRGB); + ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation(); + converter.addOperation(hsvToRGB); - ChangeHSVOperation *changeHSV = new ChangeHSVOperation(); - converter.mapInputSocket(hueSocket, changeHSV->getInputSocket(1)); - converter.mapInputSocket(saturationSocket, changeHSV->getInputSocket(2)); - converter.mapInputSocket(valueSocket, changeHSV->getInputSocket(3)); - converter.addOperation(changeHSV); + ChangeHSVOperation *changeHSV = new ChangeHSVOperation(); + converter.mapInputSocket(hueSocket, changeHSV->getInputSocket(1)); + converter.mapInputSocket(saturationSocket, changeHSV->getInputSocket(2)); + converter.mapInputSocket(valueSocket, changeHSV->getInputSocket(3)); + converter.addOperation(changeHSV); - MixBlendOperation *blend = new MixBlendOperation(); - blend->setResolutionInputSocketIndex(1); - converter.addOperation(blend); + MixBlendOperation *blend = new MixBlendOperation(); + blend->setResolutionInputSocketIndex(1); + converter.addOperation(blend); - converter.mapInputSocket(colorSocket, rgbToHSV->getInputSocket(0)); - converter.addLink(rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0)); - converter.addLink(changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0)); - converter.addLink(hsvToRGB->getOutputSocket(), blend->getInputSocket(2)); - converter.mapInputSocket(colorSocket, blend->getInputSocket(1)); - converter.mapInputSocket(facSocket, blend->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, blend->getOutputSocket()); + converter.mapInputSocket(colorSocket, rgbToHSV->getInputSocket(0)); + converter.addLink(rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0)); + converter.addLink(changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0)); + converter.addLink(hsvToRGB->getOutputSocket(), blend->getInputSocket(2)); + converter.mapInputSocket(colorSocket, blend->getInputSocket(1)); + converter.mapInputSocket(facSocket, blend->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, blend->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h index 3b4231115be..5e023a0762d 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h @@ -26,8 +26,8 @@ * \ingroup Node */ class HueSaturationValueNode : public Node { -public: - HueSaturationValueNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + HueSaturationValueNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.cpp b/source/blender/compositor/nodes/COM_IDMaskNode.cpp index cac65aacf53..50dd2ed93e9 100644 --- a/source/blender/compositor/nodes/COM_IDMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_IDMaskNode.cpp @@ -23,26 +23,27 @@ IDMaskNode::IDMaskNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void IDMaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void IDMaskNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *bnode = this->getbNode(); + bNode *bnode = this->getbNode(); - IDMaskOperation *operation; - operation = new IDMaskOperation(); - operation->setObjectIndex(bnode->custom1); - converter.addOperation(operation); + IDMaskOperation *operation; + operation = new IDMaskOperation(); + operation->setObjectIndex(bnode->custom1); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - if (bnode->custom2 == 0 || context.getRenderData()->scemode & R_FULL_SAMPLE) { - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - else { - AntiAliasOperation *antiAliasOperation = new AntiAliasOperation(); - converter.addOperation(antiAliasOperation); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + if (bnode->custom2 == 0 || context.getRenderData()->scemode & R_FULL_SAMPLE) { + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + else { + AntiAliasOperation *antiAliasOperation = new AntiAliasOperation(); + converter.addOperation(antiAliasOperation); - converter.addLink(operation->getOutputSocket(), antiAliasOperation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), antiAliasOperation->getOutputSocket(0)); - } + converter.addLink(operation->getOutputSocket(), antiAliasOperation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), antiAliasOperation->getOutputSocket(0)); + } } diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.h b/source/blender/compositor/nodes/COM_IDMaskNode.h index 296385f6923..3f4019bf5b7 100644 --- a/source/blender/compositor/nodes/COM_IDMaskNode.h +++ b/source/blender/compositor/nodes/COM_IDMaskNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class IDMaskNode : public Node { -public: - IDMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + IDMaskNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp index fb3a222cc66..cf25e9f26ae 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cpp +++ b/source/blender/compositor/nodes/COM_ImageNode.cpp @@ -31,238 +31,268 @@ ImageNode::ImageNode(bNode *editorNode) : Node(editorNode) { - /* pass */ - + /* pass */ } -NodeOperation *ImageNode::doMultilayerCheck(NodeConverter &converter, RenderLayer *rl, Image *image, ImageUser *user, - int framenumber, int outputsocketIndex, int passindex, int view, DataType datatype) const +NodeOperation *ImageNode::doMultilayerCheck(NodeConverter &converter, + RenderLayer *rl, + Image *image, + ImageUser *user, + int framenumber, + int outputsocketIndex, + int passindex, + int view, + DataType datatype) const { - NodeOutput *outputSocket = this->getOutputSocket(outputsocketIndex); - MultilayerBaseOperation *operation = NULL; - switch (datatype) { - case COM_DT_VALUE: - operation = new MultilayerValueOperation(passindex, view); - break; - case COM_DT_VECTOR: - operation = new MultilayerVectorOperation(passindex, view); - break; - case COM_DT_COLOR: - operation = new MultilayerColorOperation(passindex, view); - break; - default: - break; - } - operation->setImage(image); - operation->setRenderLayer(rl); - operation->setImageUser(user); - operation->setFramenumber(framenumber); + NodeOutput *outputSocket = this->getOutputSocket(outputsocketIndex); + MultilayerBaseOperation *operation = NULL; + switch (datatype) { + case COM_DT_VALUE: + operation = new MultilayerValueOperation(passindex, view); + break; + case COM_DT_VECTOR: + operation = new MultilayerVectorOperation(passindex, view); + break; + case COM_DT_COLOR: + operation = new MultilayerColorOperation(passindex, view); + break; + default: + break; + } + operation->setImage(image); + operation->setRenderLayer(rl); + operation->setImageUser(user); + operation->setFramenumber(framenumber); - converter.addOperation(operation); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + converter.addOperation(operation); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); - return operation; + return operation; } -void ImageNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void ImageNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - /// Image output - NodeOutput *outputImage = this->getOutputSocket(0); - bNode *editorNode = this->getbNode(); - Image *image = (Image *)editorNode->id; - ImageUser *imageuser = (ImageUser *)editorNode->storage; - int framenumber = context.getFramenumber(); - int numberOfOutputs = this->getNumberOfOutputSockets(); - bool outputStraightAlpha = (editorNode->custom1 & CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0; - BKE_image_user_frame_calc(imageuser, context.getFramenumber()); - /* force a load, we assume iuser index will be set OK anyway */ - if (image && image->type == IMA_TYPE_MULTILAYER) { - bool is_multilayer_ok = false; - ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL); - if (image->rr) { - RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer); - if (rl) { - NodeOutput *socket; - int index; + /// Image output + NodeOutput *outputImage = this->getOutputSocket(0); + bNode *editorNode = this->getbNode(); + Image *image = (Image *)editorNode->id; + ImageUser *imageuser = (ImageUser *)editorNode->storage; + int framenumber = context.getFramenumber(); + int numberOfOutputs = this->getNumberOfOutputSockets(); + bool outputStraightAlpha = (editorNode->custom1 & CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0; + BKE_image_user_frame_calc(imageuser, context.getFramenumber()); + /* force a load, we assume iuser index will be set OK anyway */ + if (image && image->type == IMA_TYPE_MULTILAYER) { + bool is_multilayer_ok = false; + ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL); + if (image->rr) { + RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer); + if (rl) { + NodeOutput *socket; + int index; - is_multilayer_ok = true; + is_multilayer_ok = true; - for (index = 0; index < numberOfOutputs; index++) { - NodeOperation *operation = NULL; - socket = this->getOutputSocket(index); - bNodeSocket *bnodeSocket = socket->getbNodeSocket(); - NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage; - RenderPass *rpass = (RenderPass *)BLI_findstring(&rl->passes, storage->pass_name, offsetof(RenderPass, name)); - int view = 0; + for (index = 0; index < numberOfOutputs; index++) { + NodeOperation *operation = NULL; + socket = this->getOutputSocket(index); + bNodeSocket *bnodeSocket = socket->getbNodeSocket(); + NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage; + RenderPass *rpass = (RenderPass *)BLI_findstring( + &rl->passes, storage->pass_name, offsetof(RenderPass, name)); + int view = 0; - if (STREQ(storage->pass_name, RE_PASSNAME_COMBINED) && STREQ(bnodeSocket->name, "Alpha")) { - /* Alpha output is already handled with the associated combined output. */ - continue; - } + if (STREQ(storage->pass_name, RE_PASSNAME_COMBINED) && + STREQ(bnodeSocket->name, "Alpha")) { + /* Alpha output is already handled with the associated combined output. */ + continue; + } - /* returns the image view to use for the current active view */ - if (BLI_listbase_count_at_most(&image->rr->views, 2) > 1) { - const int view_image = imageuser->view; - const bool is_allview = (view_image == 0); /* if view selected == All (0) */ + /* returns the image view to use for the current active view */ + if (BLI_listbase_count_at_most(&image->rr->views, 2) > 1) { + const int view_image = imageuser->view; + const bool is_allview = (view_image == 0); /* if view selected == All (0) */ - if (is_allview) { - /* heuristic to match image name with scene names - * check if the view name exists in the image */ - view = BLI_findstringindex(&image->rr->views, context.getViewName(), offsetof(RenderView, name)); - if (view == -1) view = 0; - } - else { - view = view_image - 1; - } - } + if (is_allview) { + /* heuristic to match image name with scene names + * check if the view name exists in the image */ + view = BLI_findstringindex( + &image->rr->views, context.getViewName(), offsetof(RenderView, name)); + if (view == -1) + view = 0; + } + else { + view = view_image - 1; + } + } - if (rpass) { - int passindex = BLI_findindex(&rl->passes, rpass); - switch (rpass->channels) { - case 1: - operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index, - passindex, view, COM_DT_VALUE); - break; - /* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */ - /* XXX any way to detect actual vector images? */ - case 3: - operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index, - passindex, view, COM_DT_VECTOR); - break; - case 4: - operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index, - passindex, view, COM_DT_COLOR); - break; - default: - /* dummy operation is added below */ - break; - } - if (index == 0 && operation) { - converter.addPreview(operation->getOutputSocket()); - } - if (STREQ(rpass->name, RE_PASSNAME_COMBINED)) { - for (int alphaIndex = 0; alphaIndex < numberOfOutputs; alphaIndex++) { - NodeOutput *alphaSocket = this->getOutputSocket(alphaIndex); - bNodeSocket *bnodeAlphaSocket = alphaSocket->getbNodeSocket(); - if (!STREQ(bnodeAlphaSocket->name, "Alpha")) { - continue; - } - NodeImageLayer *alphaStorage = (NodeImageLayer *)bnodeSocket->storage; - if (!STREQ(alphaStorage->pass_name, RE_PASSNAME_COMBINED)) { - continue; - } - SeparateChannelOperation *separate_operation; - separate_operation = new SeparateChannelOperation(); - separate_operation->setChannel(3); - converter.addOperation(separate_operation); - converter.addLink(operation->getOutputSocket(), separate_operation->getInputSocket(0)); - converter.mapOutputSocket(alphaSocket, separate_operation->getOutputSocket()); - break; - } - } - } + if (rpass) { + int passindex = BLI_findindex(&rl->passes, rpass); + switch (rpass->channels) { + case 1: + operation = doMultilayerCheck(converter, + rl, + image, + imageuser, + framenumber, + index, + passindex, + view, + COM_DT_VALUE); + break; + /* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */ + /* XXX any way to detect actual vector images? */ + case 3: + operation = doMultilayerCheck(converter, + rl, + image, + imageuser, + framenumber, + index, + passindex, + view, + COM_DT_VECTOR); + break; + case 4: + operation = doMultilayerCheck(converter, + rl, + image, + imageuser, + framenumber, + index, + passindex, + view, + COM_DT_COLOR); + break; + default: + /* dummy operation is added below */ + break; + } + if (index == 0 && operation) { + converter.addPreview(operation->getOutputSocket()); + } + if (STREQ(rpass->name, RE_PASSNAME_COMBINED)) { + for (int alphaIndex = 0; alphaIndex < numberOfOutputs; alphaIndex++) { + NodeOutput *alphaSocket = this->getOutputSocket(alphaIndex); + bNodeSocket *bnodeAlphaSocket = alphaSocket->getbNodeSocket(); + if (!STREQ(bnodeAlphaSocket->name, "Alpha")) { + continue; + } + NodeImageLayer *alphaStorage = (NodeImageLayer *)bnodeSocket->storage; + if (!STREQ(alphaStorage->pass_name, RE_PASSNAME_COMBINED)) { + continue; + } + SeparateChannelOperation *separate_operation; + separate_operation = new SeparateChannelOperation(); + separate_operation->setChannel(3); + converter.addOperation(separate_operation); + converter.addLink(operation->getOutputSocket(), + separate_operation->getInputSocket(0)); + converter.mapOutputSocket(alphaSocket, separate_operation->getOutputSocket()); + break; + } + } + } - /* incase we can't load the layer */ - if (operation == NULL) - converter.setInvalidOutput(getOutputSocket(index)); - } - } - } - BKE_image_release_ibuf(image, ibuf, NULL); + /* incase we can't load the layer */ + if (operation == NULL) + converter.setInvalidOutput(getOutputSocket(index)); + } + } + } + BKE_image_release_ibuf(image, ibuf, NULL); - /* without this, multilayer that fail to load will crash blender [#32490] */ - if (is_multilayer_ok == false) { - for (int i = 0; i < getNumberOfOutputSockets(); ++i) - converter.setInvalidOutput(getOutputSocket(i)); - } - } - else { - if (numberOfOutputs > 0) { - ImageOperation *operation = new ImageOperation(); - operation->setImage(image); - operation->setImageUser(imageuser); - operation->setFramenumber(framenumber); - operation->setRenderData(context.getRenderData()); - operation->setViewName(context.getViewName()); - converter.addOperation(operation); + /* without this, multilayer that fail to load will crash blender [#32490] */ + if (is_multilayer_ok == false) { + for (int i = 0; i < getNumberOfOutputSockets(); ++i) + converter.setInvalidOutput(getOutputSocket(i)); + } + } + else { + if (numberOfOutputs > 0) { + ImageOperation *operation = new ImageOperation(); + operation->setImage(image); + operation->setImageUser(imageuser); + operation->setFramenumber(framenumber); + operation->setRenderData(context.getRenderData()); + operation->setViewName(context.getViewName()); + converter.addOperation(operation); - if (outputStraightAlpha) { - NodeOperation *alphaConvertOperation = new ConvertPremulToStraightOperation(); + if (outputStraightAlpha) { + NodeOperation *alphaConvertOperation = new ConvertPremulToStraightOperation(); - converter.addOperation(alphaConvertOperation); - converter.mapOutputSocket(outputImage, alphaConvertOperation->getOutputSocket()); - converter.addLink(operation->getOutputSocket(0), alphaConvertOperation->getInputSocket(0)); - } - else { - converter.mapOutputSocket(outputImage, operation->getOutputSocket()); - } + converter.addOperation(alphaConvertOperation); + converter.mapOutputSocket(outputImage, alphaConvertOperation->getOutputSocket()); + converter.addLink(operation->getOutputSocket(0), alphaConvertOperation->getInputSocket(0)); + } + else { + converter.mapOutputSocket(outputImage, operation->getOutputSocket()); + } - converter.addPreview(operation->getOutputSocket()); - } + converter.addPreview(operation->getOutputSocket()); + } - if (numberOfOutputs > 1) { - NodeOutput *alphaImage = this->getOutputSocket(1); - ImageAlphaOperation *alphaOperation = new ImageAlphaOperation(); - alphaOperation->setImage(image); - alphaOperation->setImageUser(imageuser); - alphaOperation->setFramenumber(framenumber); - alphaOperation->setRenderData(context.getRenderData()); - alphaOperation->setViewName(context.getViewName()); - converter.addOperation(alphaOperation); + if (numberOfOutputs > 1) { + NodeOutput *alphaImage = this->getOutputSocket(1); + ImageAlphaOperation *alphaOperation = new ImageAlphaOperation(); + alphaOperation->setImage(image); + alphaOperation->setImageUser(imageuser); + alphaOperation->setFramenumber(framenumber); + alphaOperation->setRenderData(context.getRenderData()); + alphaOperation->setViewName(context.getViewName()); + converter.addOperation(alphaOperation); - converter.mapOutputSocket(alphaImage, alphaOperation->getOutputSocket()); - } - if (numberOfOutputs > 2) { - NodeOutput *depthImage = this->getOutputSocket(2); - ImageDepthOperation *depthOperation = new ImageDepthOperation(); - depthOperation->setImage(image); - depthOperation->setImageUser(imageuser); - depthOperation->setFramenumber(framenumber); - depthOperation->setRenderData(context.getRenderData()); - depthOperation->setViewName(context.getViewName()); - converter.addOperation(depthOperation); + converter.mapOutputSocket(alphaImage, alphaOperation->getOutputSocket()); + } + if (numberOfOutputs > 2) { + NodeOutput *depthImage = this->getOutputSocket(2); + ImageDepthOperation *depthOperation = new ImageDepthOperation(); + depthOperation->setImage(image); + depthOperation->setImageUser(imageuser); + depthOperation->setFramenumber(framenumber); + depthOperation->setRenderData(context.getRenderData()); + depthOperation->setViewName(context.getViewName()); + converter.addOperation(depthOperation); - converter.mapOutputSocket(depthImage, depthOperation->getOutputSocket()); - } - if (numberOfOutputs > 3) { - /* happens when unlinking image datablock from multilayer node */ - for (int i = 3; i < numberOfOutputs; i++) { - NodeOutput *output = this->getOutputSocket(i); - NodeOperation *operation = NULL; - switch (output->getDataType()) { - case COM_DT_VALUE: - { - SetValueOperation *valueoperation = new SetValueOperation(); - valueoperation->setValue(0.0f); - operation = valueoperation; - break; - } - case COM_DT_VECTOR: - { - SetVectorOperation *vectoroperation = new SetVectorOperation(); - vectoroperation->setX(0.0f); - vectoroperation->setY(0.0f); - vectoroperation->setW(0.0f); - operation = vectoroperation; - break; - } - case COM_DT_COLOR: - { - SetColorOperation *coloroperation = new SetColorOperation(); - coloroperation->setChannel1(0.0f); - coloroperation->setChannel2(0.0f); - coloroperation->setChannel3(0.0f); - coloroperation->setChannel4(0.0f); - operation = coloroperation; - break; - } - } + converter.mapOutputSocket(depthImage, depthOperation->getOutputSocket()); + } + if (numberOfOutputs > 3) { + /* happens when unlinking image datablock from multilayer node */ + for (int i = 3; i < numberOfOutputs; i++) { + NodeOutput *output = this->getOutputSocket(i); + NodeOperation *operation = NULL; + switch (output->getDataType()) { + case COM_DT_VALUE: { + SetValueOperation *valueoperation = new SetValueOperation(); + valueoperation->setValue(0.0f); + operation = valueoperation; + break; + } + case COM_DT_VECTOR: { + SetVectorOperation *vectoroperation = new SetVectorOperation(); + vectoroperation->setX(0.0f); + vectoroperation->setY(0.0f); + vectoroperation->setW(0.0f); + operation = vectoroperation; + break; + } + case COM_DT_COLOR: { + SetColorOperation *coloroperation = new SetColorOperation(); + coloroperation->setChannel1(0.0f); + coloroperation->setChannel2(0.0f); + coloroperation->setChannel3(0.0f); + coloroperation->setChannel4(0.0f); + operation = coloroperation; + break; + } + } - if (operation) { - /* not supporting multiview for this generic case */ - converter.addOperation(operation); - converter.mapOutputSocket(output, operation->getOutputSocket()); - } - } - } - } + if (operation) { + /* not supporting multiview for this generic case */ + converter.addOperation(operation); + converter.mapOutputSocket(output, operation->getOutputSocket()); + } + } + } + } } diff --git a/source/blender/compositor/nodes/COM_ImageNode.h b/source/blender/compositor/nodes/COM_ImageNode.h index 936d5941676..781fef37355 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.h +++ b/source/blender/compositor/nodes/COM_ImageNode.h @@ -21,7 +21,7 @@ #include "DNA_node_types.h" #include "DNA_image_types.h" extern "C" { -# include "RE_engine.h" +#include "RE_engine.h" } /** @@ -29,11 +29,18 @@ extern "C" { * \ingroup Node */ class ImageNode : public Node { -private: - NodeOperation *doMultilayerCheck(NodeConverter &converter, RenderLayer *rl, Image *image, ImageUser *user, - int framenumber, int outputsocketIndex, int passtype, int view, DataType datatype) const; -public: - ImageNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + private: + NodeOperation *doMultilayerCheck(NodeConverter &converter, + RenderLayer *rl, + Image *image, + ImageUser *user, + int framenumber, + int outputsocketIndex, + int passtype, + int view, + DataType datatype) const; + public: + ImageNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; diff --git a/source/blender/compositor/nodes/COM_InpaintNode.cpp b/source/blender/compositor/nodes/COM_InpaintNode.cpp index 84cc7a8118d..454aa3e147b 100644 --- a/source/blender/compositor/nodes/COM_InpaintNode.cpp +++ b/source/blender/compositor/nodes/COM_InpaintNode.cpp @@ -24,21 +24,22 @@ InpaintNode::InpaintNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void InpaintNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void InpaintNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorNode = this->getbNode(); + bNode *editorNode = this->getbNode(); - /* if (editorNode->custom1 == CMP_NODE_INPAINT_SIMPLE) { */ - if (true) { - InpaintSimpleOperation *operation = new InpaintSimpleOperation(); - operation->setIterations(editorNode->custom2); - converter.addOperation(operation); + /* if (editorNode->custom1 == CMP_NODE_INPAINT_SIMPLE) { */ + if (true) { + InpaintSimpleOperation *operation = new InpaintSimpleOperation(); + operation->setIterations(editorNode->custom2); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } } diff --git a/source/blender/compositor/nodes/COM_InpaintNode.h b/source/blender/compositor/nodes/COM_InpaintNode.h index bbfb462667b..61a7ac63146 100644 --- a/source/blender/compositor/nodes/COM_InpaintNode.h +++ b/source/blender/compositor/nodes/COM_InpaintNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class InpaintNode : public Node { -public: - InpaintNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + InpaintNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_InvertNode.cpp b/source/blender/compositor/nodes/COM_InvertNode.cpp index 769e0214b3b..82dd707a817 100644 --- a/source/blender/compositor/nodes/COM_InvertNode.cpp +++ b/source/blender/compositor/nodes/COM_InvertNode.cpp @@ -23,18 +23,19 @@ InvertNode::InvertNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void InvertNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void InvertNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - InvertOperation *operation = new InvertOperation(); - bNode *node = this->getbNode(); - operation->setColor(node->custom1 & CMP_CHAN_RGB); - operation->setAlpha(node->custom1 & CMP_CHAN_A); - converter.addOperation(operation); + InvertOperation *operation = new InvertOperation(); + bNode *node = this->getbNode(); + operation->setColor(node->custom1 & CMP_CHAN_RGB); + operation->setAlpha(node->custom1 & CMP_CHAN_A); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_InvertNode.h b/source/blender/compositor/nodes/COM_InvertNode.h index b15bfca012e..02e2eb38dc9 100644 --- a/source/blender/compositor/nodes/COM_InvertNode.h +++ b/source/blender/compositor/nodes/COM_InvertNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class InvertNode : public Node { -public: - InvertNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + InvertNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp index 9050dba676b..1bb9b9aa057 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.cpp +++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp @@ -39,273 +39,309 @@ KeyingNode::KeyingNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -NodeOperationOutput *KeyingNode::setupPreBlur(NodeConverter &converter, NodeInput *inputImage, int size) const +NodeOperationOutput *KeyingNode::setupPreBlur(NodeConverter &converter, + NodeInput *inputImage, + int size) const { - ConvertRGBToYCCOperation *convertRGBToYCCOperation = new ConvertRGBToYCCOperation(); - convertRGBToYCCOperation->setMode(BLI_YCC_ITU_BT709); - converter.addOperation(convertRGBToYCCOperation); - - converter.mapInputSocket(inputImage, convertRGBToYCCOperation->getInputSocket(0)); - - CombineChannelsOperation *combineOperation = new CombineChannelsOperation(); - converter.addOperation(combineOperation); - - for (int channel = 0; channel < 4; channel++) { - SeparateChannelOperation *separateOperation = new SeparateChannelOperation(); - separateOperation->setChannel(channel); - converter.addOperation(separateOperation); - - converter.addLink(convertRGBToYCCOperation->getOutputSocket(0), separateOperation->getInputSocket(0)); - - if (channel == 0 || channel == 3) { - converter.addLink(separateOperation->getOutputSocket(0), combineOperation->getInputSocket(channel)); - } - else { - KeyingBlurOperation *blurXOperation = new KeyingBlurOperation(); - blurXOperation->setSize(size); - blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X); - converter.addOperation(blurXOperation); - - KeyingBlurOperation *blurYOperation = new KeyingBlurOperation(); - blurYOperation->setSize(size); - blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y); - converter.addOperation(blurYOperation); - - converter.addLink(separateOperation->getOutputSocket(), blurXOperation->getInputSocket(0)); - converter.addLink(blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0)); - converter.addLink(blurYOperation->getOutputSocket(0), combineOperation->getInputSocket(channel)); - } - } - - ConvertYCCToRGBOperation *convertYCCToRGBOperation = new ConvertYCCToRGBOperation(); - convertYCCToRGBOperation->setMode(BLI_YCC_ITU_BT709); - converter.addOperation(convertYCCToRGBOperation); - - converter.addLink(combineOperation->getOutputSocket(0), convertYCCToRGBOperation->getInputSocket(0)); - - return convertYCCToRGBOperation->getOutputSocket(0); + ConvertRGBToYCCOperation *convertRGBToYCCOperation = new ConvertRGBToYCCOperation(); + convertRGBToYCCOperation->setMode(BLI_YCC_ITU_BT709); + converter.addOperation(convertRGBToYCCOperation); + + converter.mapInputSocket(inputImage, convertRGBToYCCOperation->getInputSocket(0)); + + CombineChannelsOperation *combineOperation = new CombineChannelsOperation(); + converter.addOperation(combineOperation); + + for (int channel = 0; channel < 4; channel++) { + SeparateChannelOperation *separateOperation = new SeparateChannelOperation(); + separateOperation->setChannel(channel); + converter.addOperation(separateOperation); + + converter.addLink(convertRGBToYCCOperation->getOutputSocket(0), + separateOperation->getInputSocket(0)); + + if (channel == 0 || channel == 3) { + converter.addLink(separateOperation->getOutputSocket(0), + combineOperation->getInputSocket(channel)); + } + else { + KeyingBlurOperation *blurXOperation = new KeyingBlurOperation(); + blurXOperation->setSize(size); + blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X); + converter.addOperation(blurXOperation); + + KeyingBlurOperation *blurYOperation = new KeyingBlurOperation(); + blurYOperation->setSize(size); + blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y); + converter.addOperation(blurYOperation); + + converter.addLink(separateOperation->getOutputSocket(), blurXOperation->getInputSocket(0)); + converter.addLink(blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0)); + converter.addLink(blurYOperation->getOutputSocket(0), + combineOperation->getInputSocket(channel)); + } + } + + ConvertYCCToRGBOperation *convertYCCToRGBOperation = new ConvertYCCToRGBOperation(); + convertYCCToRGBOperation->setMode(BLI_YCC_ITU_BT709); + converter.addOperation(convertYCCToRGBOperation); + + converter.addLink(combineOperation->getOutputSocket(0), + convertYCCToRGBOperation->getInputSocket(0)); + + return convertYCCToRGBOperation->getOutputSocket(0); } -NodeOperationOutput *KeyingNode::setupPostBlur(NodeConverter &converter, NodeOperationOutput *postBlurInput, int size) const +NodeOperationOutput *KeyingNode::setupPostBlur(NodeConverter &converter, + NodeOperationOutput *postBlurInput, + int size) const { - KeyingBlurOperation *blurXOperation = new KeyingBlurOperation(); - blurXOperation->setSize(size); - blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X); - converter.addOperation(blurXOperation); + KeyingBlurOperation *blurXOperation = new KeyingBlurOperation(); + blurXOperation->setSize(size); + blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X); + converter.addOperation(blurXOperation); - KeyingBlurOperation *blurYOperation = new KeyingBlurOperation(); - blurYOperation->setSize(size); - blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y); - converter.addOperation(blurYOperation); + KeyingBlurOperation *blurYOperation = new KeyingBlurOperation(); + blurYOperation->setSize(size); + blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y); + converter.addOperation(blurYOperation); - converter.addLink(postBlurInput, blurXOperation->getInputSocket(0)); - converter.addLink(blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0)); + converter.addLink(postBlurInput, blurXOperation->getInputSocket(0)); + converter.addLink(blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0)); - return blurYOperation->getOutputSocket(); + return blurYOperation->getOutputSocket(); } -NodeOperationOutput *KeyingNode::setupDilateErode(NodeConverter &converter, NodeOperationOutput *dilateErodeInput, int distance) const +NodeOperationOutput *KeyingNode::setupDilateErode(NodeConverter &converter, + NodeOperationOutput *dilateErodeInput, + int distance) const { - DilateDistanceOperation *dilateErodeOperation; - if (distance > 0) { - dilateErodeOperation = new DilateDistanceOperation(); - dilateErodeOperation->setDistance(distance); - } - else { - dilateErodeOperation = new ErodeDistanceOperation(); - dilateErodeOperation->setDistance(-distance); - } - converter.addOperation(dilateErodeOperation); - - converter.addLink(dilateErodeInput, dilateErodeOperation->getInputSocket(0)); - - return dilateErodeOperation->getOutputSocket(0); + DilateDistanceOperation *dilateErodeOperation; + if (distance > 0) { + dilateErodeOperation = new DilateDistanceOperation(); + dilateErodeOperation->setDistance(distance); + } + else { + dilateErodeOperation = new ErodeDistanceOperation(); + dilateErodeOperation->setDistance(-distance); + } + converter.addOperation(dilateErodeOperation); + + converter.addLink(dilateErodeInput, dilateErodeOperation->getInputSocket(0)); + + return dilateErodeOperation->getOutputSocket(0); } -NodeOperationOutput *KeyingNode::setupFeather(NodeConverter &converter, const CompositorContext &context, - NodeOperationOutput *featherInput, int falloff, int distance) const +NodeOperationOutput *KeyingNode::setupFeather(NodeConverter &converter, + const CompositorContext &context, + NodeOperationOutput *featherInput, + int falloff, + int distance) const { - /* this uses a modified gaussian blur function otherwise its far too slow */ - CompositorQuality quality = context.getQuality(); - - /* initialize node data */ - NodeBlurData data; - memset(&data, 0, sizeof(NodeBlurData)); - data.filtertype = R_FILTER_GAUSS; - if (distance > 0) { - data.sizex = data.sizey = distance; - } - else { - data.sizex = data.sizey = -distance; - } - - GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); - operationx->setData(&data); - operationx->setQuality(quality); - operationx->setSize(1.0f); - operationx->setSubtract(distance < 0); - operationx->setFalloff(falloff); - converter.addOperation(operationx); - - GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); - operationy->setData(&data); - operationy->setQuality(quality); - operationy->setSize(1.0f); - operationy->setSubtract(distance < 0); - operationy->setFalloff(falloff); - converter.addOperation(operationy); - - converter.addLink(featherInput, operationx->getInputSocket(0)); - converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); - - return operationy->getOutputSocket(); + /* this uses a modified gaussian blur function otherwise its far too slow */ + CompositorQuality quality = context.getQuality(); + + /* initialize node data */ + NodeBlurData data; + memset(&data, 0, sizeof(NodeBlurData)); + data.filtertype = R_FILTER_GAUSS; + if (distance > 0) { + data.sizex = data.sizey = distance; + } + else { + data.sizex = data.sizey = -distance; + } + + GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); + operationx->setData(&data); + operationx->setQuality(quality); + operationx->setSize(1.0f); + operationx->setSubtract(distance < 0); + operationx->setFalloff(falloff); + converter.addOperation(operationx); + + GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); + operationy->setData(&data); + operationy->setQuality(quality); + operationy->setSize(1.0f); + operationy->setSubtract(distance < 0); + operationy->setFalloff(falloff); + converter.addOperation(operationy); + + converter.addLink(featherInput, operationx->getInputSocket(0)); + converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); + + return operationy->getOutputSocket(); } -NodeOperationOutput *KeyingNode::setupDespill(NodeConverter &converter, NodeOperationOutput *despillInput, NodeInput *inputScreen, - float factor, float colorBalance) const +NodeOperationOutput *KeyingNode::setupDespill(NodeConverter &converter, + NodeOperationOutput *despillInput, + NodeInput *inputScreen, + float factor, + float colorBalance) const { - KeyingDespillOperation *despillOperation = new KeyingDespillOperation(); - despillOperation->setDespillFactor(factor); - despillOperation->setColorBalance(colorBalance); - converter.addOperation(despillOperation); + KeyingDespillOperation *despillOperation = new KeyingDespillOperation(); + despillOperation->setDespillFactor(factor); + despillOperation->setColorBalance(colorBalance); + converter.addOperation(despillOperation); - converter.addLink(despillInput, despillOperation->getInputSocket(0)); - converter.mapInputSocket(inputScreen, despillOperation->getInputSocket(1)); + converter.addLink(despillInput, despillOperation->getInputSocket(0)); + converter.mapInputSocket(inputScreen, despillOperation->getInputSocket(1)); - return despillOperation->getOutputSocket(0); + return despillOperation->getOutputSocket(0); } -NodeOperationOutput *KeyingNode::setupClip(NodeConverter &converter, NodeOperationOutput *clipInput, int kernelRadius, float kernelTolerance, - float clipBlack, float clipWhite, bool edgeMatte) const +NodeOperationOutput *KeyingNode::setupClip(NodeConverter &converter, + NodeOperationOutput *clipInput, + int kernelRadius, + float kernelTolerance, + float clipBlack, + float clipWhite, + bool edgeMatte) const { - KeyingClipOperation *clipOperation = new KeyingClipOperation(); - clipOperation->setKernelRadius(kernelRadius); - clipOperation->setKernelTolerance(kernelTolerance); - clipOperation->setClipBlack(clipBlack); - clipOperation->setClipWhite(clipWhite); - clipOperation->setIsEdgeMatte(edgeMatte); - converter.addOperation(clipOperation); + KeyingClipOperation *clipOperation = new KeyingClipOperation(); + clipOperation->setKernelRadius(kernelRadius); + clipOperation->setKernelTolerance(kernelTolerance); + clipOperation->setClipBlack(clipBlack); + clipOperation->setClipWhite(clipWhite); + clipOperation->setIsEdgeMatte(edgeMatte); + converter.addOperation(clipOperation); - converter.addLink(clipInput, clipOperation->getInputSocket(0)); + converter.addLink(clipInput, clipOperation->getInputSocket(0)); - return clipOperation->getOutputSocket(0); + return clipOperation->getOutputSocket(0); } -void KeyingNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void KeyingNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - NodeKeyingData *keying_data = (NodeKeyingData *) editorNode->storage; - - NodeInput *inputImage = this->getInputSocket(0); - NodeInput *inputScreen = this->getInputSocket(1); - NodeInput *inputGarbageMatte = this->getInputSocket(2); - NodeInput *inputCoreMatte = this->getInputSocket(3); - NodeOutput *outputImage = this->getOutputSocket(0); - NodeOutput *outputMatte = this->getOutputSocket(1); - NodeOutput *outputEdges = this->getOutputSocket(2); - NodeOperationOutput *postprocessedMatte = NULL, *postprocessedImage = NULL, *edgesMatte = NULL; - - /* keying operation */ - KeyingOperation *keyingOperation = new KeyingOperation(); - keyingOperation->setScreenBalance(keying_data->screen_balance); - converter.addOperation(keyingOperation); - - converter.mapInputSocket(inputScreen, keyingOperation->getInputSocket(1)); - - if (keying_data->blur_pre) { - /* chroma preblur operation for input of keying operation */ - NodeOperationOutput *preBluredImage = setupPreBlur(converter, inputImage, keying_data->blur_pre); - converter.addLink(preBluredImage, keyingOperation->getInputSocket(0)); - } - else { - converter.mapInputSocket(inputImage, keyingOperation->getInputSocket(0)); - } - - postprocessedMatte = keyingOperation->getOutputSocket(); - - /* black / white clipping */ - if (keying_data->clip_black > 0.0f || keying_data->clip_white < 1.0f) { - postprocessedMatte = setupClip(converter, postprocessedMatte, - keying_data->edge_kernel_radius, keying_data->edge_kernel_tolerance, - keying_data->clip_black, keying_data->clip_white, false); - } - - /* output edge matte */ - edgesMatte = setupClip(converter, postprocessedMatte, - keying_data->edge_kernel_radius, keying_data->edge_kernel_tolerance, - keying_data->clip_black, keying_data->clip_white, true); - - /* apply garbage matte */ - if (inputGarbageMatte->isLinked()) { - SetValueOperation *valueOperation = new SetValueOperation(); - valueOperation->setValue(1.0f); - converter.addOperation(valueOperation); - - MathSubtractOperation *subtractOperation = new MathSubtractOperation(); - converter.addOperation(subtractOperation); - - MathMinimumOperation *minOperation = new MathMinimumOperation(); - converter.addOperation(minOperation); - - converter.addLink(valueOperation->getOutputSocket(), subtractOperation->getInputSocket(0)); - converter.mapInputSocket(inputGarbageMatte, subtractOperation->getInputSocket(1)); - - converter.addLink(subtractOperation->getOutputSocket(), minOperation->getInputSocket(0)); - converter.addLink(postprocessedMatte, minOperation->getInputSocket(1)); - - postprocessedMatte = minOperation->getOutputSocket(); - } - - /* apply core matte */ - if (inputCoreMatte->isLinked()) { - MathMaximumOperation *maxOperation = new MathMaximumOperation(); - converter.addOperation(maxOperation); - - converter.mapInputSocket(inputCoreMatte, maxOperation->getInputSocket(0)); - converter.addLink(postprocessedMatte, maxOperation->getInputSocket(1)); - - postprocessedMatte = maxOperation->getOutputSocket(); - } - - /* apply blur on matte if needed */ - if (keying_data->blur_post) - postprocessedMatte = setupPostBlur(converter, postprocessedMatte, keying_data->blur_post); - - /* matte dilate/erode */ - if (keying_data->dilate_distance != 0) { - postprocessedMatte = setupDilateErode(converter, postprocessedMatte, keying_data->dilate_distance); - } - - /* matte feather */ - if (keying_data->feather_distance != 0) { - postprocessedMatte = setupFeather(converter, context, postprocessedMatte, keying_data->feather_falloff, - keying_data->feather_distance); - } - - /* set alpha channel to output image */ - SetAlphaOperation *alphaOperation = new SetAlphaOperation(); - converter.addOperation(alphaOperation); - - converter.mapInputSocket(inputImage, alphaOperation->getInputSocket(0)); - converter.addLink(postprocessedMatte, alphaOperation->getInputSocket(1)); - - postprocessedImage = alphaOperation->getOutputSocket(); - - /* despill output image */ - if (keying_data->despill_factor > 0.0f) { - postprocessedImage = setupDespill(converter, postprocessedImage, - inputScreen, - keying_data->despill_factor, - keying_data->despill_balance); - } - - /* connect result to output sockets */ - converter.mapOutputSocket(outputImage, postprocessedImage); - converter.mapOutputSocket(outputMatte, postprocessedMatte); - - if (edgesMatte) - converter.mapOutputSocket(outputEdges, edgesMatte); + bNode *editorNode = this->getbNode(); + NodeKeyingData *keying_data = (NodeKeyingData *)editorNode->storage; + + NodeInput *inputImage = this->getInputSocket(0); + NodeInput *inputScreen = this->getInputSocket(1); + NodeInput *inputGarbageMatte = this->getInputSocket(2); + NodeInput *inputCoreMatte = this->getInputSocket(3); + NodeOutput *outputImage = this->getOutputSocket(0); + NodeOutput *outputMatte = this->getOutputSocket(1); + NodeOutput *outputEdges = this->getOutputSocket(2); + NodeOperationOutput *postprocessedMatte = NULL, *postprocessedImage = NULL, *edgesMatte = NULL; + + /* keying operation */ + KeyingOperation *keyingOperation = new KeyingOperation(); + keyingOperation->setScreenBalance(keying_data->screen_balance); + converter.addOperation(keyingOperation); + + converter.mapInputSocket(inputScreen, keyingOperation->getInputSocket(1)); + + if (keying_data->blur_pre) { + /* chroma preblur operation for input of keying operation */ + NodeOperationOutput *preBluredImage = setupPreBlur( + converter, inputImage, keying_data->blur_pre); + converter.addLink(preBluredImage, keyingOperation->getInputSocket(0)); + } + else { + converter.mapInputSocket(inputImage, keyingOperation->getInputSocket(0)); + } + + postprocessedMatte = keyingOperation->getOutputSocket(); + + /* black / white clipping */ + if (keying_data->clip_black > 0.0f || keying_data->clip_white < 1.0f) { + postprocessedMatte = setupClip(converter, + postprocessedMatte, + keying_data->edge_kernel_radius, + keying_data->edge_kernel_tolerance, + keying_data->clip_black, + keying_data->clip_white, + false); + } + + /* output edge matte */ + edgesMatte = setupClip(converter, + postprocessedMatte, + keying_data->edge_kernel_radius, + keying_data->edge_kernel_tolerance, + keying_data->clip_black, + keying_data->clip_white, + true); + + /* apply garbage matte */ + if (inputGarbageMatte->isLinked()) { + SetValueOperation *valueOperation = new SetValueOperation(); + valueOperation->setValue(1.0f); + converter.addOperation(valueOperation); + + MathSubtractOperation *subtractOperation = new MathSubtractOperation(); + converter.addOperation(subtractOperation); + + MathMinimumOperation *minOperation = new MathMinimumOperation(); + converter.addOperation(minOperation); + + converter.addLink(valueOperation->getOutputSocket(), subtractOperation->getInputSocket(0)); + converter.mapInputSocket(inputGarbageMatte, subtractOperation->getInputSocket(1)); + + converter.addLink(subtractOperation->getOutputSocket(), minOperation->getInputSocket(0)); + converter.addLink(postprocessedMatte, minOperation->getInputSocket(1)); + + postprocessedMatte = minOperation->getOutputSocket(); + } + + /* apply core matte */ + if (inputCoreMatte->isLinked()) { + MathMaximumOperation *maxOperation = new MathMaximumOperation(); + converter.addOperation(maxOperation); + + converter.mapInputSocket(inputCoreMatte, maxOperation->getInputSocket(0)); + converter.addLink(postprocessedMatte, maxOperation->getInputSocket(1)); + + postprocessedMatte = maxOperation->getOutputSocket(); + } + + /* apply blur on matte if needed */ + if (keying_data->blur_post) + postprocessedMatte = setupPostBlur(converter, postprocessedMatte, keying_data->blur_post); + + /* matte dilate/erode */ + if (keying_data->dilate_distance != 0) { + postprocessedMatte = setupDilateErode( + converter, postprocessedMatte, keying_data->dilate_distance); + } + + /* matte feather */ + if (keying_data->feather_distance != 0) { + postprocessedMatte = setupFeather(converter, + context, + postprocessedMatte, + keying_data->feather_falloff, + keying_data->feather_distance); + } + + /* set alpha channel to output image */ + SetAlphaOperation *alphaOperation = new SetAlphaOperation(); + converter.addOperation(alphaOperation); + + converter.mapInputSocket(inputImage, alphaOperation->getInputSocket(0)); + converter.addLink(postprocessedMatte, alphaOperation->getInputSocket(1)); + + postprocessedImage = alphaOperation->getOutputSocket(); + + /* despill output image */ + if (keying_data->despill_factor > 0.0f) { + postprocessedImage = setupDespill(converter, + postprocessedImage, + inputScreen, + keying_data->despill_factor, + keying_data->despill_balance); + } + + /* connect result to output sockets */ + converter.mapOutputSocket(outputImage, postprocessedImage); + converter.mapOutputSocket(outputMatte, postprocessedMatte); + + if (edgesMatte) + converter.mapOutputSocket(outputEdges, edgesMatte); } diff --git a/source/blender/compositor/nodes/COM_KeyingNode.h b/source/blender/compositor/nodes/COM_KeyingNode.h index cb752f517bd..9ae1d04b03f 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.h +++ b/source/blender/compositor/nodes/COM_KeyingNode.h @@ -23,18 +23,35 @@ * \ingroup Node */ class KeyingNode : public Node { -protected: - NodeOperationOutput *setupPreBlur(NodeConverter &converter, NodeInput *inputImage, int size) const; - NodeOperationOutput *setupPostBlur(NodeConverter &converter, NodeOperationOutput *postBlurInput, int size) const; - NodeOperationOutput *setupDilateErode(NodeConverter &converter, NodeOperationOutput *dilateErodeInput, int distance) const; - NodeOperationOutput *setupFeather(NodeConverter &converter, const CompositorContext &context, NodeOperationOutput *featherInput, - int falloff, int distance) const; - NodeOperationOutput *setupDespill(NodeConverter &converter, NodeOperationOutput *despillInput, NodeInput *inputSrceen, - float factor, float colorBalance) const; - NodeOperationOutput *setupClip(NodeConverter &converter, NodeOperationOutput *clipInput, int kernelRadius, float kernelTolerance, - float clipBlack, float clipWhite, bool edgeMatte) const; -public: - KeyingNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + protected: + NodeOperationOutput *setupPreBlur(NodeConverter &converter, + NodeInput *inputImage, + int size) const; + NodeOperationOutput *setupPostBlur(NodeConverter &converter, + NodeOperationOutput *postBlurInput, + int size) const; + NodeOperationOutput *setupDilateErode(NodeConverter &converter, + NodeOperationOutput *dilateErodeInput, + int distance) const; + NodeOperationOutput *setupFeather(NodeConverter &converter, + const CompositorContext &context, + NodeOperationOutput *featherInput, + int falloff, + int distance) const; + NodeOperationOutput *setupDespill(NodeConverter &converter, + NodeOperationOutput *despillInput, + NodeInput *inputSrceen, + float factor, + float colorBalance) const; + NodeOperationOutput *setupClip(NodeConverter &converter, + NodeOperationOutput *clipInput, + int kernelRadius, + float kernelTolerance, + float clipBlack, + float clipWhite, + bool edgeMatte) const; + public: + KeyingNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp index 562e14a0ec0..6a005b2b712 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp @@ -21,28 +21,29 @@ #include "COM_KeyingScreenOperation.h" extern "C" { -# include "DNA_movieclip_types.h" +#include "DNA_movieclip_types.h" } KeyingScreenNode::KeyingScreenNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void KeyingScreenNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void KeyingScreenNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - MovieClip *clip = (MovieClip *) editorNode->id; - NodeKeyingScreenData *keyingscreen_data = (NodeKeyingScreenData *) editorNode->storage; + bNode *editorNode = this->getbNode(); + MovieClip *clip = (MovieClip *)editorNode->id; + NodeKeyingScreenData *keyingscreen_data = (NodeKeyingScreenData *)editorNode->storage; - NodeOutput *outputScreen = this->getOutputSocket(0); + NodeOutput *outputScreen = this->getOutputSocket(0); - // always connect the output image - KeyingScreenOperation *operation = new KeyingScreenOperation(); - operation->setMovieClip(clip); - operation->setTrackingObject(keyingscreen_data->tracking_object); - operation->setFramenumber(context.getFramenumber()); - converter.addOperation(operation); + // always connect the output image + KeyingScreenOperation *operation = new KeyingScreenOperation(); + operation->setMovieClip(clip); + operation->setTrackingObject(keyingscreen_data->tracking_object); + operation->setFramenumber(context.getFramenumber()); + converter.addOperation(operation); - converter.mapOutputSocket(outputScreen, operation->getOutputSocket()); + converter.mapOutputSocket(outputScreen, operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.h b/source/blender/compositor/nodes/COM_KeyingScreenNode.h index 196ddd6db8d..edaf0238667 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.h +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.h @@ -24,8 +24,7 @@ * \ingroup Node */ class KeyingScreenNode : public Node { -public: - KeyingScreenNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; - + public: + KeyingScreenNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp index 4f8d8589a20..a4e638e20e6 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp @@ -23,36 +23,37 @@ LensDistortionNode::LensDistortionNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void LensDistortionNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void LensDistortionNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorNode = this->getbNode(); - NodeLensDist *data = (NodeLensDist *)editorNode->storage; - if (data->proj) { - ProjectorLensDistortionOperation *operation = new ProjectorLensDistortionOperation(); - converter.addOperation(operation); + bNode *editorNode = this->getbNode(); + NodeLensDist *data = (NodeLensDist *)editorNode->storage; + if (data->proj) { + ProjectorLensDistortionOperation *operation = new ProjectorLensDistortionOperation(); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - else { - ScreenLensDistortionOperation *operation = new ScreenLensDistortionOperation(); - operation->setFit(data->fit); - operation->setJitter(data->jit); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + else { + ScreenLensDistortionOperation *operation = new ScreenLensDistortionOperation(); + operation->setFit(data->fit); + operation->setJitter(data->jit); - if (!getInputSocket(1)->isLinked()) - operation->setDistortion(getInputSocket(1)->getEditorValueFloat()); - if (!getInputSocket(2)->isLinked()) - operation->setDispersion(getInputSocket(2)->getEditorValueFloat()); + if (!getInputSocket(1)->isLinked()) + operation->setDistortion(getInputSocket(1)->getEditorValueFloat()); + if (!getInputSocket(2)->isLinked()) + operation->setDispersion(getInputSocket(2)->getEditorValueFloat()); - converter.addOperation(operation); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } } diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.h b/source/blender/compositor/nodes/COM_LensDistortionNode.h index 91b962a0faa..f4d9e127558 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.h +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class LensDistortionNode : public Node { -public: - LensDistortionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + LensDistortionNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp index a5976ba3127..3599372f189 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp @@ -24,29 +24,30 @@ LuminanceMatteNode::LuminanceMatteNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void LuminanceMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void LuminanceMatteNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorsnode = getbNode(); - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); + bNode *editorsnode = getbNode(); + NodeInput *inputSocket = this->getInputSocket(0); + NodeOutput *outputSocketImage = this->getOutputSocket(0); + NodeOutput *outputSocketMatte = this->getOutputSocket(1); - LuminanceMatteOperation *operationSet = new LuminanceMatteOperation(); - operationSet->setSettings((NodeChroma *)editorsnode->storage); - converter.addOperation(operationSet); + LuminanceMatteOperation *operationSet = new LuminanceMatteOperation(); + operationSet->setSettings((NodeChroma *)editorsnode->storage); + converter.addOperation(operationSet); - converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); - converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); + converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); + converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); - SetAlphaOperation *operation = new SetAlphaOperation(); - converter.addOperation(operation); + SetAlphaOperation *operation = new SetAlphaOperation(); + converter.addOperation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); - converter.addPreview(operation->getOutputSocket()); + converter.addPreview(operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h index 5412016f10b..57a8f25602a 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class LuminanceMatteNode : public Node { -public: - LuminanceMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + LuminanceMatteNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* __COM_LUMINANCEMATTENODE_H__ */ +#endif /* __COM_LUMINANCEMATTENODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.cpp b/source/blender/compositor/nodes/COM_MapRangeNode.cpp index 7abd6f4a595..3b6d2fe0dcb 100644 --- a/source/blender/compositor/nodes/COM_MapRangeNode.cpp +++ b/source/blender/compositor/nodes/COM_MapRangeNode.cpp @@ -23,26 +23,27 @@ MapRangeNode::MapRangeNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void MapRangeNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void MapRangeNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *valueSocket = this->getInputSocket(0); - NodeInput *sourceMinSocket = this->getInputSocket(1); - NodeInput *sourceMaxSocket = this->getInputSocket(2); - NodeInput *destMinSocket = this->getInputSocket(3); - NodeInput *destMaxSocket = this->getInputSocket(4); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *valueSocket = this->getInputSocket(0); + NodeInput *sourceMinSocket = this->getInputSocket(1); + NodeInput *sourceMaxSocket = this->getInputSocket(2); + NodeInput *destMinSocket = this->getInputSocket(3); + NodeInput *destMaxSocket = this->getInputSocket(4); + NodeOutput *outputSocket = this->getOutputSocket(0); - MapRangeOperation *operation = new MapRangeOperation(); - operation->setUseClamp(this->getbNode()->custom1); - converter.addOperation(operation); + MapRangeOperation *operation = new MapRangeOperation(); + operation->setUseClamp(this->getbNode()->custom1); + converter.addOperation(operation); - converter.mapInputSocket(valueSocket, operation->getInputSocket(0)); - converter.mapInputSocket(sourceMinSocket, operation->getInputSocket(1)); - converter.mapInputSocket(sourceMaxSocket, operation->getInputSocket(2)); - converter.mapInputSocket(destMinSocket, operation->getInputSocket(3)); - converter.mapInputSocket(destMaxSocket, operation->getInputSocket(4)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.mapInputSocket(valueSocket, operation->getInputSocket(0)); + converter.mapInputSocket(sourceMinSocket, operation->getInputSocket(1)); + converter.mapInputSocket(sourceMaxSocket, operation->getInputSocket(2)); + converter.mapInputSocket(destMinSocket, operation->getInputSocket(3)); + converter.mapInputSocket(destMaxSocket, operation->getInputSocket(4)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.h b/source/blender/compositor/nodes/COM_MapRangeNode.h index ce9ffa15c1e..b63524291c1 100644 --- a/source/blender/compositor/nodes/COM_MapRangeNode.h +++ b/source/blender/compositor/nodes/COM_MapRangeNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class MapRangeNode : public Node { -public: - MapRangeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + MapRangeNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* __COM_MAPRANGENODE_H__ */ +#endif /* __COM_MAPRANGENODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_MapUVNode.cpp b/source/blender/compositor/nodes/COM_MapUVNode.cpp index 555fe9e87ae..fe4895833cf 100644 --- a/source/blender/compositor/nodes/COM_MapUVNode.cpp +++ b/source/blender/compositor/nodes/COM_MapUVNode.cpp @@ -22,19 +22,20 @@ MapUVNode::MapUVNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void MapUVNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void MapUVNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = this->getbNode(); + bNode *node = this->getbNode(); - MapUVOperation *operation = new MapUVOperation(); - operation->setAlpha((float)node->custom1); - operation->setResolutionInputSocketIndex(1); - converter.addOperation(operation); + MapUVOperation *operation = new MapUVOperation(); + operation->setAlpha((float)node->custom1); + operation->setResolutionInputSocketIndex(1); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_MapUVNode.h b/source/blender/compositor/nodes/COM_MapUVNode.h index c751ee2e72c..46892453b92 100644 --- a/source/blender/compositor/nodes/COM_MapUVNode.h +++ b/source/blender/compositor/nodes/COM_MapUVNode.h @@ -26,8 +26,8 @@ * \ingroup Node */ class MapUVNode : public Node { -public: - MapUVNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + MapUVNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_MapValueNode.cpp b/source/blender/compositor/nodes/COM_MapValueNode.cpp index 8d0d8e47d7f..4ed971a2fcc 100644 --- a/source/blender/compositor/nodes/COM_MapValueNode.cpp +++ b/source/blender/compositor/nodes/COM_MapValueNode.cpp @@ -23,20 +23,21 @@ MapValueNode::MapValueNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void MapValueNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void MapValueNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - TexMapping *storage = (TexMapping *)this->getbNode()->storage; + TexMapping *storage = (TexMapping *)this->getbNode()->storage; - NodeInput *colorSocket = this->getInputSocket(0); - NodeOutput *valueSocket = this->getOutputSocket(0); + NodeInput *colorSocket = this->getInputSocket(0); + NodeOutput *valueSocket = this->getOutputSocket(0); - MapValueOperation *convertProg = new MapValueOperation(); - convertProg->setSettings(storage); - converter.addOperation(convertProg); + MapValueOperation *convertProg = new MapValueOperation(); + convertProg->setSettings(storage); + converter.addOperation(convertProg); - converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0)); - converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0)); + converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0)); + converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_MapValueNode.h b/source/blender/compositor/nodes/COM_MapValueNode.h index 65b9708d163..289b4f24138 100644 --- a/source/blender/compositor/nodes/COM_MapValueNode.h +++ b/source/blender/compositor/nodes/COM_MapValueNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class MapValueNode : public Node { -public: - MapValueNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + MapValueNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* __COM_MAPVALUENODE_H__ */ +#endif /* __COM_MAPVALUENODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_MaskNode.cpp b/source/blender/compositor/nodes/COM_MaskNode.cpp index 5158103c08a..cceeef6b437 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.cpp +++ b/source/blender/compositor/nodes/COM_MaskNode.cpp @@ -21,52 +21,51 @@ #include "COM_MaskOperation.h" extern "C" { -# include "DNA_mask_types.h" +#include "DNA_mask_types.h" } MaskNode::MaskNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void MaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void MaskNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - const RenderData *rd = context.getRenderData(); + const RenderData *rd = context.getRenderData(); - NodeOutput *outputMask = this->getOutputSocket(0); + NodeOutput *outputMask = this->getOutputSocket(0); - bNode *editorNode = this->getbNode(); - NodeMask *data = (NodeMask *)editorNode->storage; - Mask *mask = (Mask *)editorNode->id; + bNode *editorNode = this->getbNode(); + NodeMask *data = (NodeMask *)editorNode->storage; + Mask *mask = (Mask *)editorNode->id; - // always connect the output image - MaskOperation *operation = new MaskOperation(); + // always connect the output image + MaskOperation *operation = new MaskOperation(); - if (editorNode->custom1 & CMP_NODEFLAG_MASK_FIXED) { - operation->setMaskWidth(data->size_x); - operation->setMaskHeight(data->size_y); - } - else if (editorNode->custom1 & CMP_NODEFLAG_MASK_FIXED_SCENE) { - operation->setMaskWidth(data->size_x * (rd->size / 100.0f)); - operation->setMaskHeight(data->size_y * (rd->size / 100.0f)); - } - else { - operation->setMaskWidth(rd->xsch * rd->size / 100.0f); - operation->setMaskHeight(rd->ysch * rd->size / 100.0f); - } + if (editorNode->custom1 & CMP_NODEFLAG_MASK_FIXED) { + operation->setMaskWidth(data->size_x); + operation->setMaskHeight(data->size_y); + } + else if (editorNode->custom1 & CMP_NODEFLAG_MASK_FIXED_SCENE) { + operation->setMaskWidth(data->size_x * (rd->size / 100.0f)); + operation->setMaskHeight(data->size_y * (rd->size / 100.0f)); + } + else { + operation->setMaskWidth(rd->xsch * rd->size / 100.0f); + operation->setMaskHeight(rd->ysch * rd->size / 100.0f); + } - operation->setMask(mask); - operation->setFramenumber(context.getFramenumber()); - operation->setFeather((bool)(editorNode->custom1 & CMP_NODEFLAG_MASK_NO_FEATHER) == 0); + operation->setMask(mask); + operation->setFramenumber(context.getFramenumber()); + operation->setFeather((bool)(editorNode->custom1 & CMP_NODEFLAG_MASK_NO_FEATHER) == 0); - if ((editorNode->custom1 & CMP_NODEFLAG_MASK_MOTION_BLUR) && - (editorNode->custom2 > 1) && - (editorNode->custom3 > FLT_EPSILON)) - { - operation->setMotionBlurSamples(editorNode->custom2); - operation->setMotionBlurShutter(editorNode->custom3); - } + if ((editorNode->custom1 & CMP_NODEFLAG_MASK_MOTION_BLUR) && (editorNode->custom2 > 1) && + (editorNode->custom3 > FLT_EPSILON)) { + operation->setMotionBlurSamples(editorNode->custom2); + operation->setMotionBlurShutter(editorNode->custom3); + } - converter.addOperation(operation); - converter.mapOutputSocket(outputMask, operation->getOutputSocket()); + converter.addOperation(operation); + converter.mapOutputSocket(outputMask, operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_MaskNode.h b/source/blender/compositor/nodes/COM_MaskNode.h index dec6112e8f6..6c8006a8de6 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.h +++ b/source/blender/compositor/nodes/COM_MaskNode.h @@ -27,10 +27,9 @@ * \ingroup Node */ class MaskNode : public Node { -public: - MaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; - + public: + MaskNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* __COM_MASKNODE_H__ */ +#endif /* __COM_MASKNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp index 06753383dfe..5a2f934f37f 100644 --- a/source/blender/compositor/nodes/COM_MathNode.cpp +++ b/source/blender/compositor/nodes/COM_MathNode.cpp @@ -20,92 +20,93 @@ #include "COM_MathBaseOperation.h" #include "COM_ExecutionSystem.h" -void MathNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void MathNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - MathBaseOperation *operation = NULL; + MathBaseOperation *operation = NULL; - switch (this->getbNode()->custom1) { - case NODE_MATH_ADD: - operation = new MathAddOperation(); - break; - case NODE_MATH_SUB: - operation = new MathSubtractOperation(); - break; - case NODE_MATH_MUL: - operation = new MathMultiplyOperation(); - break; - case NODE_MATH_DIVIDE: - operation = new MathDivideOperation(); - break; - case NODE_MATH_SIN: - operation = new MathSineOperation(); - break; - case NODE_MATH_COS: - operation = new MathCosineOperation(); - break; - case NODE_MATH_TAN: - operation = new MathTangentOperation(); - break; - case NODE_MATH_ASIN: - operation = new MathArcSineOperation(); - break; - case NODE_MATH_ACOS: - operation = new MathArcCosineOperation(); - break; - case NODE_MATH_ATAN: - operation = new MathArcTangentOperation(); - break; - case NODE_MATH_POW: - operation = new MathPowerOperation(); - break; - case NODE_MATH_LOG: - operation = new MathLogarithmOperation(); - break; - case NODE_MATH_MIN: - operation = new MathMinimumOperation(); - break; - case NODE_MATH_MAX: - operation = new MathMaximumOperation(); - break; - case NODE_MATH_ROUND: - operation = new MathRoundOperation(); - break; - case NODE_MATH_LESS: - operation = new MathLessThanOperation(); - break; - case NODE_MATH_GREATER: - operation = new MathGreaterThanOperation(); - break; - case NODE_MATH_MOD: - operation = new MathModuloOperation(); - break; - case NODE_MATH_ABS: - operation = new MathAbsoluteOperation(); - break; - case NODE_MATH_ATAN2: - operation = new MathArcTan2Operation(); - break; - case NODE_MATH_FLOOR: - operation = new MathFloorOperation(); - break; - case NODE_MATH_CEIL: - operation = new MathCeilOperation(); - break; - case NODE_MATH_FRACT: - operation = new MathFractOperation(); - break; - case NODE_MATH_SQRT: - operation = new MathSqrtOperation(); - break; - } + switch (this->getbNode()->custom1) { + case NODE_MATH_ADD: + operation = new MathAddOperation(); + break; + case NODE_MATH_SUB: + operation = new MathSubtractOperation(); + break; + case NODE_MATH_MUL: + operation = new MathMultiplyOperation(); + break; + case NODE_MATH_DIVIDE: + operation = new MathDivideOperation(); + break; + case NODE_MATH_SIN: + operation = new MathSineOperation(); + break; + case NODE_MATH_COS: + operation = new MathCosineOperation(); + break; + case NODE_MATH_TAN: + operation = new MathTangentOperation(); + break; + case NODE_MATH_ASIN: + operation = new MathArcSineOperation(); + break; + case NODE_MATH_ACOS: + operation = new MathArcCosineOperation(); + break; + case NODE_MATH_ATAN: + operation = new MathArcTangentOperation(); + break; + case NODE_MATH_POW: + operation = new MathPowerOperation(); + break; + case NODE_MATH_LOG: + operation = new MathLogarithmOperation(); + break; + case NODE_MATH_MIN: + operation = new MathMinimumOperation(); + break; + case NODE_MATH_MAX: + operation = new MathMaximumOperation(); + break; + case NODE_MATH_ROUND: + operation = new MathRoundOperation(); + break; + case NODE_MATH_LESS: + operation = new MathLessThanOperation(); + break; + case NODE_MATH_GREATER: + operation = new MathGreaterThanOperation(); + break; + case NODE_MATH_MOD: + operation = new MathModuloOperation(); + break; + case NODE_MATH_ABS: + operation = new MathAbsoluteOperation(); + break; + case NODE_MATH_ATAN2: + operation = new MathArcTan2Operation(); + break; + case NODE_MATH_FLOOR: + operation = new MathFloorOperation(); + break; + case NODE_MATH_CEIL: + operation = new MathCeilOperation(); + break; + case NODE_MATH_FRACT: + operation = new MathFractOperation(); + break; + case NODE_MATH_SQRT: + operation = new MathSqrtOperation(); + break; + } - if (operation) { - bool useClamp = getbNode()->custom2; - operation->setUseClamp(useClamp); - converter.addOperation(operation); + if (operation) { + bool useClamp = getbNode()->custom2; + operation->setUseClamp(useClamp); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); - } + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + } } diff --git a/source/blender/compositor/nodes/COM_MathNode.h b/source/blender/compositor/nodes/COM_MathNode.h index cf7c9276ba4..e53d84a221f 100644 --- a/source/blender/compositor/nodes/COM_MathNode.h +++ b/source/blender/compositor/nodes/COM_MathNode.h @@ -26,9 +26,11 @@ * \ingroup Node */ class MathNode : public Node { -public: - MathNode(bNode *editorNode) : Node(editorNode) {} - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + MathNode(bNode *editorNode) : Node(editorNode) + { + } + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_MixNode.cpp b/source/blender/compositor/nodes/COM_MixNode.cpp index 4c5888135c7..27a605e28d4 100644 --- a/source/blender/compositor/nodes/COM_MixNode.cpp +++ b/source/blender/compositor/nodes/COM_MixNode.cpp @@ -22,91 +22,91 @@ #include "COM_ExecutionSystem.h" #include "COM_SetValueOperation.h" -#include "DNA_material_types.h" // the ramp types - +#include "DNA_material_types.h" // the ramp types MixNode::MixNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void MixNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void MixNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *valueSocket = this->getInputSocket(0); - NodeInput *color1Socket = this->getInputSocket(1); - NodeInput *color2Socket = this->getInputSocket(2); - NodeOutput *outputSocket = this->getOutputSocket(0); - bNode *editorNode = this->getbNode(); - bool useAlphaPremultiply = (this->getbNode()->custom2 & 1) != 0; - bool useClamp = (this->getbNode()->custom2 & 2) != 0; + NodeInput *valueSocket = this->getInputSocket(0); + NodeInput *color1Socket = this->getInputSocket(1); + NodeInput *color2Socket = this->getInputSocket(2); + NodeOutput *outputSocket = this->getOutputSocket(0); + bNode *editorNode = this->getbNode(); + bool useAlphaPremultiply = (this->getbNode()->custom2 & 1) != 0; + bool useClamp = (this->getbNode()->custom2 & 2) != 0; - MixBaseOperation *convertProg; - switch (editorNode->custom1) { - case MA_RAMP_ADD: - convertProg = new MixAddOperation(); - break; - case MA_RAMP_MULT: - convertProg = new MixMultiplyOperation(); - break; - case MA_RAMP_LIGHT: - convertProg = new MixLightenOperation(); - break; - case MA_RAMP_BURN: - convertProg = new MixBurnOperation(); - break; - case MA_RAMP_HUE: - convertProg = new MixHueOperation(); - break; - case MA_RAMP_COLOR: - convertProg = new MixColorOperation(); - break; - case MA_RAMP_SOFT: - convertProg = new MixSoftLightOperation(); - break; - case MA_RAMP_SCREEN: - convertProg = new MixScreenOperation(); - break; - case MA_RAMP_LINEAR: - convertProg = new MixLinearLightOperation(); - break; - case MA_RAMP_DIFF: - convertProg = new MixDifferenceOperation(); - break; - case MA_RAMP_SAT: - convertProg = new MixSaturationOperation(); - break; - case MA_RAMP_DIV: - convertProg = new MixDivideOperation(); - break; - case MA_RAMP_SUB: - convertProg = new MixSubtractOperation(); - break; - case MA_RAMP_DARK: - convertProg = new MixDarkenOperation(); - break; - case MA_RAMP_OVERLAY: - convertProg = new MixOverlayOperation(); - break; - case MA_RAMP_VAL: - convertProg = new MixValueOperation(); - break; - case MA_RAMP_DODGE: - convertProg = new MixDodgeOperation(); - break; + MixBaseOperation *convertProg; + switch (editorNode->custom1) { + case MA_RAMP_ADD: + convertProg = new MixAddOperation(); + break; + case MA_RAMP_MULT: + convertProg = new MixMultiplyOperation(); + break; + case MA_RAMP_LIGHT: + convertProg = new MixLightenOperation(); + break; + case MA_RAMP_BURN: + convertProg = new MixBurnOperation(); + break; + case MA_RAMP_HUE: + convertProg = new MixHueOperation(); + break; + case MA_RAMP_COLOR: + convertProg = new MixColorOperation(); + break; + case MA_RAMP_SOFT: + convertProg = new MixSoftLightOperation(); + break; + case MA_RAMP_SCREEN: + convertProg = new MixScreenOperation(); + break; + case MA_RAMP_LINEAR: + convertProg = new MixLinearLightOperation(); + break; + case MA_RAMP_DIFF: + convertProg = new MixDifferenceOperation(); + break; + case MA_RAMP_SAT: + convertProg = new MixSaturationOperation(); + break; + case MA_RAMP_DIV: + convertProg = new MixDivideOperation(); + break; + case MA_RAMP_SUB: + convertProg = new MixSubtractOperation(); + break; + case MA_RAMP_DARK: + convertProg = new MixDarkenOperation(); + break; + case MA_RAMP_OVERLAY: + convertProg = new MixOverlayOperation(); + break; + case MA_RAMP_VAL: + convertProg = new MixValueOperation(); + break; + case MA_RAMP_DODGE: + convertProg = new MixDodgeOperation(); + break; - case MA_RAMP_BLEND: - default: - convertProg = new MixBlendOperation(); - break; - } - convertProg->setUseValueAlphaMultiply(useAlphaPremultiply); - convertProg->setUseClamp(useClamp); - converter.addOperation(convertProg); + case MA_RAMP_BLEND: + default: + convertProg = new MixBlendOperation(); + break; + } + convertProg->setUseValueAlphaMultiply(useAlphaPremultiply); + convertProg->setUseClamp(useClamp); + converter.addOperation(convertProg); - converter.mapInputSocket(valueSocket, convertProg->getInputSocket(0)); - converter.mapInputSocket(color1Socket, convertProg->getInputSocket(1)); - converter.mapInputSocket(color2Socket, convertProg->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, convertProg->getOutputSocket(0)); + converter.mapInputSocket(valueSocket, convertProg->getInputSocket(0)); + converter.mapInputSocket(color1Socket, convertProg->getInputSocket(1)); + converter.mapInputSocket(color2Socket, convertProg->getInputSocket(2)); + converter.mapOutputSocket(outputSocket, convertProg->getOutputSocket(0)); - converter.addPreview(convertProg->getOutputSocket(0)); + converter.addPreview(convertProg->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_MixNode.h b/source/blender/compositor/nodes/COM_MixNode.h index 5571599e106..511e1ffa7a8 100644 --- a/source/blender/compositor/nodes/COM_MixNode.h +++ b/source/blender/compositor/nodes/COM_MixNode.h @@ -26,8 +26,8 @@ * \ingroup Node */ class MixNode : public Node { -public: - MixNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + MixNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cpp b/source/blender/compositor/nodes/COM_MovieClipNode.cpp index b79282d37b2..342f0a9f88a 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp +++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp @@ -23,80 +23,84 @@ #include "COM_ConvertColorProfileOperation.h" extern "C" { -# include "DNA_movieclip_types.h" -# include "BKE_movieclip.h" -# include "BKE_tracking.h" -# include "IMB_imbuf.h" +#include "DNA_movieclip_types.h" +#include "BKE_movieclip.h" +#include "BKE_tracking.h" +#include "IMB_imbuf.h" } MovieClipNode::MovieClipNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void MovieClipNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void MovieClipNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - NodeOutput *outputMovieClip = this->getOutputSocket(0); - NodeOutput *alphaMovieClip = this->getOutputSocket(1); - NodeOutput *offsetXMovieClip = this->getOutputSocket(2); - NodeOutput *offsetYMovieClip = this->getOutputSocket(3); - NodeOutput *scaleMovieClip = this->getOutputSocket(4); - NodeOutput *angleMovieClip = this->getOutputSocket(5); + NodeOutput *outputMovieClip = this->getOutputSocket(0); + NodeOutput *alphaMovieClip = this->getOutputSocket(1); + NodeOutput *offsetXMovieClip = this->getOutputSocket(2); + NodeOutput *offsetYMovieClip = this->getOutputSocket(3); + NodeOutput *scaleMovieClip = this->getOutputSocket(4); + NodeOutput *angleMovieClip = this->getOutputSocket(5); - bNode *editorNode = this->getbNode(); - MovieClip *movieClip = (MovieClip *)editorNode->id; - MovieClipUser *movieClipUser = (MovieClipUser *)editorNode->storage; - bool cacheFrame = !context.isRendering(); + bNode *editorNode = this->getbNode(); + MovieClip *movieClip = (MovieClip *)editorNode->id; + MovieClipUser *movieClipUser = (MovieClipUser *)editorNode->storage; + bool cacheFrame = !context.isRendering(); - ImBuf *ibuf = NULL; - if (movieClip) { - if (cacheFrame) - ibuf = BKE_movieclip_get_ibuf(movieClip, movieClipUser); - else - ibuf = BKE_movieclip_get_ibuf_flag(movieClip, movieClipUser, movieClip->flag, MOVIECLIP_CACHE_SKIP); - } + ImBuf *ibuf = NULL; + if (movieClip) { + if (cacheFrame) + ibuf = BKE_movieclip_get_ibuf(movieClip, movieClipUser); + else + ibuf = BKE_movieclip_get_ibuf_flag( + movieClip, movieClipUser, movieClip->flag, MOVIECLIP_CACHE_SKIP); + } - // always connect the output image - MovieClipOperation *operation = new MovieClipOperation(); - operation->setMovieClip(movieClip); - operation->setMovieClipUser(movieClipUser); - operation->setFramenumber(context.getFramenumber()); - operation->setCacheFrame(cacheFrame); + // always connect the output image + MovieClipOperation *operation = new MovieClipOperation(); + operation->setMovieClip(movieClip); + operation->setMovieClipUser(movieClipUser); + operation->setFramenumber(context.getFramenumber()); + operation->setCacheFrame(cacheFrame); - converter.addOperation(operation); - converter.mapOutputSocket(outputMovieClip, operation->getOutputSocket()); - converter.addPreview(operation->getOutputSocket()); + converter.addOperation(operation); + converter.mapOutputSocket(outputMovieClip, operation->getOutputSocket()); + converter.addPreview(operation->getOutputSocket()); - MovieClipAlphaOperation *alphaOperation = new MovieClipAlphaOperation(); - alphaOperation->setMovieClip(movieClip); - alphaOperation->setMovieClipUser(movieClipUser); - alphaOperation->setFramenumber(context.getFramenumber()); - alphaOperation->setCacheFrame(cacheFrame); + MovieClipAlphaOperation *alphaOperation = new MovieClipAlphaOperation(); + alphaOperation->setMovieClip(movieClip); + alphaOperation->setMovieClipUser(movieClipUser); + alphaOperation->setFramenumber(context.getFramenumber()); + alphaOperation->setCacheFrame(cacheFrame); - converter.addOperation(alphaOperation); - converter.mapOutputSocket(alphaMovieClip, alphaOperation->getOutputSocket()); + converter.addOperation(alphaOperation); + converter.mapOutputSocket(alphaMovieClip, alphaOperation->getOutputSocket()); - MovieTrackingStabilization *stab = &movieClip->tracking.stabilization; - float loc[2], scale, angle; - loc[0] = 0.0f; - loc[1] = 0.0f; - scale = 1.0f; - angle = 0.0f; + MovieTrackingStabilization *stab = &movieClip->tracking.stabilization; + float loc[2], scale, angle; + loc[0] = 0.0f; + loc[1] = 0.0f; + scale = 1.0f; + angle = 0.0f; - if (ibuf) { - if (stab->flag & TRACKING_2D_STABILIZATION) { - int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip, context.getFramenumber()); + if (ibuf) { + if (stab->flag & TRACKING_2D_STABILIZATION) { + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip, + context.getFramenumber()); - BKE_tracking_stabilization_data_get(movieClip, clip_framenr, ibuf->x, ibuf->y, loc, &scale, &angle); - } - } + BKE_tracking_stabilization_data_get( + movieClip, clip_framenr, ibuf->x, ibuf->y, loc, &scale, &angle); + } + } - converter.addOutputValue(offsetXMovieClip, loc[0]); - converter.addOutputValue(offsetYMovieClip, loc[1]); - converter.addOutputValue(scaleMovieClip, scale); - converter.addOutputValue(angleMovieClip, angle); + converter.addOutputValue(offsetXMovieClip, loc[0]); + converter.addOutputValue(offsetYMovieClip, loc[1]); + converter.addOutputValue(scaleMovieClip, scale); + converter.addOutputValue(angleMovieClip, angle); - if (ibuf) { - IMB_freeImBuf(ibuf); - } + if (ibuf) { + IMB_freeImBuf(ibuf); + } } diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.h b/source/blender/compositor/nodes/COM_MovieClipNode.h index 5664d472ce6..2c3f29772d5 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.h +++ b/source/blender/compositor/nodes/COM_MovieClipNode.h @@ -27,9 +27,9 @@ * \ingroup Node */ class MovieClipNode : public Node { -public: - MovieClipNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + MovieClipNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* __COM_MOVIECLIPNODE_H__ */ +#endif /* __COM_MOVIECLIPNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp b/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp index 5786f8cc385..d0ec152fca4 100644 --- a/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp +++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp @@ -24,22 +24,23 @@ MovieDistortionNode::MovieDistortionNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void MovieDistortionNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void MovieDistortionNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *bnode = this->getbNode(); - MovieClip *clip = (MovieClip *)bnode->id; + bNode *bnode = this->getbNode(); + MovieClip *clip = (MovieClip *)bnode->id; - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *inputSocket = this->getInputSocket(0); + NodeOutput *outputSocket = this->getOutputSocket(0); - MovieDistortionOperation *operation = new MovieDistortionOperation(bnode->custom1 == 1); - operation->setMovieClip(clip); - operation->setFramenumber(context.getFramenumber()); - converter.addOperation(operation); + MovieDistortionOperation *operation = new MovieDistortionOperation(bnode->custom1 == 1); + operation->setMovieClip(clip); + operation->setFramenumber(context.getFramenumber()); + converter.addOperation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.h b/source/blender/compositor/nodes/COM_MovieDistortionNode.h index 6cba1a1196c..da687080691 100644 --- a/source/blender/compositor/nodes/COM_MovieDistortionNode.h +++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class MovieDistortionNode : public Node { -public: - MovieDistortionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + MovieDistortionNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_NormalNode.cpp b/source/blender/compositor/nodes/COM_NormalNode.cpp index 281f43dfec9..a6f39312601 100644 --- a/source/blender/compositor/nodes/COM_NormalNode.cpp +++ b/source/blender/compositor/nodes/COM_NormalNode.cpp @@ -24,32 +24,33 @@ NormalNode::NormalNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void NormalNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void NormalNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); - NodeOutput *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); + 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)); + converter.mapOutputSocket(outputSocket, operationSet->getOutputSocket(0)); - DotproductOperation *operation = new DotproductOperation(); - converter.addOperation(operation); + DotproductOperation *operation = new DotproductOperation(); + converter.addOperation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.addLink(operationSet->getOutputSocket(0), operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketDotproduct, operation->getOutputSocket(0)); + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.addLink(operationSet->getOutputSocket(0), operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocketDotproduct, operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_NormalNode.h b/source/blender/compositor/nodes/COM_NormalNode.h index 5569feb8c7e..4151960c506 100644 --- a/source/blender/compositor/nodes/COM_NormalNode.h +++ b/source/blender/compositor/nodes/COM_NormalNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class NormalNode : public Node { -public: - NormalNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + NormalNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* COM_NormalNODE_H */ +#endif /* COM_NormalNODE_H */ diff --git a/source/blender/compositor/nodes/COM_NormalizeNode.cpp b/source/blender/compositor/nodes/COM_NormalizeNode.cpp index 1adfcaddb0e..dc061279664 100644 --- a/source/blender/compositor/nodes/COM_NormalizeNode.cpp +++ b/source/blender/compositor/nodes/COM_NormalizeNode.cpp @@ -22,14 +22,15 @@ NormalizeNode::NormalizeNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void NormalizeNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void NormalizeNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NormalizeOperation *operation = new NormalizeOperation(); - converter.addOperation(operation); + NormalizeOperation *operation = new NormalizeOperation(); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_NormalizeNode.h b/source/blender/compositor/nodes/COM_NormalizeNode.h index fa41753e697..593c98f2ce2 100644 --- a/source/blender/compositor/nodes/COM_NormalizeNode.h +++ b/source/blender/compositor/nodes/COM_NormalizeNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class NormalizeNode : public Node { -public: - NormalizeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + NormalizeNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cpp b/source/blender/compositor/nodes/COM_OutputFileNode.cpp index beed19a0b95..822359771f3 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.cpp +++ b/source/blender/compositor/nodes/COM_OutputFileNode.cpp @@ -27,95 +27,122 @@ OutputFileNode::OutputFileNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void OutputFileNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void OutputFileNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - NodeImageMultiFile *storage = (NodeImageMultiFile *)this->getbNode()->storage; - const bool is_multiview = (context.getRenderData()->scemode & R_MULTIVIEW) != 0; - - if (!context.isRendering()) { - /* only output files when rendering a sequence - - * otherwise, it overwrites the output files just - * scrubbing through the timeline when the compositor updates. - */ - return; - } - - if (storage->format.imtype == R_IMF_IMTYPE_MULTILAYER) { - const bool use_half_float = (storage->format.depth == R_IMF_CHAN_DEPTH_16); - /* single output operation for the multilayer file */ - OutputOpenExrMultiLayerOperation *outputOperation; - - if (is_multiview && storage->format.views_format == R_IMF_VIEWS_MULTIVIEW) { - outputOperation = new OutputOpenExrMultiLayerMultiViewOperation( - context.getRenderData(), context.getbNodeTree(), storage->base_path, - storage->format.exr_codec, use_half_float, context.getViewName()); - } - else { - outputOperation = new OutputOpenExrMultiLayerOperation( - context.getRenderData(), context.getbNodeTree(), storage->base_path, - storage->format.exr_codec, use_half_float, context.getViewName()); - } - converter.addOperation(outputOperation); - - int num_inputs = getNumberOfInputSockets(); - bool previewAdded = false; - for (int i = 0; i < num_inputs; ++i) { - NodeInput *input = getInputSocket(i); - NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage; - - /* note: layer becomes an empty placeholder if the input is not linked */ - outputOperation->add_layer(sockdata->layer, input->getDataType(), input->isLinked()); - - converter.mapInputSocket(input, outputOperation->getInputSocket(i)); - - if (!previewAdded) { - converter.addNodeInputPreview(input); - previewAdded = true; - } - } - } - else { /* single layer format */ - int num_inputs = getNumberOfInputSockets(); - bool previewAdded = false; - for (int i = 0; i < num_inputs; ++i) { - NodeInput *input = getInputSocket(i); - if (input->isLinked()) { - NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage; - ImageFormatData *format = (sockdata->use_node_format ? &storage->format : &sockdata->format); - char path[FILE_MAX]; - - /* combine file path for the input */ - BLI_join_dirfile(path, FILE_MAX, storage->base_path, sockdata->path); - - NodeOperation *outputOperation = NULL; - - if (is_multiview && format->views_format == R_IMF_VIEWS_MULTIVIEW) { - outputOperation = new OutputOpenExrSingleLayerMultiViewOperation( - context.getRenderData(), context.getbNodeTree(), input->getDataType(), format, path, - context.getViewSettings(), context.getDisplaySettings(), context.getViewName()); - } - else if ((!is_multiview) || (format->views_format == R_IMF_VIEWS_INDIVIDUAL)) { - outputOperation = new OutputSingleLayerOperation( - context.getRenderData(), context.getbNodeTree(), input->getDataType(), format, path, - context.getViewSettings(), context.getDisplaySettings(), context.getViewName()); - } - else { /* R_IMF_VIEWS_STEREO_3D */ - outputOperation = new OutputStereoOperation( - context.getRenderData(), context.getbNodeTree(), input->getDataType(), format, path, - sockdata->layer, context.getViewSettings(), context.getDisplaySettings(), context.getViewName()); - } - - converter.addOperation(outputOperation); - converter.mapInputSocket(input, outputOperation->getInputSocket(0)); - - if (!previewAdded) { - converter.addNodeInputPreview(input); - previewAdded = true; - } - } - } - } + NodeImageMultiFile *storage = (NodeImageMultiFile *)this->getbNode()->storage; + const bool is_multiview = (context.getRenderData()->scemode & R_MULTIVIEW) != 0; + + if (!context.isRendering()) { + /* only output files when rendering a sequence - + * otherwise, it overwrites the output files just + * scrubbing through the timeline when the compositor updates. + */ + return; + } + + if (storage->format.imtype == R_IMF_IMTYPE_MULTILAYER) { + const bool use_half_float = (storage->format.depth == R_IMF_CHAN_DEPTH_16); + /* single output operation for the multilayer file */ + OutputOpenExrMultiLayerOperation *outputOperation; + + if (is_multiview && storage->format.views_format == R_IMF_VIEWS_MULTIVIEW) { + outputOperation = new OutputOpenExrMultiLayerMultiViewOperation(context.getRenderData(), + context.getbNodeTree(), + storage->base_path, + storage->format.exr_codec, + use_half_float, + context.getViewName()); + } + else { + outputOperation = new OutputOpenExrMultiLayerOperation(context.getRenderData(), + context.getbNodeTree(), + storage->base_path, + storage->format.exr_codec, + use_half_float, + context.getViewName()); + } + converter.addOperation(outputOperation); + + int num_inputs = getNumberOfInputSockets(); + bool previewAdded = false; + for (int i = 0; i < num_inputs; ++i) { + NodeInput *input = getInputSocket(i); + NodeImageMultiFileSocket *sockdata = + (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage; + + /* note: layer becomes an empty placeholder if the input is not linked */ + outputOperation->add_layer(sockdata->layer, input->getDataType(), input->isLinked()); + + converter.mapInputSocket(input, outputOperation->getInputSocket(i)); + + if (!previewAdded) { + converter.addNodeInputPreview(input); + previewAdded = true; + } + } + } + else { /* single layer format */ + int num_inputs = getNumberOfInputSockets(); + bool previewAdded = false; + for (int i = 0; i < num_inputs; ++i) { + NodeInput *input = getInputSocket(i); + if (input->isLinked()) { + NodeImageMultiFileSocket *sockdata = + (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage; + ImageFormatData *format = (sockdata->use_node_format ? &storage->format : + &sockdata->format); + char path[FILE_MAX]; + + /* combine file path for the input */ + BLI_join_dirfile(path, FILE_MAX, storage->base_path, sockdata->path); + + NodeOperation *outputOperation = NULL; + + if (is_multiview && format->views_format == R_IMF_VIEWS_MULTIVIEW) { + outputOperation = new OutputOpenExrSingleLayerMultiViewOperation( + context.getRenderData(), + context.getbNodeTree(), + input->getDataType(), + format, + path, + context.getViewSettings(), + context.getDisplaySettings(), + context.getViewName()); + } + else if ((!is_multiview) || (format->views_format == R_IMF_VIEWS_INDIVIDUAL)) { + outputOperation = new OutputSingleLayerOperation(context.getRenderData(), + context.getbNodeTree(), + input->getDataType(), + format, + path, + context.getViewSettings(), + context.getDisplaySettings(), + context.getViewName()); + } + else { /* R_IMF_VIEWS_STEREO_3D */ + outputOperation = new OutputStereoOperation(context.getRenderData(), + context.getbNodeTree(), + input->getDataType(), + format, + path, + sockdata->layer, + context.getViewSettings(), + context.getDisplaySettings(), + context.getViewName()); + } + + converter.addOperation(outputOperation); + converter.mapInputSocket(input, outputOperation->getInputSocket(0)); + + if (!previewAdded) { + converter.addNodeInputPreview(input); + previewAdded = true; + } + } + } + } } diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.h b/source/blender/compositor/nodes/COM_OutputFileNode.h index 366528742b8..932fa375a3a 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.h +++ b/source/blender/compositor/nodes/COM_OutputFileNode.h @@ -27,9 +27,9 @@ * \ingroup Node */ class OutputFileNode : public Node { -public: - OutputFileNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + OutputFileNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_PixelateNode.cpp b/source/blender/compositor/nodes/COM_PixelateNode.cpp index 0db623866e8..be7747f3f14 100644 --- a/source/blender/compositor/nodes/COM_PixelateNode.cpp +++ b/source/blender/compositor/nodes/COM_PixelateNode.cpp @@ -23,23 +23,24 @@ PixelateNode::PixelateNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void PixelateNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void PixelateNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); - DataType datatype = inputSocket->getDataType(); + NodeInput *inputSocket = this->getInputSocket(0); + NodeOutput *outputSocket = this->getOutputSocket(0); + DataType datatype = inputSocket->getDataType(); - if (inputSocket->isLinked()) { - NodeOutput *link = inputSocket->getLink(); - datatype = link->getDataType(); - } + if (inputSocket->isLinked()) { + NodeOutput *link = inputSocket->getLink(); + datatype = link->getDataType(); + } - PixelateOperation *operation = new PixelateOperation(datatype); - converter.addOperation(operation); + PixelateOperation *operation = new PixelateOperation(datatype); + converter.addOperation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_PixelateNode.h b/source/blender/compositor/nodes/COM_PixelateNode.h index 5738988672a..f46035398e2 100644 --- a/source/blender/compositor/nodes/COM_PixelateNode.h +++ b/source/blender/compositor/nodes/COM_PixelateNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class PixelateNode : public Node { -public: - PixelateNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + PixelateNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp index 75bdf851f83..2285af01154 100644 --- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp +++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp @@ -22,52 +22,53 @@ #include "COM_PlaneTrackOperation.h" extern "C" { -# include "BKE_node.h" -# include "BKE_movieclip.h" -# include "BKE_tracking.h" +#include "BKE_node.h" +#include "BKE_movieclip.h" +#include "BKE_tracking.h" } PlaneTrackDeformNode::PlaneTrackDeformNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void PlaneTrackDeformNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void PlaneTrackDeformNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - MovieClip *clip = (MovieClip *) editorNode->id; - NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *) editorNode->storage; + bNode *editorNode = this->getbNode(); + MovieClip *clip = (MovieClip *)editorNode->id; + NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *)editorNode->storage; - int frame_number = context.getFramenumber(); + int frame_number = context.getFramenumber(); - NodeInput *input_image = this->getInputSocket(0); - NodeOutput *output_warped_image = this->getOutputSocket(0); - NodeOutput *output_plane = this->getOutputSocket(1); + NodeInput *input_image = this->getInputSocket(0); + NodeOutput *output_warped_image = this->getOutputSocket(0); + NodeOutput *output_plane = this->getOutputSocket(1); - PlaneTrackWarpImageOperation *warp_image_operation = new PlaneTrackWarpImageOperation(); - warp_image_operation->setMovieClip(clip); - warp_image_operation->setTrackingObject(data->tracking_object); - warp_image_operation->setPlaneTrackName(data->plane_track_name); - warp_image_operation->setFramenumber(frame_number); - if (data->flag & CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR) { - warp_image_operation->setMotionBlurSamples(data->motion_blur_samples); - warp_image_operation->setMotionBlurShutter(data->motion_blur_shutter); - } - converter.addOperation(warp_image_operation); + PlaneTrackWarpImageOperation *warp_image_operation = new PlaneTrackWarpImageOperation(); + warp_image_operation->setMovieClip(clip); + warp_image_operation->setTrackingObject(data->tracking_object); + warp_image_operation->setPlaneTrackName(data->plane_track_name); + warp_image_operation->setFramenumber(frame_number); + if (data->flag & CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR) { + warp_image_operation->setMotionBlurSamples(data->motion_blur_samples); + warp_image_operation->setMotionBlurShutter(data->motion_blur_shutter); + } + converter.addOperation(warp_image_operation); - converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0)); - converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket()); + converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0)); + converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket()); - PlaneTrackMaskOperation *plane_mask_operation = new PlaneTrackMaskOperation(); - plane_mask_operation->setMovieClip(clip); - plane_mask_operation->setTrackingObject(data->tracking_object); - plane_mask_operation->setPlaneTrackName(data->plane_track_name); - plane_mask_operation->setFramenumber(frame_number); - if (data->flag & CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR) { - plane_mask_operation->setMotionBlurSamples(data->motion_blur_samples); - plane_mask_operation->setMotionBlurShutter(data->motion_blur_shutter); - } - converter.addOperation(plane_mask_operation); + PlaneTrackMaskOperation *plane_mask_operation = new PlaneTrackMaskOperation(); + plane_mask_operation->setMovieClip(clip); + plane_mask_operation->setTrackingObject(data->tracking_object); + plane_mask_operation->setPlaneTrackName(data->plane_track_name); + plane_mask_operation->setFramenumber(frame_number); + if (data->flag & CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR) { + plane_mask_operation->setMotionBlurSamples(data->motion_blur_samples); + plane_mask_operation->setMotionBlurShutter(data->motion_blur_shutter); + } + converter.addOperation(plane_mask_operation); - converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket()); + converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h index b11daaf0abf..0d57163dc97 100644 --- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h +++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h @@ -19,8 +19,8 @@ #include "COM_Node.h" extern "C" { -# include "DNA_movieclip_types.h" -# include "DNA_node_types.h" +#include "DNA_movieclip_types.h" +#include "DNA_node_types.h" } /** @@ -28,7 +28,7 @@ extern "C" { * \ingroup Node */ class PlaneTrackDeformNode : public Node { -public: - PlaneTrackDeformNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + PlaneTrackDeformNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp index e1897e09128..26f21713a77 100644 --- a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp +++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp @@ -27,7 +27,7 @@ RenderLayersNode::RenderLayersNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } void RenderLayersNode::testSocketLink(NodeConverter &converter, @@ -38,152 +38,138 @@ void RenderLayersNode::testSocketLink(NodeConverter &converter, int layerId, bool is_preview) const { - operation->setScene(scene); - operation->setLayerId(layerId); - operation->setRenderData(context.getRenderData()); - operation->setViewName(context.getViewName()); + operation->setScene(scene); + operation->setLayerId(layerId); + operation->setRenderData(context.getRenderData()); + operation->setViewName(context.getViewName()); - converter.mapOutputSocket(output, operation->getOutputSocket()); - converter.addOperation(operation); + converter.mapOutputSocket(output, operation->getOutputSocket()); + converter.addOperation(operation); - if (is_preview) /* only for image socket */ - converter.addPreview(operation->getOutputSocket()); + if (is_preview) /* only for image socket */ + converter.addPreview(operation->getOutputSocket()); } void RenderLayersNode::testRenderLink(NodeConverter &converter, const CompositorContext &context, Render *re) const { - Scene *scene = (Scene *)this->getbNode()->id; - const short layerId = this->getbNode()->custom1; - RenderResult *rr = RE_AcquireResultRead(re); - if (rr == NULL) { - missingRenderLink(converter); - return; - } - ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, layerId); - if (view_layer == NULL) { - missingRenderLink(converter); - return; - } - RenderLayer *rl = RE_GetRenderLayer(rr, view_layer->name); - if (rl == NULL) { - missingRenderLink(converter); - return; - } - const int num_outputs = this->getNumberOfOutputSockets(); - for (int i = 0; i < num_outputs; i++) { - NodeOutput *output = this->getOutputSocket(i); - NodeImageLayer *storage = (NodeImageLayer *)output->getbNodeSocket()->storage; - RenderPass *rpass = (RenderPass *)BLI_findstring( - &rl->passes, - storage->pass_name, - offsetof(RenderPass, name)); - if (rpass == NULL) { - missingSocketLink(converter, output); - continue; - } - RenderLayersProg *operation; - bool is_preview; - if (STREQ(rpass->name, RE_PASSNAME_COMBINED) && - STREQ(output->getbNodeSocket()->name, "Alpha")) - { - operation = new RenderLayersAlphaProg(rpass->name, - COM_DT_VALUE, - rpass->channels); - is_preview = false; - } - else if (STREQ(rpass->name, RE_PASSNAME_Z)) { - operation = new RenderLayersDepthProg(rpass->name, - COM_DT_VALUE, - rpass->channels); - is_preview = false; - } - else { - DataType type; - switch (rpass->channels) { - case 4: type = COM_DT_COLOR; break; - case 3: type = COM_DT_VECTOR; break; - case 1: type = COM_DT_VALUE; break; - default: - BLI_assert(!"Unexpected number of channels for pass"); - type = COM_DT_VALUE; - break; - } - operation = new RenderLayersProg(rpass->name, - type, - rpass->channels); - is_preview = STREQ(output->getbNodeSocket()->name, "Image"); - } - testSocketLink(converter, - context, - output, - operation, - scene, - layerId, - is_preview); - } + Scene *scene = (Scene *)this->getbNode()->id; + const short layerId = this->getbNode()->custom1; + RenderResult *rr = RE_AcquireResultRead(re); + if (rr == NULL) { + missingRenderLink(converter); + return; + } + ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, layerId); + if (view_layer == NULL) { + missingRenderLink(converter); + return; + } + RenderLayer *rl = RE_GetRenderLayer(rr, view_layer->name); + if (rl == NULL) { + missingRenderLink(converter); + return; + } + const int num_outputs = this->getNumberOfOutputSockets(); + for (int i = 0; i < num_outputs; i++) { + NodeOutput *output = this->getOutputSocket(i); + NodeImageLayer *storage = (NodeImageLayer *)output->getbNodeSocket()->storage; + RenderPass *rpass = (RenderPass *)BLI_findstring( + &rl->passes, storage->pass_name, offsetof(RenderPass, name)); + if (rpass == NULL) { + missingSocketLink(converter, output); + continue; + } + RenderLayersProg *operation; + bool is_preview; + if (STREQ(rpass->name, RE_PASSNAME_COMBINED) && + STREQ(output->getbNodeSocket()->name, "Alpha")) { + operation = new RenderLayersAlphaProg(rpass->name, COM_DT_VALUE, rpass->channels); + is_preview = false; + } + else if (STREQ(rpass->name, RE_PASSNAME_Z)) { + operation = new RenderLayersDepthProg(rpass->name, COM_DT_VALUE, rpass->channels); + is_preview = false; + } + else { + DataType type; + switch (rpass->channels) { + case 4: + type = COM_DT_COLOR; + break; + case 3: + type = COM_DT_VECTOR; + break; + case 1: + type = COM_DT_VALUE; + break; + default: + BLI_assert(!"Unexpected number of channels for pass"); + type = COM_DT_VALUE; + break; + } + operation = new RenderLayersProg(rpass->name, type, rpass->channels); + is_preview = STREQ(output->getbNodeSocket()->name, "Image"); + } + testSocketLink(converter, context, output, operation, scene, layerId, is_preview); + } } -void RenderLayersNode::missingSocketLink(NodeConverter &converter, - NodeOutput *output) const +void RenderLayersNode::missingSocketLink(NodeConverter &converter, NodeOutput *output) const { - NodeOperation *operation; - switch (output->getDataType()) { - case COM_DT_COLOR: - { - const float color[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - SetColorOperation *color_operation = new SetColorOperation(); - color_operation->setChannels(color); - operation = color_operation; - break; - } - case COM_DT_VECTOR: - { - const float vector[3] = {0.0f, 0.0f, 0.0f}; - SetVectorOperation *vector_operation = new SetVectorOperation(); - vector_operation->setVector(vector); - operation = vector_operation; - break; - } - case COM_DT_VALUE: - { - SetValueOperation *value_operation = new SetValueOperation(); - value_operation->setValue(0.0f); - operation = value_operation; - break; - } - default: - { - BLI_assert("!Unexpected data type"); - return; - } - } + NodeOperation *operation; + switch (output->getDataType()) { + case COM_DT_COLOR: { + const float color[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + SetColorOperation *color_operation = new SetColorOperation(); + color_operation->setChannels(color); + operation = color_operation; + break; + } + case COM_DT_VECTOR: { + const float vector[3] = {0.0f, 0.0f, 0.0f}; + SetVectorOperation *vector_operation = new SetVectorOperation(); + vector_operation->setVector(vector); + operation = vector_operation; + break; + } + case COM_DT_VALUE: { + SetValueOperation *value_operation = new SetValueOperation(); + value_operation->setValue(0.0f); + operation = value_operation; + break; + } + default: { + BLI_assert("!Unexpected data type"); + return; + } + } - converter.mapOutputSocket(output, operation->getOutputSocket()); - converter.addOperation(operation); + converter.mapOutputSocket(output, operation->getOutputSocket()); + converter.addOperation(operation); } void RenderLayersNode::missingRenderLink(NodeConverter &converter) const { - const int num_outputs = this->getNumberOfOutputSockets(); - for (int i = 0; i < num_outputs; i++) { - NodeOutput *output = this->getOutputSocket(i); - missingSocketLink(converter, output); - } + const int num_outputs = this->getNumberOfOutputSockets(); + for (int i = 0; i < num_outputs; i++) { + NodeOutput *output = this->getOutputSocket(i); + missingSocketLink(converter, output); + } } void RenderLayersNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { - Scene *scene = (Scene *)this->getbNode()->id; - Render *re = (scene) ? RE_GetSceneRender(scene) : NULL; + Scene *scene = (Scene *)this->getbNode()->id; + Render *re = (scene) ? RE_GetSceneRender(scene) : NULL; - if (re != NULL) { - testRenderLink(converter, context, re); - RE_ReleaseResult(re); - } - else { - missingRenderLink(converter); - } + if (re != NULL) { + testRenderLink(converter, context, re); + RE_ReleaseResult(re); + } + else { + missingRenderLink(converter); + } } diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.h b/source/blender/compositor/nodes/COM_RenderLayersNode.h index 50acb7aad42..7e574678f2b 100644 --- a/source/blender/compositor/nodes/COM_RenderLayersNode.h +++ b/source/blender/compositor/nodes/COM_RenderLayersNode.h @@ -27,23 +27,22 @@ struct Render; * \ingroup Node */ class RenderLayersNode : public Node { -public: - RenderLayersNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const; -private: - void testSocketLink(NodeConverter &converter, - const CompositorContext &context, - NodeOutput *output, - RenderLayersProg *operation, - Scene *scene, - int layerId, - bool is_preview) const; - void testRenderLink(NodeConverter &converter, - const CompositorContext &context, - Render *re) const; + public: + RenderLayersNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; - void missingSocketLink(NodeConverter &converter, - NodeOutput *output) const; - void missingRenderLink(NodeConverter &converter) const; + private: + void testSocketLink(NodeConverter &converter, + const CompositorContext &context, + NodeOutput *output, + RenderLayersProg *operation, + Scene *scene, + int layerId, + bool is_preview) const; + void testRenderLink(NodeConverter &converter, + const CompositorContext &context, + Render *re) const; + + void missingSocketLink(NodeConverter &converter, NodeOutput *output) const; + void missingRenderLink(NodeConverter &converter) const; }; diff --git a/source/blender/compositor/nodes/COM_RotateNode.cpp b/source/blender/compositor/nodes/COM_RotateNode.cpp index d097d7b721f..e1c84ce3584 100644 --- a/source/blender/compositor/nodes/COM_RotateNode.cpp +++ b/source/blender/compositor/nodes/COM_RotateNode.cpp @@ -24,23 +24,24 @@ RotateNode::RotateNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void RotateNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void RotateNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputDegreeSocket = this->getInputSocket(1); - NodeOutput *outputSocket = this->getOutputSocket(0); - RotateOperation *operation = new RotateOperation(); - SetSamplerOperation *sampler = new SetSamplerOperation(); - sampler->setSampler((PixelSampler)this->getbNode()->custom1); + NodeInput *inputSocket = this->getInputSocket(0); + NodeInput *inputDegreeSocket = this->getInputSocket(1); + NodeOutput *outputSocket = this->getOutputSocket(0); + RotateOperation *operation = new RotateOperation(); + SetSamplerOperation *sampler = new SetSamplerOperation(); + sampler->setSampler((PixelSampler)this->getbNode()->custom1); - converter.addOperation(sampler); - converter.addOperation(operation); + converter.addOperation(sampler); + converter.addOperation(operation); - converter.addLink(sampler->getOutputSocket(), operation->getInputSocket(0)); - converter.mapInputSocket(inputSocket, sampler->getInputSocket(0)); - converter.mapInputSocket(inputDegreeSocket, operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.addLink(sampler->getOutputSocket(), operation->getInputSocket(0)); + converter.mapInputSocket(inputSocket, sampler->getInputSocket(0)); + converter.mapInputSocket(inputDegreeSocket, operation->getInputSocket(1)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_RotateNode.h b/source/blender/compositor/nodes/COM_RotateNode.h index 2190ddd0b01..e7440bb7a8e 100644 --- a/source/blender/compositor/nodes/COM_RotateNode.h +++ b/source/blender/compositor/nodes/COM_RotateNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class RotateNode : public Node { -public: - RotateNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + RotateNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp index 61017f1a8e8..e47f673a8be 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.cpp +++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp @@ -26,88 +26,81 @@ ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ScaleNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void ScaleNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *bnode = this->getbNode(); - - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputXSocket = this->getInputSocket(1); - NodeInput *inputYSocket = this->getInputSocket(2); - NodeOutput *outputSocket = this->getOutputSocket(0); - - switch (bnode->custom1) { - case CMP_SCALE_RELATIVE: - { - ScaleOperation *operation = new ScaleOperation(); - converter.addOperation(operation); - - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); - converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - - operation->setVariableSize(inputXSocket->isLinked() || - inputYSocket->isLinked()); - break; - } - case CMP_SCALE_SCENEPERCENT: - { - SetValueOperation *scaleFactorOperation = new SetValueOperation(); - scaleFactorOperation->setValue(context.getRenderData()->size / 100.0f); - converter.addOperation(scaleFactorOperation); - - ScaleOperation *operation = new ScaleOperation(); - converter.addOperation(operation); - - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1)); - converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - - operation->setVariableSize(inputXSocket->isLinked() || - inputYSocket->isLinked()); - - break; - } - case CMP_SCALE_RENDERPERCENT: - { - const RenderData *rd = context.getRenderData(); - ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation(); - /* framing options */ - operation->setIsAspect((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_ASPECT) != 0); - operation->setIsCrop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0); - operation->setOffset(bnode->custom3, bnode->custom4); - operation->setNewWidth(rd->xsch * rd->size / 100.0f); - operation->setNewHeight(rd->ysch * rd->size / 100.0f); - operation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); - converter.addOperation(operation); - - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - - operation->setVariableSize(inputXSocket->isLinked() || - inputYSocket->isLinked()); - - break; - } - case CMP_SCALE_ABSOLUTE: - { - /* TODO: what is the use of this one.... perhaps some issues when the ui was updated... */ - ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); - converter.addOperation(operation); - - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); - converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - - operation->setVariableSize(inputXSocket->isLinked() || - inputYSocket->isLinked()); - - break; - } - } + bNode *bnode = this->getbNode(); + + NodeInput *inputSocket = this->getInputSocket(0); + NodeInput *inputXSocket = this->getInputSocket(1); + NodeInput *inputYSocket = this->getInputSocket(2); + NodeOutput *outputSocket = this->getOutputSocket(0); + + switch (bnode->custom1) { + case CMP_SCALE_RELATIVE: { + ScaleOperation *operation = new ScaleOperation(); + converter.addOperation(operation); + + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); + converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + + operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + break; + } + case CMP_SCALE_SCENEPERCENT: { + SetValueOperation *scaleFactorOperation = new SetValueOperation(); + scaleFactorOperation->setValue(context.getRenderData()->size / 100.0f); + converter.addOperation(scaleFactorOperation); + + ScaleOperation *operation = new ScaleOperation(); + converter.addOperation(operation); + + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1)); + converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + + operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + + break; + } + case CMP_SCALE_RENDERPERCENT: { + const RenderData *rd = context.getRenderData(); + ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation(); + /* framing options */ + operation->setIsAspect((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_ASPECT) != 0); + operation->setIsCrop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0); + operation->setOffset(bnode->custom3, bnode->custom4); + operation->setNewWidth(rd->xsch * rd->size / 100.0f); + operation->setNewHeight(rd->ysch * rd->size / 100.0f); + operation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + converter.addOperation(operation); + + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + + operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + + break; + } + case CMP_SCALE_ABSOLUTE: { + /* TODO: what is the use of this one.... perhaps some issues when the ui was updated... */ + ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); + converter.addOperation(operation); + + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); + converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + + operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + + break; + } + } } diff --git a/source/blender/compositor/nodes/COM_ScaleNode.h b/source/blender/compositor/nodes/COM_ScaleNode.h index a58b81ed765..b6e589cfcec 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.h +++ b/source/blender/compositor/nodes/COM_ScaleNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ScaleNode : public Node { -public: - ScaleNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ScaleNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.cpp b/source/blender/compositor/nodes/COM_SeparateColorNode.cpp index 955994ec404..499b2fa96f9 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.cpp +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.cpp @@ -20,96 +20,94 @@ #include "COM_ConvertOperation.h" - -SeparateColorNode::SeparateColorNode(bNode *editorNode) : - Node(editorNode) +SeparateColorNode::SeparateColorNode(bNode *editorNode) : Node(editorNode) { } -void SeparateColorNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void SeparateColorNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - NodeInput *imageSocket = this->getInputSocket(0); - NodeOutput *outputRSocket = this->getOutputSocket(0); - NodeOutput *outputGSocket = this->getOutputSocket(1); - NodeOutput *outputBSocket = this->getOutputSocket(2); - NodeOutput *outputASocket = this->getOutputSocket(3); - - NodeOperation *color_conv = getColorConverter(context); - if (color_conv) { - converter.addOperation(color_conv); - - converter.mapInputSocket(imageSocket, color_conv->getInputSocket(0)); - } - - { - SeparateChannelOperation *operation = new SeparateChannelOperation(); - operation->setChannel(0); - converter.addOperation(operation); - - if (color_conv) - converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); - else - converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputRSocket, operation->getOutputSocket(0)); - } - - { - SeparateChannelOperation *operation = new SeparateChannelOperation(); - operation->setChannel(1); - converter.addOperation(operation); - - if (color_conv) - converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); - else - converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputGSocket, operation->getOutputSocket(0)); - } - - { - SeparateChannelOperation *operation = new SeparateChannelOperation(); - operation->setChannel(2); - converter.addOperation(operation); - - if (color_conv) - converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); - else - converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputBSocket, operation->getOutputSocket(0)); - } - - { - SeparateChannelOperation *operation = new SeparateChannelOperation(); - operation->setChannel(3); - converter.addOperation(operation); - - if (color_conv) - converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); - else - converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputASocket, operation->getOutputSocket(0)); - } + NodeInput *imageSocket = this->getInputSocket(0); + NodeOutput *outputRSocket = this->getOutputSocket(0); + NodeOutput *outputGSocket = this->getOutputSocket(1); + NodeOutput *outputBSocket = this->getOutputSocket(2); + NodeOutput *outputASocket = this->getOutputSocket(3); + + NodeOperation *color_conv = getColorConverter(context); + if (color_conv) { + converter.addOperation(color_conv); + + converter.mapInputSocket(imageSocket, color_conv->getInputSocket(0)); + } + + { + SeparateChannelOperation *operation = new SeparateChannelOperation(); + operation->setChannel(0); + converter.addOperation(operation); + + if (color_conv) + converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); + else + converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputRSocket, operation->getOutputSocket(0)); + } + + { + SeparateChannelOperation *operation = new SeparateChannelOperation(); + operation->setChannel(1); + converter.addOperation(operation); + + if (color_conv) + converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); + else + converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputGSocket, operation->getOutputSocket(0)); + } + + { + SeparateChannelOperation *operation = new SeparateChannelOperation(); + operation->setChannel(2); + converter.addOperation(operation); + + if (color_conv) + converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); + else + converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputBSocket, operation->getOutputSocket(0)); + } + + { + SeparateChannelOperation *operation = new SeparateChannelOperation(); + operation->setChannel(3); + converter.addOperation(operation); + + if (color_conv) + converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); + else + converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputASocket, operation->getOutputSocket(0)); + } } - -NodeOperation *SeparateRGBANode::getColorConverter(const CompositorContext &/*context*/) const +NodeOperation *SeparateRGBANode::getColorConverter(const CompositorContext & /*context*/) const { - return NULL; /* no conversion needed */ + return NULL; /* no conversion needed */ } -NodeOperation *SeparateHSVANode::getColorConverter(const CompositorContext &/*context*/) const +NodeOperation *SeparateHSVANode::getColorConverter(const CompositorContext & /*context*/) const { - return new ConvertRGBToHSVOperation(); + return new ConvertRGBToHSVOperation(); } -NodeOperation *SeparateYCCANode::getColorConverter(const CompositorContext &/*context*/) const +NodeOperation *SeparateYCCANode::getColorConverter(const CompositorContext & /*context*/) const { - ConvertRGBToYCCOperation *operation = new ConvertRGBToYCCOperation(); - bNode *editorNode = this->getbNode(); - operation->setMode(editorNode->custom1); - return operation; + ConvertRGBToYCCOperation *operation = new ConvertRGBToYCCOperation(); + bNode *editorNode = this->getbNode(); + operation->setMode(editorNode->custom1); + return operation; } -NodeOperation *SeparateYUVANode::getColorConverter(const CompositorContext &/*context*/) const +NodeOperation *SeparateYUVANode::getColorConverter(const CompositorContext & /*context*/) const { - return new ConvertRGBToYUVOperation(); + return new ConvertRGBToYUVOperation(); } diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.h b/source/blender/compositor/nodes/COM_SeparateColorNode.h index 1238b02dfbb..f98a9d6d12f 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.h +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.h @@ -22,48 +22,48 @@ #include "COM_Node.h" class SeparateColorNode : public Node { -public: - SeparateColorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + SeparateColorNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; -protected: - virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0; + protected: + virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0; }; class SeparateRGBANode : public SeparateColorNode { -public: - SeparateRGBANode(bNode *editorNode) : - SeparateColorNode(editorNode) - {} + public: + SeparateRGBANode(bNode *editorNode) : SeparateColorNode(editorNode) + { + } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const; }; class SeparateHSVANode : public SeparateColorNode { -public: - SeparateHSVANode(bNode *editorNode) : - SeparateColorNode(editorNode) - {} + public: + SeparateHSVANode(bNode *editorNode) : SeparateColorNode(editorNode) + { + } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const; }; class SeparateYCCANode : public SeparateColorNode { -public: - SeparateYCCANode(bNode *editorNode) : - SeparateColorNode(editorNode) - {} + public: + SeparateYCCANode(bNode *editorNode) : SeparateColorNode(editorNode) + { + } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const; }; class SeparateYUVANode : public SeparateColorNode { -public: - SeparateYUVANode(bNode *editorNode) : - SeparateColorNode(editorNode) - {} + public: + SeparateYUVANode(bNode *editorNode) : SeparateColorNode(editorNode) + { + } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp index 024970f296b..53454fedfe4 100644 --- a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp +++ b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp @@ -20,17 +20,18 @@ #include "COM_SetAlphaOperation.h" #include "COM_ExecutionSystem.h" -void SetAlphaNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void SetAlphaNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - SetAlphaOperation *operation = new SetAlphaOperation(); + SetAlphaOperation *operation = new SetAlphaOperation(); - if (!this->getInputSocket(0)->isLinked() && this->getInputSocket(1)->isLinked()) { - operation->setResolutionInputSocketIndex(1); - } + if (!this->getInputSocket(0)->isLinked() && this->getInputSocket(1)->isLinked()) { + operation->setResolutionInputSocketIndex(1); + } - converter.addOperation(operation); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.h b/source/blender/compositor/nodes/COM_SetAlphaNode.h index 03d955cc8d3..9882b3e62e9 100644 --- a/source/blender/compositor/nodes/COM_SetAlphaNode.h +++ b/source/blender/compositor/nodes/COM_SetAlphaNode.h @@ -26,9 +26,11 @@ * \ingroup Node */ class SetAlphaNode : public Node { -public: - SetAlphaNode(bNode *editorNode) : Node(editorNode) {} - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + SetAlphaNode(bNode *editorNode) : Node(editorNode) + { + } + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp index 0b6e8b2f3f4..d924d2ce9f8 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp @@ -25,57 +25,71 @@ #include "COM_WriteBufferOperation.h" #include "COM_ReadBufferOperation.h" -SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool use_conversion) : - Node(editorNode, false), - m_use_conversion(use_conversion) +SocketProxyNode::SocketProxyNode(bNode *editorNode, + bNodeSocket *editorInput, + bNodeSocket *editorOutput, + bool use_conversion) + : Node(editorNode, false), m_use_conversion(use_conversion) { - DataType dt; + DataType dt; - dt = COM_DT_VALUE; - if (editorInput->type == SOCK_RGBA) dt = COM_DT_COLOR; - if (editorInput->type == SOCK_VECTOR) dt = COM_DT_VECTOR; - this->addInputSocket(dt, editorInput); + dt = COM_DT_VALUE; + if (editorInput->type == SOCK_RGBA) + dt = COM_DT_COLOR; + if (editorInput->type == SOCK_VECTOR) + dt = COM_DT_VECTOR; + this->addInputSocket(dt, editorInput); - dt = COM_DT_VALUE; - if (editorOutput->type == SOCK_RGBA) dt = COM_DT_COLOR; - if (editorOutput->type == SOCK_VECTOR) dt = COM_DT_VECTOR; - this->addOutputSocket(dt, editorOutput); + dt = COM_DT_VALUE; + if (editorOutput->type == SOCK_RGBA) + dt = COM_DT_COLOR; + if (editorOutput->type == SOCK_VECTOR) + dt = COM_DT_VECTOR; + this->addOutputSocket(dt, editorOutput); } -void SocketProxyNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void SocketProxyNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeOperationOutput *proxy_output = converter.addInputProxy(getInputSocket(0), m_use_conversion); - converter.mapOutputSocket(getOutputSocket(), proxy_output); + NodeOperationOutput *proxy_output = converter.addInputProxy(getInputSocket(0), m_use_conversion); + converter.mapOutputSocket(getOutputSocket(), proxy_output); } - -SocketBufferNode::SocketBufferNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput) : Node(editorNode, false) +SocketBufferNode::SocketBufferNode(bNode *editorNode, + bNodeSocket *editorInput, + bNodeSocket *editorOutput) + : Node(editorNode, false) { - DataType dt; + DataType dt; - dt = COM_DT_VALUE; - if (editorInput->type == SOCK_RGBA) dt = COM_DT_COLOR; - if (editorInput->type == SOCK_VECTOR) dt = COM_DT_VECTOR; - this->addInputSocket(dt, editorInput); + dt = COM_DT_VALUE; + if (editorInput->type == SOCK_RGBA) + dt = COM_DT_COLOR; + if (editorInput->type == SOCK_VECTOR) + dt = COM_DT_VECTOR; + this->addInputSocket(dt, editorInput); - dt = COM_DT_VALUE; - if (editorOutput->type == SOCK_RGBA) dt = COM_DT_COLOR; - if (editorOutput->type == SOCK_VECTOR) dt = COM_DT_VECTOR; - this->addOutputSocket(dt, editorOutput); + dt = COM_DT_VALUE; + if (editorOutput->type == SOCK_RGBA) + dt = COM_DT_COLOR; + if (editorOutput->type == SOCK_VECTOR) + dt = COM_DT_VECTOR; + this->addOutputSocket(dt, editorOutput); } -void SocketBufferNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void SocketBufferNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeOutput *output = this->getOutputSocket(0); - NodeInput *input = this->getInputSocket(0); + NodeOutput *output = this->getOutputSocket(0); + NodeInput *input = this->getInputSocket(0); - DataType datatype = output->getDataType(); - WriteBufferOperation *writeOperation = new WriteBufferOperation(datatype); - ReadBufferOperation *readOperation = new ReadBufferOperation(datatype); - readOperation->setMemoryProxy(writeOperation->getMemoryProxy()); - converter.addOperation(writeOperation); - converter.addOperation(readOperation); + DataType datatype = output->getDataType(); + WriteBufferOperation *writeOperation = new WriteBufferOperation(datatype); + ReadBufferOperation *readOperation = new ReadBufferOperation(datatype); + readOperation->setMemoryProxy(writeOperation->getMemoryProxy()); + converter.addOperation(writeOperation); + converter.addOperation(readOperation); - converter.mapInputSocket(input, writeOperation->getInputSocket(0)); - converter.mapOutputSocket(output, readOperation->getOutputSocket()); + converter.mapInputSocket(input, writeOperation->getInputSocket(0)); + converter.mapOutputSocket(output, readOperation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.h b/source/blender/compositor/nodes/COM_SocketProxyNode.h index 6e288e59797..21e888d323e 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.h +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h @@ -26,23 +26,31 @@ * \ingroup Node */ class SocketProxyNode : public Node { -public: - SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool use_conversion); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; - - bool getUseConversion() const { return m_use_conversion; } - void setUseConversion(bool use_conversion) { m_use_conversion = use_conversion; } - -private: - /** If true, the proxy will convert input and output data to/from the proxy socket types. */ - bool m_use_conversion; + public: + SocketProxyNode(bNode *editorNode, + bNodeSocket *editorInput, + bNodeSocket *editorOutput, + bool use_conversion); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + + bool getUseConversion() const + { + return m_use_conversion; + } + void setUseConversion(bool use_conversion) + { + m_use_conversion = use_conversion; + } + + private: + /** If true, the proxy will convert input and output data to/from the proxy socket types. */ + bool m_use_conversion; }; - class SocketBufferNode : public Node { -public: - SocketBufferNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + SocketBufferNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp index a736000ead7..b44f82f71d0 100644 --- a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp +++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp @@ -27,46 +27,48 @@ SplitViewerNode::SplitViewerNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void SplitViewerNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void SplitViewerNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - bool do_output = (editorNode->flag & NODE_DO_OUTPUT_RECALC || context.isRendering()) && (editorNode->flag & NODE_DO_OUTPUT); + bNode *editorNode = this->getbNode(); + bool do_output = (editorNode->flag & NODE_DO_OUTPUT_RECALC || context.isRendering()) && + (editorNode->flag & NODE_DO_OUTPUT); - NodeInput *image1Socket = this->getInputSocket(0); - NodeInput *image2Socket = this->getInputSocket(1); - Image *image = (Image *)this->getbNode()->id; - ImageUser *imageUser = (ImageUser *) this->getbNode()->storage; + NodeInput *image1Socket = this->getInputSocket(0); + NodeInput *image2Socket = this->getInputSocket(1); + Image *image = (Image *)this->getbNode()->id; + ImageUser *imageUser = (ImageUser *)this->getbNode()->storage; - SplitOperation *splitViewerOperation = new SplitOperation(); - splitViewerOperation->setSplitPercentage(this->getbNode()->custom1); - splitViewerOperation->setXSplit(!this->getbNode()->custom2); + SplitOperation *splitViewerOperation = new SplitOperation(); + splitViewerOperation->setSplitPercentage(this->getbNode()->custom1); + splitViewerOperation->setXSplit(!this->getbNode()->custom2); - converter.addOperation(splitViewerOperation); - converter.mapInputSocket(image1Socket, splitViewerOperation->getInputSocket(0)); - converter.mapInputSocket(image2Socket, splitViewerOperation->getInputSocket(1)); + converter.addOperation(splitViewerOperation); + converter.mapInputSocket(image1Socket, splitViewerOperation->getInputSocket(0)); + converter.mapInputSocket(image2Socket, splitViewerOperation->getInputSocket(1)); - ViewerOperation *viewerOperation = new ViewerOperation(); - viewerOperation->setImage(image); - viewerOperation->setImageUser(imageUser); - viewerOperation->setViewSettings(context.getViewSettings()); - viewerOperation->setDisplaySettings(context.getDisplaySettings()); - viewerOperation->setRenderData(context.getRenderData()); - viewerOperation->setViewName(context.getViewName()); + ViewerOperation *viewerOperation = new ViewerOperation(); + viewerOperation->setImage(image); + viewerOperation->setImageUser(imageUser); + viewerOperation->setViewSettings(context.getViewSettings()); + viewerOperation->setDisplaySettings(context.getDisplaySettings()); + viewerOperation->setRenderData(context.getRenderData()); + viewerOperation->setViewName(context.getViewName()); - /* defaults - the viewer node has these options but not exposed for split view - * we could use the split to define an area of interest on one axis at least */ - viewerOperation->setChunkOrder(COM_ORDER_OF_CHUNKS_DEFAULT); - viewerOperation->setCenterX(0.5f); - viewerOperation->setCenterY(0.5f); + /* defaults - the viewer node has these options but not exposed for split view + * we could use the split to define an area of interest on one axis at least */ + viewerOperation->setChunkOrder(COM_ORDER_OF_CHUNKS_DEFAULT); + viewerOperation->setCenterX(0.5f); + viewerOperation->setCenterY(0.5f); - converter.addOperation(viewerOperation); - converter.addLink(splitViewerOperation->getOutputSocket(), viewerOperation->getInputSocket(0)); + converter.addOperation(viewerOperation); + converter.addLink(splitViewerOperation->getOutputSocket(), viewerOperation->getInputSocket(0)); - converter.addPreview(splitViewerOperation->getOutputSocket()); + converter.addPreview(splitViewerOperation->getOutputSocket()); - if (do_output) - converter.registerViewer(viewerOperation); + if (do_output) + converter.registerViewer(viewerOperation); } diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.h b/source/blender/compositor/nodes/COM_SplitViewerNode.h index aedb805a36a..2e350720841 100644 --- a/source/blender/compositor/nodes/COM_SplitViewerNode.h +++ b/source/blender/compositor/nodes/COM_SplitViewerNode.h @@ -26,8 +26,8 @@ * \ingroup Node */ class SplitViewerNode : public Node { -public: - SplitViewerNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + SplitViewerNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp index 3dd7656e3f5..cc14d8d952f 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp @@ -25,74 +25,75 @@ #include "COM_SetSamplerOperation.h" extern "C" { -# include "DNA_movieclip_types.h" -# include "BKE_tracking.h" +#include "DNA_movieclip_types.h" +#include "BKE_tracking.h" } Stabilize2dNode::Stabilize2dNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void Stabilize2dNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void Stabilize2dNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - NodeInput *imageInput = this->getInputSocket(0); - MovieClip *clip = (MovieClip *)editorNode->id; - bool invert = (editorNode->custom2 & CMP_NODEFLAG_STABILIZE_INVERSE) != 0; + bNode *editorNode = this->getbNode(); + NodeInput *imageInput = this->getInputSocket(0); + MovieClip *clip = (MovieClip *)editorNode->id; + bool invert = (editorNode->custom2 & CMP_NODEFLAG_STABILIZE_INVERSE) != 0; - ScaleOperation *scaleOperation = new ScaleOperation(); - scaleOperation->setSampler((PixelSampler)editorNode->custom1); - RotateOperation *rotateOperation = new RotateOperation(); - rotateOperation->setDoDegree2RadConversion(false); - TranslateOperation *translateOperation = new TranslateOperation(); - MovieClipAttributeOperation *scaleAttribute = new MovieClipAttributeOperation(); - MovieClipAttributeOperation *angleAttribute = new MovieClipAttributeOperation(); - MovieClipAttributeOperation *xAttribute = new MovieClipAttributeOperation(); - MovieClipAttributeOperation *yAttribute = new MovieClipAttributeOperation(); - SetSamplerOperation *psoperation = new SetSamplerOperation(); - psoperation->setSampler((PixelSampler)editorNode->custom1); + ScaleOperation *scaleOperation = new ScaleOperation(); + scaleOperation->setSampler((PixelSampler)editorNode->custom1); + RotateOperation *rotateOperation = new RotateOperation(); + rotateOperation->setDoDegree2RadConversion(false); + TranslateOperation *translateOperation = new TranslateOperation(); + MovieClipAttributeOperation *scaleAttribute = new MovieClipAttributeOperation(); + MovieClipAttributeOperation *angleAttribute = new MovieClipAttributeOperation(); + MovieClipAttributeOperation *xAttribute = new MovieClipAttributeOperation(); + MovieClipAttributeOperation *yAttribute = new MovieClipAttributeOperation(); + SetSamplerOperation *psoperation = new SetSamplerOperation(); + psoperation->setSampler((PixelSampler)editorNode->custom1); - scaleAttribute->setAttribute(MCA_SCALE); - scaleAttribute->setFramenumber(context.getFramenumber()); - scaleAttribute->setMovieClip(clip); - scaleAttribute->setInvert(invert); + scaleAttribute->setAttribute(MCA_SCALE); + scaleAttribute->setFramenumber(context.getFramenumber()); + scaleAttribute->setMovieClip(clip); + scaleAttribute->setInvert(invert); - angleAttribute->setAttribute(MCA_ANGLE); - angleAttribute->setFramenumber(context.getFramenumber()); - angleAttribute->setMovieClip(clip); - angleAttribute->setInvert(invert); + angleAttribute->setAttribute(MCA_ANGLE); + angleAttribute->setFramenumber(context.getFramenumber()); + angleAttribute->setMovieClip(clip); + angleAttribute->setInvert(invert); - xAttribute->setAttribute(MCA_X); - xAttribute->setFramenumber(context.getFramenumber()); - xAttribute->setMovieClip(clip); - xAttribute->setInvert(invert); + xAttribute->setAttribute(MCA_X); + xAttribute->setFramenumber(context.getFramenumber()); + xAttribute->setMovieClip(clip); + xAttribute->setInvert(invert); - yAttribute->setAttribute(MCA_Y); - yAttribute->setFramenumber(context.getFramenumber()); - yAttribute->setMovieClip(clip); - yAttribute->setInvert(invert); + yAttribute->setAttribute(MCA_Y); + yAttribute->setFramenumber(context.getFramenumber()); + yAttribute->setMovieClip(clip); + yAttribute->setInvert(invert); - converter.addOperation(scaleAttribute); - converter.addOperation(angleAttribute); - converter.addOperation(xAttribute); - converter.addOperation(yAttribute); - converter.addOperation(scaleOperation); - converter.addOperation(translateOperation); - converter.addOperation(rotateOperation); - converter.addOperation(psoperation); + converter.addOperation(scaleAttribute); + converter.addOperation(angleAttribute); + converter.addOperation(xAttribute); + converter.addOperation(yAttribute); + converter.addOperation(scaleOperation); + converter.addOperation(translateOperation); + converter.addOperation(rotateOperation); + converter.addOperation(psoperation); - converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); - converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1)); - converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2)); + converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); + converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1)); + converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2)); - converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); - converter.addLink(angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1)); + converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); + converter.addLink(angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1)); - converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); - converter.addLink(xAttribute->getOutputSocket(), translateOperation->getInputSocket(1)); - converter.addLink(yAttribute->getOutputSocket(), translateOperation->getInputSocket(2)); + converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); + converter.addLink(xAttribute->getOutputSocket(), translateOperation->getInputSocket(1)); + converter.addLink(yAttribute->getOutputSocket(), translateOperation->getInputSocket(2)); - converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), psoperation->getOutputSocket()); + converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(), psoperation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.h b/source/blender/compositor/nodes/COM_Stabilize2dNode.h index a17f1b0a7e1..bbf7b239d82 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.h +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.h @@ -27,9 +27,9 @@ * \ingroup Node */ class Stabilize2dNode : public Node { -public: - Stabilize2dNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + Stabilize2dNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_SunBeamsNode.cpp b/source/blender/compositor/nodes/COM_SunBeamsNode.cpp index 31c8770792c..d899a54c03c 100644 --- a/source/blender/compositor/nodes/COM_SunBeamsNode.cpp +++ b/source/blender/compositor/nodes/COM_SunBeamsNode.cpp @@ -20,19 +20,20 @@ SunBeamsNode::SunBeamsNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void SunBeamsNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void SunBeamsNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); - NodeSunBeams *data = (NodeSunBeams *)getbNode()->storage; + NodeInput *inputSocket = this->getInputSocket(0); + NodeOutput *outputSocket = this->getOutputSocket(0); + NodeSunBeams *data = (NodeSunBeams *)getbNode()->storage; - SunBeamsOperation *operation = new SunBeamsOperation(); - operation->setData(*data); - converter.addOperation(operation); + SunBeamsOperation *operation = new SunBeamsOperation(); + operation->setData(*data); + converter.addOperation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_SunBeamsNode.h b/source/blender/compositor/nodes/COM_SunBeamsNode.h index 065454f5969..9d35f40f760 100644 --- a/source/blender/compositor/nodes/COM_SunBeamsNode.h +++ b/source/blender/compositor/nodes/COM_SunBeamsNode.h @@ -25,9 +25,9 @@ * \ingroup Node */ class SunBeamsNode : public Node { -public: - SunBeamsNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + SunBeamsNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_SwitchNode.cpp b/source/blender/compositor/nodes/COM_SwitchNode.cpp index c106dd8fc59..342f6bc159c 100644 --- a/source/blender/compositor/nodes/COM_SwitchNode.cpp +++ b/source/blender/compositor/nodes/COM_SwitchNode.cpp @@ -20,18 +20,19 @@ SwitchNode::SwitchNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void SwitchNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void SwitchNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bool condition = this->getbNode()->custom1; + bool condition = this->getbNode()->custom1; - NodeOperationOutput *result; - if (!condition) - result = converter.addInputProxy(getInputSocket(0), false); - else - result = converter.addInputProxy(getInputSocket(1), false); + NodeOperationOutput *result; + if (!condition) + result = converter.addInputProxy(getInputSocket(0), false); + else + result = converter.addInputProxy(getInputSocket(1), false); - converter.mapOutputSocket(getOutputSocket(0), result); + converter.mapOutputSocket(getOutputSocket(0), result); } diff --git a/source/blender/compositor/nodes/COM_SwitchNode.h b/source/blender/compositor/nodes/COM_SwitchNode.h index 7a2387fba66..509b748b18a 100644 --- a/source/blender/compositor/nodes/COM_SwitchNode.h +++ b/source/blender/compositor/nodes/COM_SwitchNode.h @@ -27,8 +27,8 @@ * \ingroup Node */ class SwitchNode : public Node { -public: - SwitchNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + SwitchNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_SwitchViewNode.cpp b/source/blender/compositor/nodes/COM_SwitchViewNode.cpp index 45df513a383..e4a946e2e9d 100644 --- a/source/blender/compositor/nodes/COM_SwitchViewNode.cpp +++ b/source/blender/compositor/nodes/COM_SwitchViewNode.cpp @@ -21,19 +21,20 @@ SwitchViewNode::SwitchViewNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void SwitchViewNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void SwitchViewNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - NodeOperationOutput *result; - const char *viewName = context.getViewName(); - bNode *bnode = this->getbNode(); + NodeOperationOutput *result; + const char *viewName = context.getViewName(); + bNode *bnode = this->getbNode(); - /* get the internal index of the socket with a matching name */ - int nr = BLI_findstringindex(&bnode->inputs, viewName, offsetof(bNodeSocket, name)); - nr = max(nr, 0); + /* get the internal index of the socket with a matching name */ + int nr = BLI_findstringindex(&bnode->inputs, viewName, offsetof(bNodeSocket, name)); + nr = max(nr, 0); - result = converter.addInputProxy(getInputSocket(nr), false); - converter.mapOutputSocket(getOutputSocket(0), result); + result = converter.addInputProxy(getInputSocket(nr), false); + converter.mapOutputSocket(getOutputSocket(0), result); } diff --git a/source/blender/compositor/nodes/COM_SwitchViewNode.h b/source/blender/compositor/nodes/COM_SwitchViewNode.h index 92ae3fafffa..0260621961d 100644 --- a/source/blender/compositor/nodes/COM_SwitchViewNode.h +++ b/source/blender/compositor/nodes/COM_SwitchViewNode.h @@ -27,8 +27,8 @@ * \ingroup Node */ class SwitchViewNode : public Node { -public: - SwitchViewNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + SwitchViewNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_TextureNode.cpp b/source/blender/compositor/nodes/COM_TextureNode.cpp index adf1333e226..3381b5098d7 100644 --- a/source/blender/compositor/nodes/COM_TextureNode.cpp +++ b/source/blender/compositor/nodes/COM_TextureNode.cpp @@ -22,34 +22,35 @@ TextureNode::TextureNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void TextureNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void TextureNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - Tex *texture = (Tex *)editorNode->id; - TextureOperation *operation = new TextureOperation(); - const ColorManagedDisplaySettings *displaySettings = context.getDisplaySettings(); - bool sceneColorManage = !STREQ(displaySettings->display_device, "None"); - operation->setTexture(texture); - operation->setRenderData(context.getRenderData()); - operation->setSceneColorManage(sceneColorManage); - converter.addOperation(operation); + bNode *editorNode = this->getbNode(); + Tex *texture = (Tex *)editorNode->id; + TextureOperation *operation = new TextureOperation(); + const ColorManagedDisplaySettings *displaySettings = context.getDisplaySettings(); + bool sceneColorManage = !STREQ(displaySettings->display_device, "None"); + operation->setTexture(texture); + operation->setRenderData(context.getRenderData()); + operation->setSceneColorManage(sceneColorManage); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(1), operation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(1), operation->getOutputSocket()); - converter.addPreview(operation->getOutputSocket()); + converter.addPreview(operation->getOutputSocket()); - TextureAlphaOperation *alphaOperation = new TextureAlphaOperation(); - alphaOperation->setTexture(texture); - alphaOperation->setRenderData(context.getRenderData()); - alphaOperation->setSceneColorManage(sceneColorManage); - converter.addOperation(alphaOperation); + TextureAlphaOperation *alphaOperation = new TextureAlphaOperation(); + alphaOperation->setTexture(texture); + alphaOperation->setRenderData(context.getRenderData()); + alphaOperation->setSceneColorManage(sceneColorManage); + converter.addOperation(alphaOperation); - converter.mapInputSocket(getInputSocket(0), alphaOperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), alphaOperation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), alphaOperation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), alphaOperation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), alphaOperation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), alphaOperation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_TextureNode.h b/source/blender/compositor/nodes/COM_TextureNode.h index 19285d98127..026d42ce2c3 100644 --- a/source/blender/compositor/nodes/COM_TextureNode.h +++ b/source/blender/compositor/nodes/COM_TextureNode.h @@ -24,7 +24,7 @@ * \ingroup Node */ class TextureNode : public Node { -public: - TextureNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + TextureNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; diff --git a/source/blender/compositor/nodes/COM_TimeNode.cpp b/source/blender/compositor/nodes/COM_TimeNode.cpp index 8eb7848ba6c..45604882992 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.cpp +++ b/source/blender/compositor/nodes/COM_TimeNode.cpp @@ -20,38 +20,39 @@ #include "COM_SetValueOperation.h" #include "COM_ExecutionSystem.h" extern "C" { -# include "BKE_colortools.h" +#include "BKE_colortools.h" } #include "BLI_utildefines.h" TimeNode::TimeNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void TimeNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void TimeNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - SetValueOperation *operation = new SetValueOperation(); - bNode *node = this->getbNode(); + SetValueOperation *operation = new SetValueOperation(); + bNode *node = this->getbNode(); - /* stack order output: fac */ - float fac = 0.0f; - const int framenumber = context.getFramenumber(); + /* stack order output: fac */ + float fac = 0.0f; + const int framenumber = context.getFramenumber(); - if (framenumber < node->custom1) { - fac = 0.0f; - } - else if (framenumber > node->custom2) { - fac = 1.0f; - } - else if (node->custom1 < node->custom2) { - fac = (context.getFramenumber() - node->custom1) / (float)(node->custom2 - node->custom1); - } + if (framenumber < node->custom1) { + fac = 0.0f; + } + else if (framenumber > node->custom2) { + fac = 1.0f; + } + else if (node->custom1 < node->custom2) { + fac = (context.getFramenumber() - node->custom1) / (float)(node->custom2 - node->custom1); + } - curvemapping_initialize((CurveMapping *)node->storage); - fac = curvemapping_evaluateF((CurveMapping *)node->storage, 0, fac); - operation->setValue(clamp_f(fac, 0.0f, 1.0f)); - converter.addOperation(operation); + curvemapping_initialize((CurveMapping *)node->storage); + fac = curvemapping_evaluateF((CurveMapping *)node->storage, 0, fac); + operation->setValue(clamp_f(fac, 0.0f, 1.0f)); + converter.addOperation(operation); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_TimeNode.h b/source/blender/compositor/nodes/COM_TimeNode.h index 5f46a6e0dae..230ffe3b676 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.h +++ b/source/blender/compositor/nodes/COM_TimeNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class TimeNode : public Node { -public: - TimeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + TimeNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_TonemapNode.cpp b/source/blender/compositor/nodes/COM_TonemapNode.cpp index f6294161cec..2b13a6519e3 100644 --- a/source/blender/compositor/nodes/COM_TonemapNode.cpp +++ b/source/blender/compositor/nodes/COM_TonemapNode.cpp @@ -22,17 +22,19 @@ TonemapNode::TonemapNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void TonemapNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void TonemapNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeTonemap *data = (NodeTonemap *)this->getbNode()->storage; + NodeTonemap *data = (NodeTonemap *)this->getbNode()->storage; - TonemapOperation *operation = data->type == 1 ? new PhotoreceptorTonemapOperation() : new TonemapOperation(); - operation->setData(data); - converter.addOperation(operation); + TonemapOperation *operation = data->type == 1 ? new PhotoreceptorTonemapOperation() : + new TonemapOperation(); + operation->setData(data); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_TonemapNode.h b/source/blender/compositor/nodes/COM_TonemapNode.h index 17392da1eff..9e6c01a5e45 100644 --- a/source/blender/compositor/nodes/COM_TonemapNode.h +++ b/source/blender/compositor/nodes/COM_TonemapNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class TonemapNode : public Node { -public: - TonemapNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + TonemapNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.cpp b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp index 7c9cd395890..da9f50a590b 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.cpp +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp @@ -23,14 +23,14 @@ #include "COM_TrackPositionOperation.h" extern "C" { -# include "DNA_movieclip_types.h" +#include "DNA_movieclip_types.h" -# include "BKE_node.h" +#include "BKE_node.h" } TrackPositionNode::TrackPositionNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } static TrackPositionOperation *create_motion_operation(NodeConverter &converter, @@ -40,77 +40,74 @@ static TrackPositionOperation *create_motion_operation(NodeConverter &converter, int frame_number, int delta) { - TrackPositionOperation *operation = new TrackPositionOperation(); - operation->setMovieClip(clip); - operation->setTrackingObject(trackpos_data->tracking_object); - operation->setTrackName(trackpos_data->track_name); - operation->setFramenumber(frame_number); - operation->setAxis(axis); - operation->setPosition(CMP_TRACKPOS_ABSOLUTE); - operation->setRelativeFrame(frame_number + delta); - operation->setSpeedOutput(true); - converter.addOperation(operation); - return operation; + TrackPositionOperation *operation = new TrackPositionOperation(); + operation->setMovieClip(clip); + operation->setTrackingObject(trackpos_data->tracking_object); + operation->setTrackName(trackpos_data->track_name); + operation->setFramenumber(frame_number); + operation->setAxis(axis); + operation->setPosition(CMP_TRACKPOS_ABSOLUTE); + operation->setRelativeFrame(frame_number + delta); + operation->setSpeedOutput(true); + converter.addOperation(operation); + return operation; } -void TrackPositionNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void TrackPositionNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - MovieClip *clip = (MovieClip *) editorNode->id; - NodeTrackPosData *trackpos_data = (NodeTrackPosData *) editorNode->storage; + bNode *editorNode = this->getbNode(); + MovieClip *clip = (MovieClip *)editorNode->id; + NodeTrackPosData *trackpos_data = (NodeTrackPosData *)editorNode->storage; - NodeOutput *outputX = this->getOutputSocket(0); - NodeOutput *outputY = this->getOutputSocket(1); - NodeOutput *outputSpeed = this->getOutputSocket(2); + NodeOutput *outputX = this->getOutputSocket(0); + NodeOutput *outputY = this->getOutputSocket(1); + NodeOutput *outputSpeed = this->getOutputSocket(2); - int frame_number; - if (editorNode->custom1 == CMP_TRACKPOS_ABSOLUTE_FRAME) { - frame_number = editorNode->custom2; - } - else { - frame_number = context.getFramenumber(); - } + int frame_number; + if (editorNode->custom1 == CMP_TRACKPOS_ABSOLUTE_FRAME) { + frame_number = editorNode->custom2; + } + else { + frame_number = context.getFramenumber(); + } - TrackPositionOperation *operationX = new TrackPositionOperation(); - operationX->setMovieClip(clip); - operationX->setTrackingObject(trackpos_data->tracking_object); - operationX->setTrackName(trackpos_data->track_name); - operationX->setFramenumber(frame_number); - operationX->setAxis(0); - operationX->setPosition(editorNode->custom1); - operationX->setRelativeFrame(editorNode->custom2); - converter.addOperation(operationX); - converter.mapOutputSocket(outputX, operationX->getOutputSocket()); + TrackPositionOperation *operationX = new TrackPositionOperation(); + operationX->setMovieClip(clip); + operationX->setTrackingObject(trackpos_data->tracking_object); + operationX->setTrackName(trackpos_data->track_name); + operationX->setFramenumber(frame_number); + operationX->setAxis(0); + operationX->setPosition(editorNode->custom1); + operationX->setRelativeFrame(editorNode->custom2); + converter.addOperation(operationX); + converter.mapOutputSocket(outputX, operationX->getOutputSocket()); - TrackPositionOperation *operationY = new TrackPositionOperation(); - operationY->setMovieClip(clip); - operationY->setTrackingObject(trackpos_data->tracking_object); - operationY->setTrackName(trackpos_data->track_name); - operationY->setFramenumber(frame_number); - operationY->setAxis(1); - operationY->setPosition(editorNode->custom1); - operationY->setRelativeFrame(editorNode->custom2); - converter.addOperation(operationY); - converter.mapOutputSocket(outputY, operationY->getOutputSocket()); + TrackPositionOperation *operationY = new TrackPositionOperation(); + operationY->setMovieClip(clip); + operationY->setTrackingObject(trackpos_data->tracking_object); + operationY->setTrackName(trackpos_data->track_name); + operationY->setFramenumber(frame_number); + operationY->setAxis(1); + operationY->setPosition(editorNode->custom1); + operationY->setRelativeFrame(editorNode->custom2); + converter.addOperation(operationY); + converter.mapOutputSocket(outputY, operationY->getOutputSocket()); - TrackPositionOperation *operationMotionPreX = - create_motion_operation(converter, clip, trackpos_data, 0, frame_number, -1); - TrackPositionOperation *operationMotionPreY = - create_motion_operation(converter, clip, trackpos_data, 1, frame_number, -1); - TrackPositionOperation *operationMotionPostX = - create_motion_operation(converter, clip, trackpos_data, 0, frame_number, 1); - TrackPositionOperation *operationMotionPostY = - create_motion_operation(converter, clip, trackpos_data, 1, frame_number, 1); + TrackPositionOperation *operationMotionPreX = create_motion_operation( + converter, clip, trackpos_data, 0, frame_number, -1); + TrackPositionOperation *operationMotionPreY = create_motion_operation( + converter, clip, trackpos_data, 1, frame_number, -1); + TrackPositionOperation *operationMotionPostX = create_motion_operation( + converter, clip, trackpos_data, 0, frame_number, 1); + TrackPositionOperation *operationMotionPostY = create_motion_operation( + converter, clip, trackpos_data, 1, frame_number, 1); - CombineChannelsOperation *combine_operation = new CombineChannelsOperation(); - converter.addOperation(combine_operation); - converter.addLink(operationMotionPreX->getOutputSocket(), - combine_operation->getInputSocket(0)); - converter.addLink(operationMotionPreY->getOutputSocket(), - combine_operation->getInputSocket(1)); - converter.addLink(operationMotionPostX->getOutputSocket(), - combine_operation->getInputSocket(2)); - converter.addLink(operationMotionPostY->getOutputSocket(), - combine_operation->getInputSocket(3)); - converter.mapOutputSocket(outputSpeed, combine_operation->getOutputSocket()); + CombineChannelsOperation *combine_operation = new CombineChannelsOperation(); + converter.addOperation(combine_operation); + converter.addLink(operationMotionPreX->getOutputSocket(), combine_operation->getInputSocket(0)); + converter.addLink(operationMotionPreY->getOutputSocket(), combine_operation->getInputSocket(1)); + converter.addLink(operationMotionPostX->getOutputSocket(), combine_operation->getInputSocket(2)); + converter.addLink(operationMotionPostY->getOutputSocket(), combine_operation->getInputSocket(3)); + converter.mapOutputSocket(outputSpeed, combine_operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.h b/source/blender/compositor/nodes/COM_TrackPositionNode.h index 8b911fb2397..c9420764598 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.h +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.h @@ -24,8 +24,7 @@ * \ingroup Node */ class TrackPositionNode : public Node { -public: - TrackPositionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; - + public: + TrackPositionNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; diff --git a/source/blender/compositor/nodes/COM_TransformNode.cpp b/source/blender/compositor/nodes/COM_TransformNode.cpp index 45c65c04eba..738039fc255 100644 --- a/source/blender/compositor/nodes/COM_TransformNode.cpp +++ b/source/blender/compositor/nodes/COM_TransformNode.cpp @@ -26,42 +26,43 @@ TransformNode::TransformNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void TransformNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void TransformNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *imageInput = this->getInputSocket(0); - NodeInput *xInput = this->getInputSocket(1); - NodeInput *yInput = this->getInputSocket(2); - NodeInput *angleInput = this->getInputSocket(3); - NodeInput *scaleInput = this->getInputSocket(4); + NodeInput *imageInput = this->getInputSocket(0); + NodeInput *xInput = this->getInputSocket(1); + NodeInput *yInput = this->getInputSocket(2); + NodeInput *angleInput = this->getInputSocket(3); + NodeInput *scaleInput = this->getInputSocket(4); - ScaleOperation *scaleOperation = new ScaleOperation(); - converter.addOperation(scaleOperation); + ScaleOperation *scaleOperation = new ScaleOperation(); + converter.addOperation(scaleOperation); - RotateOperation *rotateOperation = new RotateOperation(); - rotateOperation->setDoDegree2RadConversion(false); - converter.addOperation(rotateOperation); + RotateOperation *rotateOperation = new RotateOperation(); + rotateOperation->setDoDegree2RadConversion(false); + converter.addOperation(rotateOperation); - TranslateOperation *translateOperation = new TranslateOperation(); - converter.addOperation(translateOperation); + TranslateOperation *translateOperation = new TranslateOperation(); + converter.addOperation(translateOperation); - SetSamplerOperation *sampler = new SetSamplerOperation(); - sampler->setSampler((PixelSampler)this->getbNode()->custom1); - converter.addOperation(sampler); + SetSamplerOperation *sampler = new SetSamplerOperation(); + sampler->setSampler((PixelSampler)this->getbNode()->custom1); + converter.addOperation(sampler); - converter.mapInputSocket(imageInput, sampler->getInputSocket(0)); - converter.addLink(sampler->getOutputSocket(), scaleOperation->getInputSocket(0)); - converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(1)); - converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(2)); // xscale = yscale + converter.mapInputSocket(imageInput, sampler->getInputSocket(0)); + converter.addLink(sampler->getOutputSocket(), scaleOperation->getInputSocket(0)); + converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(1)); + converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(2)); // xscale = yscale - converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); - converter.mapInputSocket(angleInput, rotateOperation->getInputSocket(1)); + converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); + converter.mapInputSocket(angleInput, rotateOperation->getInputSocket(1)); - converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); - converter.mapInputSocket(xInput, translateOperation->getInputSocket(1)); - converter.mapInputSocket(yInput, translateOperation->getInputSocket(2)); + converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); + converter.mapInputSocket(xInput, translateOperation->getInputSocket(1)); + converter.mapInputSocket(yInput, translateOperation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(), translateOperation->getOutputSocket()); + converter.mapOutputSocket(getOutputSocket(), translateOperation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_TransformNode.h b/source/blender/compositor/nodes/COM_TransformNode.h index de6dee271b2..12eb66a19bb 100644 --- a/source/blender/compositor/nodes/COM_TransformNode.h +++ b/source/blender/compositor/nodes/COM_TransformNode.h @@ -27,9 +27,9 @@ * \ingroup Node */ class TransformNode : public Node { -public: - TransformNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + TransformNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif /* __COM_TRANSFORMNODE_H__ */ +#endif /* __COM_TRANSFORMNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_TranslateNode.cpp b/source/blender/compositor/nodes/COM_TranslateNode.cpp index a09f972dfec..8fed5c9b003 100644 --- a/source/blender/compositor/nodes/COM_TranslateNode.cpp +++ b/source/blender/compositor/nodes/COM_TranslateNode.cpp @@ -25,45 +25,46 @@ TranslateNode::TranslateNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void TranslateNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void TranslateNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *bnode = this->getbNode(); - NodeTranslateData *data = (NodeTranslateData *)bnode->storage; + bNode *bnode = this->getbNode(); + NodeTranslateData *data = (NodeTranslateData *)bnode->storage; - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputXSocket = this->getInputSocket(1); - NodeInput *inputYSocket = this->getInputSocket(2); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *inputSocket = this->getInputSocket(0); + NodeInput *inputXSocket = this->getInputSocket(1); + NodeInput *inputYSocket = this->getInputSocket(2); + NodeOutput *outputSocket = this->getOutputSocket(0); - TranslateOperation *operation = new TranslateOperation(); - if (data->relative) { - const RenderData *rd = context.getRenderData(); - float fx = rd->xsch * rd->size / 100.0f; - float fy = rd->ysch * rd->size / 100.0f; + TranslateOperation *operation = new TranslateOperation(); + if (data->relative) { + const RenderData *rd = context.getRenderData(); + float fx = rd->xsch * rd->size / 100.0f; + float fy = rd->ysch * rd->size / 100.0f; - operation->setFactorXY(fx, fy); - } + operation->setFactorXY(fx, fy); + } - converter.addOperation(operation); - converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); - converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.addOperation(operation); + converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); + converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - if (data->wrap_axis) { - WriteBufferOperation *writeOperation = new WriteBufferOperation(COM_DT_COLOR); - WrapOperation *wrapOperation = new WrapOperation(COM_DT_COLOR); - wrapOperation->setMemoryProxy(writeOperation->getMemoryProxy()); - wrapOperation->setWrapping(data->wrap_axis); + if (data->wrap_axis) { + WriteBufferOperation *writeOperation = new WriteBufferOperation(COM_DT_COLOR); + WrapOperation *wrapOperation = new WrapOperation(COM_DT_COLOR); + wrapOperation->setMemoryProxy(writeOperation->getMemoryProxy()); + wrapOperation->setWrapping(data->wrap_axis); - converter.addOperation(writeOperation); - converter.addOperation(wrapOperation); - converter.mapInputSocket(inputSocket, writeOperation->getInputSocket(0)); - converter.addLink(wrapOperation->getOutputSocket(), operation->getInputSocket(0)); - } - else { - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - } + converter.addOperation(writeOperation); + converter.addOperation(wrapOperation); + converter.mapInputSocket(inputSocket, writeOperation->getInputSocket(0)); + converter.addLink(wrapOperation->getOutputSocket(), operation->getInputSocket(0)); + } + else { + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + } } diff --git a/source/blender/compositor/nodes/COM_TranslateNode.h b/source/blender/compositor/nodes/COM_TranslateNode.h index 9a13906adde..d9ef6c639a0 100644 --- a/source/blender/compositor/nodes/COM_TranslateNode.h +++ b/source/blender/compositor/nodes/COM_TranslateNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class TranslateNode : public Node { -public: - TranslateNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + TranslateNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ValueNode.cpp b/source/blender/compositor/nodes/COM_ValueNode.cpp index 207598d0c99..f9769c3709a 100644 --- a/source/blender/compositor/nodes/COM_ValueNode.cpp +++ b/source/blender/compositor/nodes/COM_ValueNode.cpp @@ -22,15 +22,16 @@ ValueNode::ValueNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ValueNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ValueNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - SetValueOperation *operation = new SetValueOperation(); - NodeOutput *output = this->getOutputSocket(0); - operation->setValue(output->getEditorValueFloat()); - converter.addOperation(operation); + SetValueOperation *operation = new SetValueOperation(); + NodeOutput *output = this->getOutputSocket(0); + operation->setValue(output->getEditorValueFloat()); + converter.addOperation(operation); - converter.mapOutputSocket(output, operation->getOutputSocket()); + converter.mapOutputSocket(output, operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ValueNode.h b/source/blender/compositor/nodes/COM_ValueNode.h index 870debf95ab..a973649aa46 100644 --- a/source/blender/compositor/nodes/COM_ValueNode.h +++ b/source/blender/compositor/nodes/COM_ValueNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ValueNode : public Node { -public: - ValueNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ValueNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp index 776fa66acf5..4ff2f3ddfb1 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp @@ -22,21 +22,22 @@ VectorBlurNode::VectorBlurNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void VectorBlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void VectorBlurNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *node = this->getbNode(); - NodeBlurData *vectorBlurSettings = (NodeBlurData *)node->storage; + bNode *node = this->getbNode(); + NodeBlurData *vectorBlurSettings = (NodeBlurData *)node->storage; - VectorBlurOperation *operation = new VectorBlurOperation(); - operation->setVectorBlurSettings(vectorBlurSettings); - operation->setQuality(context.getQuality()); - converter.addOperation(operation); + VectorBlurOperation *operation = new VectorBlurOperation(); + operation->setVectorBlurSettings(vectorBlurSettings); + operation->setQuality(context.getQuality()); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); + converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.h b/source/blender/compositor/nodes/COM_VectorBlurNode.h index 9533de11b77..027c241f72d 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.h +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class VectorBlurNode : public Node { -public: - VectorBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + VectorBlurNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.cpp b/source/blender/compositor/nodes/COM_VectorCurveNode.cpp index 81dac70b8fc..4f8485a430b 100644 --- a/source/blender/compositor/nodes/COM_VectorCurveNode.cpp +++ b/source/blender/compositor/nodes/COM_VectorCurveNode.cpp @@ -22,15 +22,16 @@ VectorCurveNode::VectorCurveNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void VectorCurveNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void VectorCurveNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - VectorCurveOperation *operation = new VectorCurveOperation(); - operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); - converter.addOperation(operation); + VectorCurveOperation *operation = new VectorCurveOperation(); + operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); + converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.h b/source/blender/compositor/nodes/COM_VectorCurveNode.h index 8495bf51e51..14bea25cf8d 100644 --- a/source/blender/compositor/nodes/COM_VectorCurveNode.h +++ b/source/blender/compositor/nodes/COM_VectorCurveNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class VectorCurveNode : public Node { -public: - VectorCurveNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + VectorCurveNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp index 935ffb6e005..b6c12365ce0 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp @@ -24,37 +24,38 @@ ViewLevelsNode::ViewLevelsNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ViewLevelsNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const +void ViewLevelsNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *input = this->getInputSocket(0); - if (input->isLinked()) { - // add preview to inputSocket; + NodeInput *input = this->getInputSocket(0); + if (input->isLinked()) { + // add preview to inputSocket; - /* calculate mean operation */ - { - CalculateMeanOperation *operation = new CalculateMeanOperation(); - operation->setSetting(this->getbNode()->custom1); + /* calculate mean operation */ + { + CalculateMeanOperation *operation = new CalculateMeanOperation(); + operation->setSetting(this->getbNode()->custom1); - converter.addOperation(operation); - converter.mapInputSocket(input, operation->getInputSocket(0)); - converter.mapOutputSocket(this->getOutputSocket(0), operation->getOutputSocket()); - } + converter.addOperation(operation); + converter.mapInputSocket(input, operation->getInputSocket(0)); + converter.mapOutputSocket(this->getOutputSocket(0), operation->getOutputSocket()); + } - /* calculate standard deviation operation */ - { - CalculateStandardDeviationOperation *operation = new CalculateStandardDeviationOperation(); - operation->setSetting(this->getbNode()->custom1); + /* calculate standard deviation operation */ + { + CalculateStandardDeviationOperation *operation = new CalculateStandardDeviationOperation(); + operation->setSetting(this->getbNode()->custom1); - converter.addOperation(operation); - converter.mapInputSocket(input, operation->getInputSocket(0)); - converter.mapOutputSocket(this->getOutputSocket(1), operation->getOutputSocket()); - } - } - else { - converter.addOutputValue(getOutputSocket(0), 0.0f); - converter.addOutputValue(getOutputSocket(1), 0.0f); - } + converter.addOperation(operation); + converter.mapInputSocket(input, operation->getInputSocket(0)); + converter.mapOutputSocket(this->getOutputSocket(1), operation->getOutputSocket()); + } + } + else { + converter.addOutputValue(getOutputSocket(0), 0.0f); + converter.addOutputValue(getOutputSocket(1), 0.0f); + } } diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.h b/source/blender/compositor/nodes/COM_ViewLevelsNode.h index 0973e8d0edb..851b1ecbd78 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.h +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.h @@ -26,9 +26,9 @@ * \ingroup Node */ class ViewLevelsNode : public Node { -public: - ViewLevelsNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ViewLevelsNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cpp b/source/blender/compositor/nodes/COM_ViewerNode.cpp index 0aae047689d..08f3be27c55 100644 --- a/source/blender/compositor/nodes/COM_ViewerNode.cpp +++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp @@ -27,53 +27,55 @@ ViewerNode::ViewerNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ViewerNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void ViewerNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - bool do_output = (editorNode->flag & NODE_DO_OUTPUT_RECALC || context.isRendering()) && (editorNode->flag & NODE_DO_OUTPUT); - bool ignore_alpha = (editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0; + bNode *editorNode = this->getbNode(); + bool do_output = (editorNode->flag & NODE_DO_OUTPUT_RECALC || context.isRendering()) && + (editorNode->flag & NODE_DO_OUTPUT); + bool ignore_alpha = (editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0; - NodeInput *imageSocket = this->getInputSocket(0); - NodeInput *alphaSocket = this->getInputSocket(1); - NodeInput *depthSocket = this->getInputSocket(2); - Image *image = (Image *)this->getbNode()->id; - ImageUser *imageUser = (ImageUser *) this->getbNode()->storage; - ViewerOperation *viewerOperation = new ViewerOperation(); - viewerOperation->setbNodeTree(context.getbNodeTree()); - viewerOperation->setImage(image); - viewerOperation->setImageUser(imageUser); - viewerOperation->setChunkOrder((OrderOfChunks)editorNode->custom1); - viewerOperation->setCenterX(editorNode->custom3); - viewerOperation->setCenterY(editorNode->custom4); - /* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */ - viewerOperation->setUseAlphaInput(ignore_alpha || alphaSocket->isLinked()); - viewerOperation->setRenderData(context.getRenderData()); - viewerOperation->setViewName(context.getViewName()); + NodeInput *imageSocket = this->getInputSocket(0); + NodeInput *alphaSocket = this->getInputSocket(1); + NodeInput *depthSocket = this->getInputSocket(2); + Image *image = (Image *)this->getbNode()->id; + ImageUser *imageUser = (ImageUser *)this->getbNode()->storage; + ViewerOperation *viewerOperation = new ViewerOperation(); + viewerOperation->setbNodeTree(context.getbNodeTree()); + viewerOperation->setImage(image); + viewerOperation->setImageUser(imageUser); + viewerOperation->setChunkOrder((OrderOfChunks)editorNode->custom1); + viewerOperation->setCenterX(editorNode->custom3); + viewerOperation->setCenterY(editorNode->custom4); + /* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */ + viewerOperation->setUseAlphaInput(ignore_alpha || alphaSocket->isLinked()); + viewerOperation->setRenderData(context.getRenderData()); + viewerOperation->setViewName(context.getViewName()); - viewerOperation->setViewSettings(context.getViewSettings()); - viewerOperation->setDisplaySettings(context.getDisplaySettings()); + viewerOperation->setViewSettings(context.getViewSettings()); + viewerOperation->setDisplaySettings(context.getDisplaySettings()); - viewerOperation->setResolutionInputSocketIndex(0); - if (!imageSocket->isLinked()) { - if (alphaSocket->isLinked()) { - viewerOperation->setResolutionInputSocketIndex(1); - } - } + viewerOperation->setResolutionInputSocketIndex(0); + if (!imageSocket->isLinked()) { + if (alphaSocket->isLinked()) { + viewerOperation->setResolutionInputSocketIndex(1); + } + } - converter.addOperation(viewerOperation); - converter.mapInputSocket(imageSocket, viewerOperation->getInputSocket(0)); - /* only use alpha link if "use alpha" is enabled */ - if (ignore_alpha) - converter.addInputValue(viewerOperation->getInputSocket(1), 1.0f); - else - converter.mapInputSocket(alphaSocket, viewerOperation->getInputSocket(1)); - converter.mapInputSocket(depthSocket, viewerOperation->getInputSocket(2)); + converter.addOperation(viewerOperation); + converter.mapInputSocket(imageSocket, viewerOperation->getInputSocket(0)); + /* only use alpha link if "use alpha" is enabled */ + if (ignore_alpha) + converter.addInputValue(viewerOperation->getInputSocket(1), 1.0f); + else + converter.mapInputSocket(alphaSocket, viewerOperation->getInputSocket(1)); + converter.mapInputSocket(depthSocket, viewerOperation->getInputSocket(2)); - converter.addNodeInputPreview(imageSocket); + converter.addNodeInputPreview(imageSocket); - if (do_output) - converter.registerViewer(viewerOperation); + if (do_output) + converter.registerViewer(viewerOperation); } diff --git a/source/blender/compositor/nodes/COM_ViewerNode.h b/source/blender/compositor/nodes/COM_ViewerNode.h index 3d6aabe2250..6168623e69c 100644 --- a/source/blender/compositor/nodes/COM_ViewerNode.h +++ b/source/blender/compositor/nodes/COM_ViewerNode.h @@ -26,8 +26,8 @@ * \ingroup Node */ class ViewerNode : public Node { -public: - ViewerNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ViewerNode(bNode *editorNode); + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.cpp b/source/blender/compositor/nodes/COM_ZCombineNode.cpp index 00b86c0f1e0..4faf828d6df 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.cpp +++ b/source/blender/compositor/nodes/COM_ZCombineNode.cpp @@ -26,73 +26,76 @@ #include "COM_AntiAliasOperation.h" #include "COM_MixOperation.h" -#include "DNA_material_types.h" // the ramp types +#include "DNA_material_types.h" // the ramp types -void ZCombineNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void ZCombineNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - if ((context.getRenderData()->scemode & R_FULL_SAMPLE) || this->getbNode()->custom2) { - ZCombineOperation *operation = NULL; - if (this->getbNode()->custom1) { - operation = new ZCombineAlphaOperation(); - } - else { - operation = new ZCombineOperation(); - } - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); - - MathMinimumOperation *zoperation = new MathMinimumOperation(); - converter.addOperation(zoperation); - - converter.mapInputSocket(getInputSocket(1), zoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(3), zoperation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket()); - } - else { - /* XXX custom1 is "use_alpha", what on earth is this supposed to do here?!? */ - // not full anti alias, use masking for Z combine. be aware it uses anti aliasing. - // step 1 create mask - NodeOperation *maskoperation; - if (this->getbNode()->custom1) { - maskoperation = new MathGreaterThanOperation(); - converter.addOperation(maskoperation); - - converter.mapInputSocket(getInputSocket(1), maskoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1)); - } - else { - maskoperation = new MathLessThanOperation(); - converter.addOperation(maskoperation); - - converter.mapInputSocket(getInputSocket(1), maskoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1)); - } - - // step 2 anti alias mask bit of an expensive operation, but does the trick - AntiAliasOperation *antialiasoperation = new AntiAliasOperation(); - converter.addOperation(antialiasoperation); - - converter.addLink(maskoperation->getOutputSocket(), antialiasoperation->getInputSocket(0)); - - // use mask to blend between the input colors. - ZCombineMaskOperation *zcombineoperation = this->getbNode()->custom1 ? new ZCombineMaskAlphaOperation() : new ZCombineMaskOperation(); - converter.addOperation(zcombineoperation); - - converter.addLink(antialiasoperation->getOutputSocket(), zcombineoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(0), zcombineoperation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), zcombineoperation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), zcombineoperation->getOutputSocket()); - - MathMinimumOperation *zoperation = new MathMinimumOperation(); - converter.addOperation(zoperation); - - converter.mapInputSocket(getInputSocket(1), zoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(3), zoperation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket()); - } + if ((context.getRenderData()->scemode & R_FULL_SAMPLE) || this->getbNode()->custom2) { + ZCombineOperation *operation = NULL; + if (this->getbNode()->custom1) { + operation = new ZCombineAlphaOperation(); + } + else { + operation = new ZCombineOperation(); + } + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); + converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + + MathMinimumOperation *zoperation = new MathMinimumOperation(); + converter.addOperation(zoperation); + + converter.mapInputSocket(getInputSocket(1), zoperation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(3), zoperation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket()); + } + else { + /* XXX custom1 is "use_alpha", what on earth is this supposed to do here?!? */ + // not full anti alias, use masking for Z combine. be aware it uses anti aliasing. + // step 1 create mask + NodeOperation *maskoperation; + if (this->getbNode()->custom1) { + maskoperation = new MathGreaterThanOperation(); + converter.addOperation(maskoperation); + + converter.mapInputSocket(getInputSocket(1), maskoperation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1)); + } + else { + maskoperation = new MathLessThanOperation(); + converter.addOperation(maskoperation); + + converter.mapInputSocket(getInputSocket(1), maskoperation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1)); + } + + // step 2 anti alias mask bit of an expensive operation, but does the trick + AntiAliasOperation *antialiasoperation = new AntiAliasOperation(); + converter.addOperation(antialiasoperation); + + converter.addLink(maskoperation->getOutputSocket(), antialiasoperation->getInputSocket(0)); + + // use mask to blend between the input colors. + ZCombineMaskOperation *zcombineoperation = this->getbNode()->custom1 ? + new ZCombineMaskAlphaOperation() : + new ZCombineMaskOperation(); + converter.addOperation(zcombineoperation); + + converter.addLink(antialiasoperation->getOutputSocket(), zcombineoperation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(0), zcombineoperation->getInputSocket(1)); + converter.mapInputSocket(getInputSocket(2), zcombineoperation->getInputSocket(2)); + converter.mapOutputSocket(getOutputSocket(0), zcombineoperation->getOutputSocket()); + + MathMinimumOperation *zoperation = new MathMinimumOperation(); + converter.addOperation(zoperation); + + converter.mapInputSocket(getInputSocket(1), zoperation->getInputSocket(0)); + converter.mapInputSocket(getInputSocket(3), zoperation->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket()); + } } diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.h b/source/blender/compositor/nodes/COM_ZCombineNode.h index d5a7b4d3f1e..95e81ca8c8f 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.h +++ b/source/blender/compositor/nodes/COM_ZCombineNode.h @@ -26,9 +26,11 @@ * \ingroup Node */ class ZCombineNode : public Node { -public: - ZCombineNode(bNode *editorNode) : Node(editorNode) {} - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + public: + ZCombineNode(bNode *editorNode) : Node(editorNode) + { + } + void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif |