Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/compositor/nodes')
-rw-r--r--source/blender/compositor/nodes/COM_AlphaOverNode.cpp24
-rw-r--r--source/blender/compositor/nodes/COM_AlphaOverNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_BilateralBlurNode.cpp14
-rw-r--r--source/blender/compositor/nodes/COM_BilateralBlurNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_BlurNode.cpp98
-rw-r--r--source/blender/compositor/nodes/COM_BlurNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_BokehBlurNode.cpp39
-rw-r--r--source/blender/compositor/nodes/COM_BokehBlurNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_BokehImageNode.cpp10
-rw-r--r--source/blender/compositor/nodes/COM_BokehImageNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_BoxMaskNode.cpp40
-rw-r--r--source/blender/compositor/nodes/COM_BoxMaskNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_BrightnessNode.cpp13
-rw-r--r--source/blender/compositor/nodes/COM_BrightnessNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ChannelMatteNode.cpp56
-rw-r--r--source/blender/compositor/nodes/COM_ChannelMatteNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ChromaMatteNode.cpp58
-rw-r--r--source/blender/compositor/nodes/COM_ChromaMatteNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ColorBalanceNode.cpp19
-rw-r--r--source/blender/compositor/nodes/COM_ColorBalanceNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp14
-rw-r--r--source/blender/compositor/nodes/COM_ColorCorrectionNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ColorCurveNode.cpp34
-rw-r--r--source/blender/compositor/nodes/COM_ColorCurveNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ColorMatteNode.cpp57
-rw-r--r--source/blender/compositor/nodes/COM_ColorMatteNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ColorNode.cpp9
-rw-r--r--source/blender/compositor/nodes/COM_ColorNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ColorRampNode.cpp29
-rw-r--r--source/blender/compositor/nodes/COM_ColorRampNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ColorSpillNode.cpp21
-rw-r--r--source/blender/compositor/nodes/COM_ColorSpillNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ColorToBWNode.cpp13
-rw-r--r--source/blender/compositor/nodes/COM_ColorToBWNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_CombineColorNode.cpp93
-rw-r--r--source/blender/compositor/nodes/COM_CombineColorNode.h74
-rw-r--r--source/blender/compositor/nodes/COM_CombineHSVANode.cpp46
-rw-r--r--source/blender/compositor/nodes/COM_CombineHSVANode.h38
-rw-r--r--source/blender/compositor/nodes/COM_CombineRGBANode.cpp64
-rw-r--r--source/blender/compositor/nodes/COM_CombineRGBANode.h37
-rw-r--r--source/blender/compositor/nodes/COM_CombineYCCANode.cpp45
-rw-r--r--source/blender/compositor/nodes/COM_CombineYCCANode.h37
-rw-r--r--source/blender/compositor/nodes/COM_CombineYUVANode.cpp40
-rw-r--r--source/blender/compositor/nodes/COM_CombineYUVANode.h37
-rw-r--r--source/blender/compositor/nodes/COM_CompositorNode.cpp29
-rw-r--r--source/blender/compositor/nodes/COM_CompositorNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp12
-rw-r--r--source/blender/compositor/nodes/COM_ConvertAlphaNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_CornerPinNode.cpp35
-rw-r--r--source/blender/compositor/nodes/COM_CornerPinNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_CropNode.cpp9
-rw-r--r--source/blender/compositor/nodes/COM_CropNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_DefocusNode.cpp96
-rw-r--r--source/blender/compositor/nodes/COM_DefocusNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_DespeckleNode.cpp25
-rw-r--r--source/blender/compositor/nodes/COM_DespeckleNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp32
-rw-r--r--source/blender/compositor/nodes/COM_DifferenceMatteNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_DilateErodeNode.cpp101
-rw-r--r--source/blender/compositor/nodes/COM_DilateErodeNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp12
-rw-r--r--source/blender/compositor/nodes/COM_DirectionalBlurNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_DisplaceNode.cpp17
-rw-r--r--source/blender/compositor/nodes/COM_DisplaceNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_DistanceMatteNode.cpp83
-rw-r--r--source/blender/compositor/nodes/COM_DistanceMatteNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp11
-rw-r--r--source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_EllipseMaskNode.cpp42
-rw-r--r--source/blender/compositor/nodes/COM_EllipseMaskNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_FilterNode.cpp20
-rw-r--r--source/blender/compositor/nodes/COM_FilterNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_FlipNode.cpp12
-rw-r--r--source/blender/compositor/nodes/COM_FlipNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_GammaNode.cpp10
-rw-r--r--source/blender/compositor/nodes/COM_GammaNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_GlareNode.cpp46
-rw-r--r--source/blender/compositor/nodes/COM_GlareNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_GroupNode.cpp216
-rw-r--r--source/blender/compositor/nodes/COM_GroupNode.h61
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp38
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp38
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_IDMaskNode.cpp19
-rw-r--r--source/blender/compositor/nodes/COM_IDMaskNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ImageNode.cpp170
-rw-r--r--source/blender/compositor/nodes/COM_ImageNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_InpaintNode.cpp10
-rw-r--r--source/blender/compositor/nodes/COM_InpaintNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_InvertNode.cpp10
-rw-r--r--source/blender/compositor/nodes/COM_InvertNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_KeyingNode.cpp276
-rw-r--r--source/blender/compositor/nodes/COM_KeyingNode.h22
-rw-r--r--source/blender/compositor/nodes/COM_KeyingScreenNode.cpp22
-rw-r--r--source/blender/compositor/nodes/COM_KeyingScreenNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_LensDistortionNode.cpp33
-rw-r--r--source/blender/compositor/nodes/COM_LensDistortionNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp39
-rw-r--r--source/blender/compositor/nodes/COM_LuminanceMatteNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_MapRangeNode.cpp34
-rw-r--r--source/blender/compositor/nodes/COM_MapRangeNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_MapUVNode.cpp15
-rw-r--r--source/blender/compositor/nodes/COM_MapUVNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_MapValueNode.cpp15
-rw-r--r--source/blender/compositor/nodes/COM_MapValueNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_MaskNode.cpp16
-rw-r--r--source/blender/compositor/nodes/COM_MaskNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_MathNode.cpp18
-rw-r--r--source/blender/compositor/nodes/COM_MathNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_MixNode.cpp25
-rw-r--r--source/blender/compositor/nodes/COM_MixNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_MovieClipNode.cpp78
-rw-r--r--source/blender/compositor/nodes/COM_MovieClipNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_MovieDistortionNode.cpp15
-rw-r--r--source/blender/compositor/nodes/COM_MovieDistortionNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_MuteNode.cpp175
-rw-r--r--source/blender/compositor/nodes/COM_MuteNode.h51
-rw-r--r--source/blender/compositor/nodes/COM_NormalNode.cpp27
-rw-r--r--source/blender/compositor/nodes/COM_NormalNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_NormalizeNode.cpp9
-rw-r--r--source/blender/compositor/nodes/COM_NormalizeNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_OutputFileNode.cpp45
-rw-r--r--source/blender/compositor/nodes/COM_OutputFileNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_PixelateNode.cpp21
-rw-r--r--source/blender/compositor/nodes/COM_PixelateNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp62
-rw-r--r--source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_RenderLayersNode.cpp101
-rw-r--r--source/blender/compositor/nodes/COM_RenderLayersNode.h4
-rw-r--r--source/blender/compositor/nodes/COM_RotateNode.cpp21
-rw-r--r--source/blender/compositor/nodes/COM_RotateNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ScaleNode.cpp71
-rw-r--r--source/blender/compositor/nodes/COM_ScaleNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_SeparateColorNode.cpp117
-rw-r--r--source/blender/compositor/nodes/COM_SeparateColorNode.h74
-rw-r--r--source/blender/compositor/nodes/COM_SeparateHSVANode.cpp44
-rw-r--r--source/blender/compositor/nodes/COM_SeparateHSVANode.h39
-rw-r--r--source/blender/compositor/nodes/COM_SeparateRGBANode.cpp76
-rw-r--r--source/blender/compositor/nodes/COM_SeparateRGBANode.h37
-rw-r--r--source/blender/compositor/nodes/COM_SeparateYCCANode.cpp46
-rw-r--r--source/blender/compositor/nodes/COM_SeparateYCCANode.h38
-rw-r--r--source/blender/compositor/nodes/COM_SeparateYUVANode.cpp42
-rw-r--r--source/blender/compositor/nodes/COM_SeparateYUVANode.h38
-rw-r--r--source/blender/compositor/nodes/COM_SetAlphaNode.cpp16
-rw-r--r--source/blender/compositor/nodes/COM_SetAlphaNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_SocketProxyNode.cpp94
-rw-r--r--source/blender/compositor/nodes/COM_SocketProxyNode.h13
-rw-r--r--source/blender/compositor/nodes/COM_SplitViewerNode.cpp25
-rw-r--r--source/blender/compositor/nodes/COM_SplitViewerNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_Stabilize2dNode.cpp61
-rw-r--r--source/blender/compositor/nodes/COM_Stabilize2dNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_SwitchNode.cpp26
-rw-r--r--source/blender/compositor/nodes/COM_SwitchNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_TextureNode.cpp37
-rw-r--r--source/blender/compositor/nodes/COM_TextureNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_TimeNode.cpp11
-rw-r--r--source/blender/compositor/nodes/COM_TimeNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_TonemapNode.cpp11
-rw-r--r--source/blender/compositor/nodes/COM_TonemapNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_TrackPositionNode.cpp27
-rw-r--r--source/blender/compositor/nodes/COM_TrackPositionNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_TransformNode.cpp47
-rw-r--r--source/blender/compositor/nodes/COM_TransformNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_TranslateNode.cpp53
-rw-r--r--source/blender/compositor/nodes/COM_TranslateNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ValueNode.cpp9
-rw-r--r--source/blender/compositor/nodes/COM_ValueNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_VectorBlurNode.cpp17
-rw-r--r--source/blender/compositor/nodes/COM_VectorBlurNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_VectorCurveNode.cpp12
-rw-r--r--source/blender/compositor/nodes/COM_VectorCurveNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ViewLevelsNode.cpp52
-rw-r--r--source/blender/compositor/nodes/COM_ViewLevelsNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ViewerNode.cpp30
-rw-r--r--source/blender/compositor/nodes/COM_ViewerNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ZCombineNode.cpp96
-rw-r--r--source/blender/compositor/nodes/COM_ZCombineNode.h2
178 files changed, 1851 insertions, 2896 deletions
diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
index bf081cae097..0306d636c8b 100644
--- a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
+++ b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
@@ -27,16 +27,13 @@
#include "COM_AlphaOverMixedOperation.h"
#include "COM_AlphaOverPremultiplyOperation.h"
-#include "COM_ExecutionSystem.h"
#include "COM_SetValueOperation.h"
#include "DNA_material_types.h" // the ramp types
-void AlphaOverNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void AlphaOverNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *valueSocket = this->getInputSocket(0);
- InputSocket *color1Socket = this->getInputSocket(1);
- InputSocket *color2Socket = this->getInputSocket(2);
- OutputSocket *outputSocket = this->getOutputSocket(0);
+ NodeInput *color1Socket = this->getInputSocket(1);
+ NodeInput *color2Socket = this->getInputSocket(2);
bNode *editorNode = this->getbNode();
MixBaseOperation *convertProg;
@@ -55,18 +52,19 @@ void AlphaOverNode::convertToOperations(ExecutionSystem *graph, CompositorContex
}
convertProg->setUseValueAlphaMultiply(false);
- if (color1Socket->isConnected()) {
+ if (color1Socket->isLinked()) {
convertProg->setResolutionInputSocketIndex(1);
}
- else if (color2Socket->isConnected()) {
+ else if (color2Socket->isLinked()) {
convertProg->setResolutionInputSocketIndex(2);
}
else {
convertProg->setResolutionInputSocketIndex(0);
}
- valueSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph);
- color1Socket->relinkConnections(convertProg->getInputSocket(1), 1, graph);
- color2Socket->relinkConnections(convertProg->getInputSocket(2), 2, graph);
- outputSocket->relinkConnections(convertProg->getOutputSocket(0));
- graph->addOperation(convertProg);
+
+ 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 e25e9e11975..45febd62683 100644
--- a/source/blender/compositor/nodes/COM_AlphaOverNode.h
+++ b/source/blender/compositor/nodes/COM_AlphaOverNode.h
@@ -32,7 +32,7 @@
class AlphaOverNode : public Node {
public:
AlphaOverNode(bNode *editorNode) : Node(editorNode) {}
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 399d2adf0be..90ff4ecf235 100644
--- a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp
@@ -30,15 +30,15 @@ BilateralBlurNode::BilateralBlurNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void BilateralBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void BilateralBlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
NodeBilateralBlurData *data = (NodeBilateralBlurData *)this->getbNode()->storage;
BilateralBlurOperation *operation = new BilateralBlurOperation();
- operation->setbNode(this->getbNode());
- operation->setQuality(context->getQuality());
+ operation->setQuality(context.getQuality());
operation->setData(data);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- graph->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(0));
}
diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.h b/source/blender/compositor/nodes/COM_BilateralBlurNode.h
index e6f9242fa32..dfd7361dabe 100644
--- a/source/blender/compositor/nodes/COM_BilateralBlurNode.h
+++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.h
@@ -32,7 +32,7 @@
class BilateralBlurNode : public Node {
public:
BilateralBlurNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 a8de2aed526..b8421dcb102 100644
--- a/source/blender/compositor/nodes/COM_BlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BlurNode.cpp
@@ -38,84 +38,85 @@ BlurNode::BlurNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void BlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *editorNode = this->getbNode();
NodeBlurData *data = (NodeBlurData *)editorNode->storage;
- InputSocket *inputSizeSocket = this->getInputSocket(1);
- bool connectedSizeSocket = inputSizeSocket->isConnected();
+ NodeInput *inputSizeSocket = this->getInputSocket(1);
+ bool connectedSizeSocket = inputSizeSocket->isLinked();
const float size = this->getInputSocket(1)->getEditorValueFloat();
- CompositorQuality quality = context->getQuality();
+ 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->setChunksize(context->getChunksize());
- operationfgb->setbNode(editorNode);
- this->getInputSocket(1)->relinkConnections(operationfgb->getInputSocket(1), 1, graph);
- graph->addOperation(operationfgb);
-
+ operationfgb->setChunksize(context.getChunksize());
+ 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();
- addLink(graph, zero->getOutputSocket(), clamp->getInputSocket(1));
- this->getInputSocket(1)->relinkConnections(clamp->getInputSocket(0), 1, graph);
zero->setValue(0.0f);
clamp->setUseClamp(true);
- graph->addOperation(clamp);
- graph->addOperation(zero);
-
+
+ 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->setbNode(editorNode);
operationx->setQuality(quality);
operationx->setSize(1.0f);
operationx->setFalloff(PROP_SMOOTH);
operationx->setSubtract(false);
- addLink(graph, clamp->getOutputSocket(), operationx->getInputSocket(0));
- graph->addOperation(operationx);
-
+
+ converter.addOperation(operationx);
+ converter.addLink(clamp->getOutputSocket(), operationx->getInputSocket(0));
+
GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation();
operationy->setData(data);
- operationy->setbNode(editorNode);
operationy->setQuality(quality);
operationy->setSize(1.0f);
operationy->setFalloff(PROP_SMOOTH);
operationy->setSubtract(false);
- addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
- graph->addOperation(operationy);
-
+
+ converter.addOperation(operationy);
+ converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0));
+
GaussianBlurReferenceOperation *operation = new GaussianBlurReferenceOperation();
operation->setData(data);
- operation->setbNode(editorNode);
operation->setQuality(quality);
- addLink(graph, operationy->getOutputSocket(), operation->getInputSocket(1));
- graph->addOperation(operation);
-
+
+ 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->setbNode(editorNode);
operationx->setQuality(quality);
- this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), 1, graph);
- graph->addOperation(operationx);
+
+ converter.addOperation(operationx);
+ converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1));
+
GaussianYBlurOperation *operationy = new GaussianYBlurOperation();
operationy->setData(data);
- operationy->setbNode(editorNode);
operationy->setQuality(quality);
- graph->addOperation(operationy);
- addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
- addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1));
+ converter.addOperation(operationy);
+ converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1));
+ converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0));
if (!connectedSizeSocket) {
operationx->setSize(size);
@@ -128,10 +129,10 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
else {
GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation();
operation->setData(data);
- operation->setbNode(editorNode);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
operation->setQuality(quality);
- graph->addOperation(operation);
+
+ converter.addOperation(operation);
+ converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
if (!connectedSizeSocket) {
operation->setSize(size);
@@ -144,19 +145,20 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
if (data->gamma) {
GammaCorrectOperation *correct = new GammaCorrectOperation();
GammaUncorrectOperation *inverse = new GammaUncorrectOperation();
-
- this->getInputSocket(0)->relinkConnections(correct->getInputSocket(0), 0, graph);
- addLink(graph, correct->getOutputSocket(), input_operation->getInputSocket(0));
- addLink(graph, output_operation->getOutputSocket(), inverse->getInputSocket(0));
- this->getOutputSocket()->relinkConnections(inverse->getOutputSocket());
- graph->addOperation(correct);
- graph->addOperation(inverse);
-
- addPreviewOperation(graph, context, inverse->getOutputSocket());
+ 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 {
- this->getInputSocket(0)->relinkConnections(input_operation->getInputSocket(0), 0, graph);
- this->getOutputSocket()->relinkConnections(output_operation->getOutputSocket());
- addPreviewOperation(graph, context, output_operation->getOutputSocket());
+ 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 95b0516dae0..68844ca3d78 100644
--- a/source/blender/compositor/nodes/COM_BlurNode.h
+++ b/source/blender/compositor/nodes/COM_BlurNode.h
@@ -32,7 +32,7 @@
class BlurNode : public Node {
public:
BlurNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 5725bc6cb32..636660bc96c 100644
--- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
@@ -34,40 +34,37 @@ BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void BokehBlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *b_node = this->getbNode();
- InputSocket *inputSizeSocket = this->getInputSocket(2);
+ NodeInput *inputSizeSocket = this->getInputSocket(2);
- bool connectedSizeSocket = inputSizeSocket->isConnected();
+ bool connectedSizeSocket = inputSizeSocket->isLinked();
if ((b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) && connectedSizeSocket) {
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
-
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph);
- operation->setQuality(context->getQuality());
- operation->setbNode(this->getbNode());
- graph->addOperation(operation);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
+ 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();
-
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getInputSocket(2)->relinkConnections(operation->getInputSocket(3), 2, graph);
- this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph);
- operation->setQuality(context->getQuality());
- operation->setbNode(this->getbNode());
- graph->addOperation(operation);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
+ 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.mapInputSocket(getInputSocket(3), operation->getInputSocket(3));
+ converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket());
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 c2bc7552ac0..60ba79bed78 100644
--- a/source/blender/compositor/nodes/COM_BokehBlurNode.h
+++ b/source/blender/compositor/nodes/COM_BokehBlurNode.h
@@ -32,7 +32,7 @@
class BokehBlurNode : public Node {
public:
BokehBlurNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 a89ed9e0c64..c75e9b16336 100644
--- a/source/blender/compositor/nodes/COM_BokehImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_BokehImageNode.cpp
@@ -29,11 +29,13 @@ BokehImageNode::BokehImageNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void BokehImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void BokehImageNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
BokehImageOperation *operation = new BokehImageOperation();
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
operation->setData((NodeBokehImage *)this->getbNode()->storage);
- addPreviewOperation(graph, context, operation->getOutputSocket(0));
+
+ converter.addOperation(operation);
+ converter.mapOutputSocket(getOutputSocket(0), 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 a4bfe2bedc0..6768bf0e88f 100644
--- a/source/blender/compositor/nodes/COM_BokehImageNode.h
+++ b/source/blender/compositor/nodes/COM_BokehImageNode.h
@@ -32,7 +32,7 @@
class BokehImageNode : public Node {
public:
BokehImageNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 e3fb6ecc704..b8bf23b8549 100644
--- a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp
@@ -32,47 +32,43 @@ BoxMaskNode::BoxMaskNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void BoxMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void BoxMaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
+ NodeInput *inputSocket = this->getInputSocket(0);
+ NodeOutput *outputSocket = this->getOutputSocket(0);
+
BoxMaskOperation *operation;
operation = new BoxMaskOperation();
operation->setData((NodeBoxMask *)this->getbNode()->storage);
-
- InputSocket *inputSocket = this->getInputSocket(0);
- OutputSocket *outputSocket = this->getOutputSocket(0);
-
- if (inputSocket->isConnected()) {
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- outputSocket->relinkConnections(operation->getOutputSocket());
+ 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);
- graph->addOperation(valueOperation);
+ converter.addOperation(valueOperation);
/* Scale that image up to render resolution */
- const RenderData *rd = context->getRenderData();
+ 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);
- addLink(graph, valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0));
- addLink(graph, scaleOperation->getOutputSocket(0), operation->getInputSocket(0));
- outputSocket->relinkConnections(operation->getOutputSocket(0));
-
- scaleOperation->getInputSocket(0)->getConnection()->setIgnoreResizeCheck(true);
-
- graph->addOperation(scaleOperation);
+ converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0));
+ converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0));
+ converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
}
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- operation->setMaskType(this->getbNode()->custom1);
-
- graph->addOperation(operation);
+ 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 9ebe2cc755a..3f466ef798e 100644
--- a/source/blender/compositor/nodes/COM_BoxMaskNode.h
+++ b/source/blender/compositor/nodes/COM_BoxMaskNode.h
@@ -32,7 +32,7 @@
class BoxMaskNode : public Node {
public:
BoxMaskNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 cd230a23a5c..e684b569945 100644
--- a/source/blender/compositor/nodes/COM_BrightnessNode.cpp
+++ b/source/blender/compositor/nodes/COM_BrightnessNode.cpp
@@ -29,12 +29,13 @@ BrightnessNode::BrightnessNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void BrightnessNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void BrightnessNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
BrightnessOperation *operation = new BrightnessOperation();
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- graph->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));
}
diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.h b/source/blender/compositor/nodes/COM_BrightnessNode.h
index a10372049f0..bd414b84e95 100644
--- a/source/blender/compositor/nodes/COM_BrightnessNode.h
+++ b/source/blender/compositor/nodes/COM_BrightnessNode.h
@@ -32,7 +32,7 @@
class BrightnessNode : public Node {
public:
BrightnessNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 4c136583936..f356c74cd49 100644
--- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
@@ -30,15 +30,15 @@ ChannelMatteNode::ChannelMatteNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ChannelMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocketImage = this->getInputSocket(0);
- OutputSocket *outputSocketImage = this->getOutputSocket(0);
- OutputSocket *outputSocketMatte = this->getOutputSocket(1);
-
- NodeOperation *convert = NULL;
bNode *node = this->getbNode();
-
+
+ NodeInput *inputSocketImage = this->getInputSocket(0);
+ NodeOutput *outputSocketImage = this->getOutputSocket(0);
+ NodeOutput *outputSocketMatte = this->getOutputSocket(1);
+
+ NodeOperation *convert = NULL;
/* colorspace */
switch (node->custom1) {
case CMP_NODE_CHANNEL_MATTE_CS_RGB:
@@ -56,35 +56,31 @@ void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCon
default:
break;
}
-
+
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);
+
if (convert) {
- inputSocketImage->relinkConnections(convert->getInputSocket(0), 0, graph);
- addLink(graph, convert->getOutputSocket(), operation->getInputSocket(0));
- addLink(graph, convert->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
- graph->addOperation(convert);
+ converter.addOperation(convert);
+
+ converter.mapInputSocket(inputSocketImage, convert->getInputSocket(0));
+ converter.addLink(convert->getOutputSocket(), operation->getInputSocket(0));
+ converter.addLink(convert->getOutputSocket(), operationAlpha->getInputSocket(0));
}
else {
- inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
- addLink(graph, operation->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
- }
-
- if (outputSocketMatte->isConnected()) {
- outputSocketMatte->relinkConnections(operation->getOutputSocket(0));
- }
-
- graph->addOperation(operation);
- graph->addOperation(operationAlpha);
-
- addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
- addPreviewOperation(graph, context, operationAlpha->getOutputSocket());
-
- if (outputSocketImage->isConnected()) {
- outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
+ 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(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 29c6000a245..f528578e6dd 100644
--- a/source/blender/compositor/nodes/COM_ChannelMatteNode.h
+++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.h
@@ -31,7 +31,7 @@
class ChannelMatteNode : public Node {
public:
ChannelMatteNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* COM_ChannelMatteNODE_H */
diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
index c23f242ca5c..90de9358587 100644
--- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
@@ -30,44 +30,38 @@ ChromaMatteNode::ChromaMatteNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ChromaMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocketImage = this->getInputSocket(0);
- InputSocket *inputSocketKey = this->getInputSocket(1);
- OutputSocket *outputSocketImage = this->getOutputSocket(0);
- OutputSocket *outputSocketMatte = this->getOutputSocket(1);
-
+ bNode *editorsnode = getbNode();
+
+ 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(0); /* BLI_YCC_ITU_BT601 */
operationRGBToYCC_Key->setMode(0); /* BLI_YCC_ITU_BT601 */
-
+ converter.addOperation(operationRGBToYCC_Image);
+ converter.addOperation(operationRGBToYCC_Key);
+
ChromaMatteOperation *operation = new ChromaMatteOperation();
- bNode *editorsnode = getbNode();
operation->setSettings((NodeChroma *)editorsnode->storage);
-
- inputSocketImage->relinkConnections(operationRGBToYCC_Image->getInputSocket(0), 0, graph);
- inputSocketKey->relinkConnections(operationRGBToYCC_Key->getInputSocket(0), 1, graph);
-
- addLink(graph, operationRGBToYCC_Image->getOutputSocket(), operation->getInputSocket(0));
- addLink(graph, operationRGBToYCC_Key->getOutputSocket(), operation->getInputSocket(1));
-
- graph->addOperation(operationRGBToYCC_Image);
- graph->addOperation(operationRGBToYCC_Key);
- graph->addOperation(operation);
-
- if (outputSocketMatte->isConnected()) {
- outputSocketMatte->relinkConnections(operation->getOutputSocket());
- }
-
+ converter.addOperation(operation);
+
SetAlphaOperation *operationAlpha = new SetAlphaOperation();
- addLink(graph, operationRGBToYCC_Image->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
- addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
-
- graph->addOperation(operationAlpha);
- addPreviewOperation(graph, context, operationAlpha->getOutputSocket());
-
- if (outputSocketImage->isConnected()) {
- outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
- }
+ 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, operationAlpha->getInputSocket(0));
+ converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1));
+ converter.mapOutputSocket(outputSocketImage, 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 bf5302ccdbb..d1eb3a907ef 100644
--- a/source/blender/compositor/nodes/COM_ChromaMatteNode.h
+++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.h
@@ -31,7 +31,7 @@
class ChromaMatteNode : public Node {
public:
ChromaMatteNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* COM_ChromaMatteNODE_H */
diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
index 2b396fb9861..fc0df046e86 100644
--- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
@@ -32,14 +32,15 @@ ColorBalanceNode::ColorBalanceNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ColorBalanceNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- InputSocket *inputImageSocket = this->getInputSocket(1);
- OutputSocket *outputSocket = this->getOutputSocket(0);
-
bNode *node = this->getbNode();
NodeColorBalance *n = (NodeColorBalance *)node->storage;
+
+ 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();
@@ -62,9 +63,9 @@ void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorCon
operationCDL->setSlope(n->slope);
operation = operationCDL;
}
+ converter.addOperation(operation);
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- inputImageSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
+ 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 30d22ef2e63..f0b9694ec77 100644
--- a/source/blender/compositor/nodes/COM_ColorBalanceNode.h
+++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.h
@@ -32,7 +32,7 @@
class ColorBalanceNode : public Node {
public:
ColorBalanceNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* COM_ColorBalanceNODE_H */
diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp
index a05abaf17d3..728b51b8dc1 100644
--- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp
@@ -29,16 +29,18 @@ ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ColorCorrectionNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ColorCorrectionNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- ColorCorrectionOperation *operation = new ColorCorrectionOperation();
bNode *editorNode = getbNode();
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
+
+ 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);
- graph->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(0));
}
diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h
index f1b0f69bec5..aa2c475734d 100644
--- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h
+++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h
@@ -32,7 +32,7 @@
class ColorCorrectionNode : public Node {
public:
ColorCorrectionNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 103fbf26c7d..6dc936302f4 100644
--- a/source/blender/compositor/nodes/COM_ColorCurveNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorCurveNode.cpp
@@ -29,36 +29,32 @@ ColorCurveNode::ColorCurveNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ColorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ColorCurveNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- if (this->getInputSocket(2)->isConnected() || this->getInputSocket(3)->isConnected()) {
+ if (this->getInputSocket(2)->isLinked() || this->getInputSocket(3)->isLinked()) {
ColorCurveOperation *operation = new ColorCurveOperation();
-
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph);
- this->getInputSocket(3)->relinkConnections(operation->getInputSocket(3), 3, graph);
-
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
operation->setCurveMapping((CurveMapping *)this->getbNode()->storage);
-
- graph->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.mapInputSocket(getInputSocket(3), operation->getInputSocket(3));
+
+ converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket());
}
else {
ConstantLevelColorCurveOperation *operation = new ConstantLevelColorCurveOperation();
-
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
float col[4];
this->getInputSocket(2)->getEditorValueColor(col);
operation->setBlackLevel(col);
this->getInputSocket(3)->getEditorValueColor(col);
operation->setWhiteLevel(col);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
operation->setCurveMapping((CurveMapping *)this->getbNode()->storage);
-
- graph->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());
}
}
diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.h b/source/blender/compositor/nodes/COM_ColorCurveNode.h
index ecfae1f86f8..5420058ea64 100644
--- a/source/blender/compositor/nodes/COM_ColorCurveNode.h
+++ b/source/blender/compositor/nodes/COM_ColorCurveNode.h
@@ -32,7 +32,7 @@
class ColorCurveNode : public Node {
public:
ColorCurveNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 8ab93a58a1d..def3b18e0fe 100644
--- a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
@@ -30,41 +30,36 @@ ColorMatteNode::ColorMatteNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ColorMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocketImage = this->getInputSocket(0);
- InputSocket *inputSocketKey = this->getInputSocket(1);
- OutputSocket *outputSocketImage = this->getOutputSocket(0);
- OutputSocket *outputSocketMatte = this->getOutputSocket(1);
-
+ bNode *editorsnode = getbNode();
+
+ 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);
+
ColorMatteOperation *operation = new ColorMatteOperation();
- bNode *editorsnode = getbNode();
operation->setSettings((NodeChroma *)editorsnode->storage);
-
- inputSocketImage->relinkConnections(operationRGBToHSV_Image->getInputSocket(0), 0, graph);
- inputSocketKey->relinkConnections(operationRGBToHSV_Key->getInputSocket(0), 1, graph);
-
- addLink(graph, operationRGBToHSV_Image->getOutputSocket(), operation->getInputSocket(0));
- addLink(graph, operationRGBToHSV_Key->getOutputSocket(), operation->getInputSocket(1));
-
- if (outputSocketMatte->isConnected()) {
- outputSocketMatte->relinkConnections(operation->getOutputSocket(0));
- }
-
- graph->addOperation(operationRGBToHSV_Image);
- graph->addOperation(operationRGBToHSV_Key);
- graph->addOperation(operation);
-
+ converter.addOperation(operation);
+
SetAlphaOperation *operationAlpha = new SetAlphaOperation();
- addLink(graph, operationRGBToHSV_Image->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
- addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
- graph->addOperation(operationAlpha);
- addPreviewOperation(graph, context, operationAlpha->getOutputSocket());
-
- if (outputSocketImage->isConnected()) {
- outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
- }
+ 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, operationAlpha->getInputSocket(0));
+ converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1));
+ converter.mapOutputSocket(outputSocketImage, 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 3386476bc85..c17d3eb6c4e 100644
--- a/source/blender/compositor/nodes/COM_ColorMatteNode.h
+++ b/source/blender/compositor/nodes/COM_ColorMatteNode.h
@@ -31,7 +31,7 @@
class ColorMatteNode : public Node {
public:
ColorMatteNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* COM_ColorMatteNODE_H */
diff --git a/source/blender/compositor/nodes/COM_ColorNode.cpp b/source/blender/compositor/nodes/COM_ColorNode.cpp
index fc2566e5a47..4106cb64798 100644
--- a/source/blender/compositor/nodes/COM_ColorNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorNode.cpp
@@ -29,13 +29,14 @@ ColorNode::ColorNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ColorNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ColorNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
SetColorOperation *operation = new SetColorOperation();
- OutputSocket *output = this->getOutputSocket(0);
- output->relinkConnections(operation->getOutputSocket());
+ NodeOutput *output = this->getOutputSocket(0);
float col[4];
output->getEditorValueColor(col);
operation->setChannels(col);
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ converter.mapOutputSocket(output, operation->getOutputSocket());
}
diff --git a/source/blender/compositor/nodes/COM_ColorNode.h b/source/blender/compositor/nodes/COM_ColorNode.h
index 3e3df63e90a..ac8c6c221b9 100644
--- a/source/blender/compositor/nodes/COM_ColorNode.h
+++ b/source/blender/compositor/nodes/COM_ColorNode.h
@@ -32,7 +32,7 @@
class ColorNode : public Node {
public:
ColorNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 6f715a8f278..a61ddffbf35 100644
--- a/source/blender/compositor/nodes/COM_ColorRampNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorRampNode.cpp
@@ -32,23 +32,24 @@ ColorRampNode::ColorRampNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ColorRampNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ColorRampNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- OutputSocket *outputSocket = this->getOutputSocket(0);
- OutputSocket *outputSocketAlpha = this->getOutputSocket(1);
+ NodeInput *inputSocket = this->getInputSocket(0);
+ NodeOutput *outputSocket = this->getOutputSocket(0);
+ NodeOutput *outputSocketAlpha = this->getOutputSocket(1);
bNode *editorNode = this->getbNode();
ColorRampOperation *operation = new ColorRampOperation();
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- if (outputSocketAlpha->isConnected()) {
- SeparateChannelOperation *operation2 = new SeparateChannelOperation();
- outputSocketAlpha->relinkConnections(operation2->getOutputSocket());
- addLink(graph, operation->getOutputSocket(), operation2->getInputSocket(0));
- operation2->setChannel(3);
- graph->addOperation(operation2);
- }
operation->setColorBand((ColorBand *)editorNode->storage);
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
+ converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
+
+ SeparateChannelOperation *operation2 = new SeparateChannelOperation();
+ operation2->setChannel(3);
+ converter.addOperation(operation2);
+
+ 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 3f00e1c2190..d303616a417 100644
--- a/source/blender/compositor/nodes/COM_ColorRampNode.h
+++ b/source/blender/compositor/nodes/COM_ColorRampNode.h
@@ -32,7 +32,7 @@
class ColorRampNode : public Node {
public:
ColorRampNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* COM_ColorRampNODE_H */
diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp
index 0e586955ff8..82454ba7979 100644
--- a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp
@@ -29,14 +29,13 @@ ColorSpillNode::ColorSpillNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ColorSpillNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ColorSpillNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocketImage = this->getInputSocket(0);
- InputSocket *inputSocketFac = this->getInputSocket(1);
- OutputSocket *outputSocketImage = this->getOutputSocket(0);
-
bNode *editorsnode = getbNode();
-
+
+ NodeInput *inputSocketImage = this->getInputSocket(0);
+ NodeInput *inputSocketFac = this->getInputSocket(1);
+ NodeOutput *outputSocketImage = this->getOutputSocket(0);
ColorSpillOperation *operation;
if (editorsnode->custom2 == 0) {
@@ -49,11 +48,9 @@ void ColorSpillNode::convertToOperations(ExecutionSystem *graph, CompositorConte
}
operation->setSettings((NodeColorspill *)editorsnode->storage);
operation->setSpillChannel(editorsnode->custom1 - 1); // Channel for spilling
+ converter.addOperation(operation);
-
- inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
- inputSocketFac->relinkConnections(operation->getInputSocket(1), 1, graph);
-
- outputSocketImage->relinkConnections(operation->getOutputSocket());
- graph->addOperation(operation);
+ 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 01722fac826..7442d2b0261 100644
--- a/source/blender/compositor/nodes/COM_ColorSpillNode.h
+++ b/source/blender/compositor/nodes/COM_ColorSpillNode.h
@@ -32,7 +32,7 @@
class ColorSpillNode : public Node {
public:
ColorSpillNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* COM_ColorSpillNODE_H */
diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
index 07be93dab86..a1616a61b4b 100644
--- a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
@@ -30,13 +30,14 @@ ColorToBWNode::ColorToBWNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ColorToBWNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ColorToBWNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *colorSocket = this->getInputSocket(0);
- OutputSocket *valueSocket = this->getOutputSocket(0);
+ NodeInput *colorSocket = this->getInputSocket(0);
+ NodeOutput *valueSocket = this->getOutputSocket(0);
ConvertColorToBWOperation *convertProg = new ConvertColorToBWOperation();
- colorSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph);
- valueSocket->relinkConnections(convertProg->getOutputSocket(0));
- graph->addOperation(convertProg);
+ converter.addOperation(convertProg);
+
+ 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 f21c6ecef52..6932c153c0c 100644
--- a/source/blender/compositor/nodes/COM_ColorToBWNode.h
+++ b/source/blender/compositor/nodes/COM_ColorToBWNode.h
@@ -32,6 +32,6 @@
class ColorToBWNode : public Node {
public:
ColorToBWNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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
new file mode 100644
index 00000000000..2c1a3337f89
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_CombineColorNode.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Lukas Toenne
+ */
+
+#include "COM_CombineColorNode.h"
+
+#include "COM_ConvertOperation.h"
+
+
+CombineColorNode::CombineColorNode(bNode *editorNode) :
+ Node(editorNode)
+{
+}
+
+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);
+
+ 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));
+
+ 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());
+ }
+}
+
+
+NodeOperation *CombineRGBANode::getColorConverter(const CompositorContext &context) const
+{
+ return NULL; /* no conversion needed */
+}
+
+NodeOperation *CombineHSVANode::getColorConverter(const CompositorContext &context) const
+{
+ return new ConvertHSVToRGBOperation();
+}
+
+NodeOperation *CombineYCCANode::getColorConverter(const CompositorContext &context) const
+{
+ return new ConvertYCCToRGBOperation();
+}
+
+NodeOperation *CombineYUVANode::getColorConverter(const CompositorContext &context) const
+{
+ return new ConvertYUVToRGBOperation();
+}
diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.h b/source/blender/compositor/nodes/COM_CombineColorNode.h
new file mode 100644
index 00000000000..2eff1a28f20
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_CombineColorNode.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Lukas Toenne
+ */
+
+#ifndef _COM_CombineColorNode_h_
+#define _COM_CombineColorNode_h_
+
+#include "COM_Node.h"
+
+class CombineColorNode : public Node {
+public:
+ CombineColorNode(bNode *editorNode);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
+
+protected:
+ virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0;
+};
+
+class CombineRGBANode : public CombineColorNode {
+public:
+ CombineRGBANode(bNode *editorNode) :
+ CombineColorNode(editorNode)
+ {}
+
+ NodeOperation *getColorConverter(const CompositorContext &context) const;
+};
+
+class CombineHSVANode : public CombineColorNode {
+public:
+ CombineHSVANode(bNode *editorNode) :
+ CombineColorNode(editorNode)
+ {}
+
+ NodeOperation *getColorConverter(const CompositorContext &context) const;
+};
+
+class CombineYCCANode : public CombineColorNode {
+public:
+ CombineYCCANode(bNode *editorNode) :
+ CombineColorNode(editorNode)
+ {}
+
+ NodeOperation *getColorConverter(const CompositorContext &context) const;
+};
+
+class CombineYUVANode : public CombineColorNode {
+public:
+ CombineYUVANode(bNode *editorNode) :
+ CombineColorNode(editorNode)
+ {}
+
+ NodeOperation *getColorConverter(const CompositorContext &context) const;
+};
+
+#endif
diff --git a/source/blender/compositor/nodes/COM_CombineHSVANode.cpp b/source/blender/compositor/nodes/COM_CombineHSVANode.cpp
deleted file mode 100644
index 9f6614ed8c3..00000000000
--- a/source/blender/compositor/nodes/COM_CombineHSVANode.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#include "COM_CombineHSVANode.h"
-
-#include "COM_ConvertOperation.h"
-
-#include "COM_ExecutionSystem.h"
-#include "COM_SetValueOperation.h"
-#include "COM_ConvertOperation.h"
-
-CombineHSVANode::CombineHSVANode(bNode *editorNode) : CombineRGBANode(editorNode)
-{
- /* pass */
-}
-
-void CombineHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
-{
- ConvertHSVToRGBOperation *operation = new ConvertHSVToRGBOperation();
- OutputSocket *outputSocket = this->getOutputSocket(0);
- if (outputSocket->isConnected()) {
- outputSocket->relinkConnections(operation->getOutputSocket());
- addLink(graph, outputSocket, operation->getInputSocket(0));
- }
- graph->addOperation(operation);
- CombineRGBANode::convertToOperations(graph, context);
-}
diff --git a/source/blender/compositor/nodes/COM_CombineHSVANode.h b/source/blender/compositor/nodes/COM_CombineHSVANode.h
deleted file mode 100644
index 95d3cf9ecdd..00000000000
--- a/source/blender/compositor/nodes/COM_CombineHSVANode.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#ifndef _COM_CombineHSVANode_h_
-#define _COM_CombineHSVANode_h_
-
-#include "COM_Node.h"
-#include "DNA_node_types.h"
-#include "COM_CombineRGBANode.h"
-/**
- * @brief CombineHSVANode
- * @ingroup Node
- */
-class CombineHSVANode : public CombineRGBANode {
-public:
- CombineHSVANode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
-};
-#endif
diff --git a/source/blender/compositor/nodes/COM_CombineRGBANode.cpp b/source/blender/compositor/nodes/COM_CombineRGBANode.cpp
deleted file mode 100644
index 8dfded049e5..00000000000
--- a/source/blender/compositor/nodes/COM_CombineRGBANode.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#include "COM_CombineRGBANode.h"
-
-#include "COM_ConvertOperation.h"
-
-#include "COM_ExecutionSystem.h"
-#include "COM_SetValueOperation.h"
-#include "DNA_material_types.h" // the ramp types
-
-
-CombineRGBANode::CombineRGBANode(bNode *editorNode) : Node(editorNode)
-{
- /* pass */
-}
-
-void CombineRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
-{
- InputSocket *inputRSocket = this->getInputSocket(0);
- InputSocket *inputGSocket = this->getInputSocket(1);
- InputSocket *inputBSocket = this->getInputSocket(2);
- InputSocket *inputASocket = this->getInputSocket(3);
- OutputSocket *outputSocket = this->getOutputSocket(0);
-
- CombineChannelsOperation *operation = new CombineChannelsOperation();
- if (inputRSocket->isConnected()) {
- operation->setResolutionInputSocketIndex(0);
- }
- else if (inputGSocket->isConnected()) {
- operation->setResolutionInputSocketIndex(1);
- }
- else if (inputBSocket->isConnected()) {
- operation->setResolutionInputSocketIndex(2);
- }
- else {
- operation->setResolutionInputSocketIndex(3);
- }
- inputRSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- inputGSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
- inputBSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
- inputASocket->relinkConnections(operation->getInputSocket(3), 3, graph);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
-}
diff --git a/source/blender/compositor/nodes/COM_CombineRGBANode.h b/source/blender/compositor/nodes/COM_CombineRGBANode.h
deleted file mode 100644
index 5cc0b1ea6da..00000000000
--- a/source/blender/compositor/nodes/COM_CombineRGBANode.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#ifndef _COM_CombineRGBANode_h_
-#define _COM_CombineRGBANode_h_
-
-#include "COM_Node.h"
-#include "DNA_node_types.h"
-/**
- * @brief CombineRGBANode
- * @ingroup Node
- */
-class CombineRGBANode : public Node {
-public:
- CombineRGBANode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
-};
-#endif
diff --git a/source/blender/compositor/nodes/COM_CombineYCCANode.cpp b/source/blender/compositor/nodes/COM_CombineYCCANode.cpp
deleted file mode 100644
index ee787a4f9c1..00000000000
--- a/source/blender/compositor/nodes/COM_CombineYCCANode.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Dalai Felinto
- */
-
-#include "COM_CombineYCCANode.h"
-#include "COM_ConvertOperation.h"
-
-CombineYCCANode::CombineYCCANode(bNode *editorNode) : CombineRGBANode(editorNode)
-{
- /* pass */
-}
-
-void CombineYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
-{
- ConvertYCCToRGBOperation *operation = new ConvertYCCToRGBOperation();
- OutputSocket *outputSocket = this->getOutputSocket(0);
-
- bNode *node = this->getbNode();
- operation->setMode(node->custom1);
-
- if (outputSocket->isConnected()) {
- outputSocket->relinkConnections(operation->getOutputSocket());
- addLink(graph, outputSocket, operation->getInputSocket(0));
- }
-
- graph->addOperation(operation);
- CombineRGBANode::convertToOperations(graph, context);
-}
diff --git a/source/blender/compositor/nodes/COM_CombineYCCANode.h b/source/blender/compositor/nodes/COM_CombineYCCANode.h
deleted file mode 100644
index 6ff2938c161..00000000000
--- a/source/blender/compositor/nodes/COM_CombineYCCANode.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Dalai Felinto
- */
-
-#ifndef _COM_CombineYCCANode_h_
-#define _COM_CombineYCCANode_h_
-
-#include "COM_Node.h"
-#include "DNA_node_types.h"
-#include "COM_CombineRGBANode.h"
-/**
- * @brief CombineYCCANode
- * @ingroup Node
- */
-class CombineYCCANode : public CombineRGBANode {
-public:
- CombineYCCANode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
-};
-#endif
diff --git a/source/blender/compositor/nodes/COM_CombineYUVANode.cpp b/source/blender/compositor/nodes/COM_CombineYUVANode.cpp
deleted file mode 100644
index feee443cf05..00000000000
--- a/source/blender/compositor/nodes/COM_CombineYUVANode.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Dalai Felinto
- */
-
-#include "COM_CombineYUVANode.h"
-#include "COM_ConvertOperation.h"
-
-CombineYUVANode::CombineYUVANode(bNode *editorNode) : CombineRGBANode(editorNode)
-{
- /* pass */
-}
-
-void CombineYUVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
-{
- ConvertYUVToRGBOperation *operation = new ConvertYUVToRGBOperation();
- OutputSocket *outputSocket = this->getOutputSocket(0);
- if (outputSocket->isConnected()) {
- outputSocket->relinkConnections(operation->getOutputSocket());
- addLink(graph, outputSocket, operation->getInputSocket(0));
- }
- graph->addOperation(operation);
- CombineRGBANode::convertToOperations(graph, context);
-}
diff --git a/source/blender/compositor/nodes/COM_CombineYUVANode.h b/source/blender/compositor/nodes/COM_CombineYUVANode.h
deleted file mode 100644
index e3d8f36a5dd..00000000000
--- a/source/blender/compositor/nodes/COM_CombineYUVANode.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Dalai Felinto
- */
-
-#ifndef _COM_CombineYUVANode_h_
-#define _COM_CombineYUVANode_h_
-
-#include "COM_Node.h"
-#include "DNA_node_types.h"
-#include "COM_CombineRGBANode.h"
-/**
- * @brief CombineYUVANode
- * @ingroup Node
- */
-class CombineYUVANode : public CombineRGBANode {
-public:
- CombineYUVANode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
-};
-#endif
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp
index 7e192af0cd9..868528ade81 100644
--- a/source/blender/compositor/nodes/COM_CompositorNode.cpp
+++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp
@@ -29,26 +29,27 @@ CompositorNode::CompositorNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void CompositorNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *editorNode = this->getbNode();
bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC) ||
- context->isRendering();
+ context.isRendering();
- InputSocket *imageSocket = this->getInputSocket(0);
- InputSocket *alphaSocket = this->getInputSocket(1);
- InputSocket *depthSocket = this->getInputSocket(2);
+ NodeInput *imageSocket = this->getInputSocket(0);
+ NodeInput *alphaSocket = this->getInputSocket(1);
+ NodeInput *depthSocket = this->getInputSocket(2);
CompositorOperation *compositorOperation = new CompositorOperation();
- compositorOperation->setSceneName(context->getScene()->id.name);
- compositorOperation->setRenderData(context->getRenderData());
- compositorOperation->setbNodeTree(context->getbNodeTree());
+ compositorOperation->setSceneName(context.getScene()->id.name);
+ compositorOperation->setRenderData(context.getRenderData());
+ compositorOperation->setbNodeTree(context.getbNodeTree());
compositorOperation->setIgnoreAlpha(editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA);
compositorOperation->setActive(is_active);
- imageSocket->relinkConnections(compositorOperation->getInputSocket(0), 0, graph);
- alphaSocket->relinkConnections(compositorOperation->getInputSocket(1));
- depthSocket->relinkConnections(compositorOperation->getInputSocket(2));
- graph->addOperation(compositorOperation);
-
- addPreviewOperation(graph, context, compositorOperation->getInputSocket(0));
+
+ converter.addOperation(compositorOperation);
+ converter.mapInputSocket(imageSocket, compositorOperation->getInputSocket(0));
+ converter.mapInputSocket(alphaSocket, compositorOperation->getInputSocket(1));
+ converter.mapInputSocket(depthSocket, compositorOperation->getInputSocket(2));
+
+ converter.addNodeInputPreview(imageSocket);
}
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.h b/source/blender/compositor/nodes/COM_CompositorNode.h
index 54d52d7db9e..aa9a4cdd8bb 100644
--- a/source/blender/compositor/nodes/COM_CompositorNode.h
+++ b/source/blender/compositor/nodes/COM_CompositorNode.h
@@ -32,6 +32,6 @@
class CompositorNode : public Node {
public:
CompositorNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 72f3ed07fd5..ba31ed6e89c 100644
--- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
+++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
@@ -23,7 +23,7 @@
#include "COM_ConvertOperation.h"
#include "COM_ExecutionSystem.h"
-void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ConvertAlphaNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
NodeOperation *operation = NULL;
bNode *node = this->getbNode();
@@ -35,9 +35,9 @@ void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorCon
else {
operation = new ConvertStraightToPremulOperation();
}
-
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
- graph->addOperation(operation);
+
+ converter.addOperation(operation);
+
+ 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 a80f8de1607..5bc5169b6d9 100644
--- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h
+++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h
@@ -31,7 +31,7 @@
class ConvertAlphaNode : public Node {
public:
ConvertAlphaNode(bNode *editorNode) : Node(editorNode) {}
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 1f4f485f90a..ea9f22f2840 100644
--- a/source/blender/compositor/nodes/COM_CornerPinNode.cpp
+++ b/source/blender/compositor/nodes/COM_CornerPinNode.cpp
@@ -28,9 +28,9 @@ CornerPinNode::CornerPinNode(bNode *editorNode) : Node(editorNode)
{
}
-void CornerPinNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void CornerPinNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *input_image = this->getInputSocket(0);
+ 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
@@ -39,29 +39,20 @@ void CornerPinNode::convertToOperations(ExecutionSystem *graph, CompositorContex
*/
const int node_corner_index[4] = { 3, 4, 2, 1 };
- OutputSocket *output_warped_image = this->getOutputSocket(0);
- OutputSocket *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);
- input_image->relinkConnections(warp_image_operation->getInputSocket(0), 0, graph);
+ converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0));
for (int i = 0; i < 4; ++i) {
- int node_index = node_corner_index[i];
- getInputSocket(node_index)->relinkConnections(warp_image_operation->getInputSocket(i + 1),
- node_index, graph);
+ 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));
}
- output_warped_image->relinkConnections(warp_image_operation->getOutputSocket());
-
- graph->addOperation(warp_image_operation);
-
- PlaneCornerPinMaskOperation *plane_mask_operation = new PlaneCornerPinMaskOperation();
-
- /* connect mask op inputs to the same sockets as the warp image op */
- for (int i = 0; i < 4; ++i)
- addLink(graph,
- warp_image_operation->getInputSocket(i + 1)->getConnection()->getFromSocket(),
- plane_mask_operation->getInputSocket(i));
- output_plane->relinkConnections(plane_mask_operation->getOutputSocket());
-
- graph->addOperation(plane_mask_operation);
+ 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 b8b8a16384c..70e48e41d6b 100644
--- a/source/blender/compositor/nodes/COM_CornerPinNode.h
+++ b/source/blender/compositor/nodes/COM_CornerPinNode.h
@@ -35,7 +35,7 @@ extern "C" {
class CornerPinNode : public Node {
public:
CornerPinNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 f09bb7e1c26..6c3dc93481b 100644
--- a/source/blender/compositor/nodes/COM_CropNode.cpp
+++ b/source/blender/compositor/nodes/COM_CropNode.cpp
@@ -29,7 +29,7 @@ CropNode::CropNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void CropNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *node = getbNode();
NodeTwoXYs *cropSettings = (NodeTwoXYs *)node->storage;
@@ -44,7 +44,8 @@ void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
}
operation->setCropSettings(cropSettings);
operation->setRelative(relative);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket()->relinkConnections(operation->getOutputSocket());
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ 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 1003728a9d4..c1b84247ba2 100644
--- a/source/blender/compositor/nodes/COM_CropNode.h
+++ b/source/blender/compositor/nodes/COM_CropNode.h
@@ -32,7 +32,7 @@
class CropNode : public Node {
public:
CropNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 c2d25bbccd8..d2ea385fde0 100644
--- a/source/blender/compositor/nodes/COM_DefocusNode.cpp
+++ b/source/blender/compositor/nodes/COM_DefocusNode.cpp
@@ -39,11 +39,11 @@ DefocusNode::DefocusNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+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();
+ Scene *scene = node->id ? (Scene *)node->id : context.getScene();
Object *camob = scene ? scene->camera : NULL;
NodeOperation *radiusOperation;
@@ -54,36 +54,39 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
SetValueOperation *maxRadius = new SetValueOperation();
maxRadius->setValue(data->maxblur);
MathMinimumOperation *minimize = new MathMinimumOperation();
- this->getInputSocket(1)->relinkConnections(multiply->getInputSocket(0), 1, graph);
- addLink(graph, multiplier->getOutputSocket(), multiply->getInputSocket(1));
- addLink(graph, maxRadius->getOutputSocket(), minimize->getInputSocket(1));
- addLink(graph, multiply->getOutputSocket(), minimize->getInputSocket(0));
- graph->addOperation(multiply);
- graph->addOperation(multiplier);
- graph->addOperation(maxRadius);
- graph->addOperation(minimize);
+ 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 *converter = new ConvertDepthToRadiusOperation();
- converter->setCameraObject(camob);
- converter->setfStop(data->fstop);
- converter->setMaxRadius(data->maxblur);
- this->getInputSocket(1)->relinkConnections(converter->getInputSocket(0), 1, graph);
- graph->addOperation(converter);
+ 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();
- addLink(graph, converter->getOutputSocket(0), blur->getInputSocket(0));
- graph->addOperation(blur);
- radiusOperation = blur;
- converter->setPostBlur(blur);
-
/* 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;
}
- BokehImageOperation *bokeh = new BokehImageOperation();
NodeBokehImage *bokehdata = new NodeBokehImage();
bokehdata->angle = data->rotation;
bokehdata->rounding = 0.0f;
@@ -95,44 +98,47 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
bokehdata->catadioptric = 0.0f;
bokehdata->lensshift = 0.0f;
+ BokehImageOperation *bokeh = new BokehImageOperation();
bokeh->setData(bokehdata);
bokeh->deleteDataOnFinish();
- graph->addOperation(bokeh);
-
-#ifdef COM_DEFOCUS_SEARCH
+ converter.addOperation(bokeh);
+
+#ifdef COM_DEFOCUS_SEARCH
InverseSearchRadiusOperation *search = new InverseSearchRadiusOperation();
- addLink(graph, radiusOperation->getOutputSocket(0), search->getInputSocket(0));
search->setMaxBlur(data->maxblur);
- graph->addOperation(search);
+ converter.addOperation(search);
+
+ converter.addLink(radiusOperation->getOutputSocket(0), search->getInputSocket(0));
#endif
+
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
- if (data->preview) {
+ if (data->preview)
operation->setQuality(COM_QUALITY_LOW);
- }
- else {
- operation->setQuality(context->getQuality());
- }
+ else
+ operation->setQuality(context.getQuality());
operation->setMaxBlur(data->maxblur);
- operation->setbNode(node);
operation->setThreshold(data->bthresh);
- addLink(graph, bokeh->getOutputSocket(), operation->getInputSocket(1));
- addLink(graph, radiusOperation->getOutputSocket(), operation->getInputSocket(2));
+ converter.addOperation(operation);
+
+ converter.addLink(bokeh->getOutputSocket(), operation->getInputSocket(1));
+ converter.addLink(radiusOperation->getOutputSocket(), operation->getInputSocket(2));
#ifdef COM_DEFOCUS_SEARCH
- addLink(graph, 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();
- this->getInputSocket(0)->relinkConnections(correct->getInputSocket(0), 0, graph);
- addLink(graph, correct->getOutputSocket(), operation->getInputSocket(0));
- addLink(graph, operation->getOutputSocket(), inverse->getInputSocket(0));
- this->getOutputSocket()->relinkConnections(inverse->getOutputSocket());
- graph->addOperation(correct);
- graph->addOperation(inverse);
+ 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 {
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket()->relinkConnections(operation->getOutputSocket());
+ converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
+ converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket());
}
- graph->addOperation(operation);
}
diff --git a/source/blender/compositor/nodes/COM_DefocusNode.h b/source/blender/compositor/nodes/COM_DefocusNode.h
index 7d69b6413bb..8c607f0737e 100644
--- a/source/blender/compositor/nodes/COM_DefocusNode.h
+++ b/source/blender/compositor/nodes/COM_DefocusNode.h
@@ -32,7 +32,7 @@
class DefocusNode : public Node {
public:
DefocusNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 9894dc7b9ac..bac6337374f 100644
--- a/source/blender/compositor/nodes/COM_DespeckleNode.cpp
+++ b/source/blender/compositor/nodes/COM_DespeckleNode.cpp
@@ -29,22 +29,21 @@ DespeckleNode::DespeckleNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void DespeckleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void DespeckleNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *editorNode = this->getbNode();
- InputSocket *inputSocket = this->getInputSocket(0);
- InputSocket *inputImageSocket = this->getInputSocket(1);
- OutputSocket *outputSocket = this->getOutputSocket(0);
+ NodeInput *inputSocket = this->getInputSocket(0);
+ NodeInput *inputImageSocket = this->getInputSocket(1);
+ NodeOutput *outputSocket = this->getOutputSocket(0);
+
DespeckleOperation *operation = new DespeckleOperation();
-
- operation->setbNode(editorNode);
operation->setThreshold(editorNode->custom3);
operation->setThresholdNeighbor(editorNode->custom4);
-
- inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
- inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph);
- outputSocket->relinkConnections(operation->getOutputSocket());
- addPreviewOperation(graph, context, operation->getOutputSocket(0));
-
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0));
+ converter.mapInputSocket(inputSocket, operation->getInputSocket(1));
+ converter.mapOutputSocket(outputSocket, operation->getOutputSocket());
+
+ converter.addPreview(operation->getOutputSocket(0));
}
diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.h b/source/blender/compositor/nodes/COM_DespeckleNode.h
index 2b8ab9d0226..64d99db7ded 100644
--- a/source/blender/compositor/nodes/COM_DespeckleNode.h
+++ b/source/blender/compositor/nodes/COM_DespeckleNode.h
@@ -30,7 +30,7 @@
class DespeckleNode : public Node {
public:
DespeckleNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 b5ad07be319..8870badab09 100644
--- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
@@ -30,26 +30,28 @@ DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void DifferenceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void DifferenceMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- InputSocket *inputSocket2 = this->getInputSocket(1);
- OutputSocket *outputSocketImage = this->getOutputSocket(0);
- OutputSocket *outputSocketMatte = this->getOutputSocket(1);
+ 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);
- inputSocket->relinkConnections(operationSet->getInputSocket(0), 0, graph);
- inputSocket2->relinkConnections(operationSet->getInputSocket(1), 1, graph);
-
- outputSocketMatte->relinkConnections(operationSet->getOutputSocket(0));
- graph->addOperation(operationSet);
+ converter.addOperation(operationSet);
+
+ converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0));
+ converter.mapInputSocket(inputSocket2, operationSet->getInputSocket(1));
+ converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0));
SetAlphaOperation *operation = new SetAlphaOperation();
- addLink(graph, operationSet->getInputSocket(0)->getConnection()->getFromSocket(), operation->getInputSocket(0));
- addLink(graph, operationSet->getOutputSocket(), operation->getInputSocket(1));
- outputSocketImage->relinkConnections(operation->getOutputSocket());
- graph->addOperation(operation);
- addPreviewOperation(graph, context, operation->getOutputSocket());
+ converter.addOperation(operation);
+
+ converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
+ converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1));
+ converter.mapOutputSocket(outputSocketImage, 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 0b571889571..e221d43180b 100644
--- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h
+++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h
@@ -32,7 +32,7 @@
class DifferenceMatteNode : public Node {
public:
DifferenceMatteNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* COM_DifferenceMatteNODE_H */
diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
index 0fb7ea7d264..933cb8365f9 100644
--- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
+++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
@@ -30,85 +30,84 @@
DilateErodeNode::DilateErodeNode(bNode *editorNode) : Node(editorNode)
{
- /* pass */
+ /* 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(ExecutionSystem *graph, CompositorContext *context)
+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->setbNode(editorNode);
operation->setDistance(editorNode->custom2);
operation->setInset(editorNode->custom3);
+ converter.addOperation(operation);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+ converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
if (editorNode->custom3 < 2.0f) {
AntiAliasOperation *antiAlias = new AntiAliasOperation();
- addLink(graph, operation->getOutputSocket(), antiAlias->getInputSocket(0));
- this->getOutputSocket(0)->relinkConnections(antiAlias->getOutputSocket(0));
- graph->addOperation(antiAlias);
+ converter.addOperation(antiAlias);
+
+ converter.addLink(operation->getOutputSocket(), antiAlias->getInputSocket(0));
+ converter.mapOutputSocket(getOutputSocket(0), antiAlias->getOutputSocket(0));
}
else {
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
+ converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0));
}
- graph->addOperation(operation);
}
else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) {
if (editorNode->custom2 > 0) {
DilateDistanceOperation *operation = new DilateDistanceOperation();
- operation->setbNode(editorNode);
operation->setDistance(editorNode->custom2);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
+ converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0));
}
else {
ErodeDistanceOperation *operation = new ErodeDistanceOperation();
- operation->setbNode(editorNode);
operation->setDistance(-editorNode->custom2);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
+ 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();
-
- /* initialize node data */
- NodeBlurData *data = &this->m_alpha_blur;
- memset(data, 0, sizeof(*data));
- data->filtertype = R_FILTER_GAUSS;
-
- if (editorNode->custom2 > 0) {
- data->sizex = data->sizey = editorNode->custom2;
- }
- else {
- data->sizex = data->sizey = -editorNode->custom2;
-
- }
+ CompositorQuality quality = context.getQuality();
GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation();
- operationx->setbNode(editorNode);
- operationx->setData(data);
+ operationx->setData(&m_alpha_blur);
operationx->setQuality(quality);
operationx->setFalloff(PROP_SMOOTH);
- this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), 0, graph);
- // this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), 1, graph); // no size input yet
- graph->addOperation(operationx);
+ 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->setbNode(editorNode);
- operationy->setData(data);
+ operationy->setData(&m_alpha_blur);
operationy->setQuality(quality);
operationy->setFalloff(PROP_SMOOTH);
- this->getOutputSocket(0)->relinkConnections(operationy->getOutputSocket());
- graph->addOperation(operationy);
- addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
- // addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1)); // no size input yet
- addPreviewOperation(graph, context, operationy->getOutputSocket());
+ 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 */
@@ -133,19 +132,19 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
else {
if (editorNode->custom2 > 0) {
DilateStepOperation *operation = new DilateStepOperation();
- operation->setbNode(editorNode);
operation->setIterations(editorNode->custom2);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
+ converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0));
}
else {
ErodeStepOperation *operation = new ErodeStepOperation();
- operation->setbNode(editorNode);
operation->setIterations(-editorNode->custom2);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
+ 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 4b02042ffc9..b69592f7fc1 100644
--- a/source/blender/compositor/nodes/COM_DilateErodeNode.h
+++ b/source/blender/compositor/nodes/COM_DilateErodeNode.h
@@ -33,7 +33,7 @@ class DilateErodeNode : public Node {
NodeBlurData m_alpha_blur; /* only used for blurring alpha, since the dilate/erode node doesnt have this */
public:
DilateErodeNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 eb30f6952ba..3d95a462117 100644
--- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
@@ -30,14 +30,14 @@ DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void DirectionalBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void DirectionalBlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
NodeDBlurData *data = (NodeDBlurData *)this->getbNode()->storage;
DirectionalBlurOperation *operation = new DirectionalBlurOperation();
- operation->setQuality(context->getQuality());
+ operation->setQuality(context.getQuality());
operation->setData(data);
- operation->setbNode(this->getbNode());
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ 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 d387ecf81dc..8c806aa5437 100644
--- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h
+++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h
@@ -32,7 +32,7 @@
class DirectionalBlurNode : public Node {
public:
DirectionalBlurNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 41fbfd61981..ffbb85882d5 100644
--- a/source/blender/compositor/nodes/COM_DisplaceNode.cpp
+++ b/source/blender/compositor/nodes/COM_DisplaceNode.cpp
@@ -29,19 +29,18 @@ DisplaceNode::DisplaceNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void DisplaceNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void DisplaceNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
NodeOperation *operation;
- if (context->getQuality() == COM_QUALITY_LOW)
+ if (context.getQuality() == COM_QUALITY_LOW)
operation = new DisplaceSimpleOperation();
else
operation = new DisplaceOperation();
+ converter.addOperation(operation);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph);
- this->getInputSocket(3)->relinkConnections(operation->getInputSocket(3), 3, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
- graph->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());
}
diff --git a/source/blender/compositor/nodes/COM_DisplaceNode.h b/source/blender/compositor/nodes/COM_DisplaceNode.h
index af6afc25366..6eb894077fc 100644
--- a/source/blender/compositor/nodes/COM_DisplaceNode.h
+++ b/source/blender/compositor/nodes/COM_DisplaceNode.h
@@ -31,6 +31,6 @@
class DisplaceNode : public Node {
public:
DisplaceNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 3c532fe0b1d..704c704c500 100644
--- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
@@ -31,55 +31,58 @@ DistanceMatteNode::DistanceMatteNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void DistanceMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocketImage = this->getInputSocket(0);
- InputSocket *inputSocketKey = this->getInputSocket(1);
- OutputSocket *outputSocketImage = this->getOutputSocket(0);
- OutputSocket *outputSocketMatte = this->getOutputSocket(1);
-
- NodeOperation *operation;
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) {
- operation = new DistanceRGBMatteOperation();
- ((DistanceRGBMatteOperation *) operation)->setSettings(storage);
-
- inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
- inputSocketKey->relinkConnections(operation->getInputSocket(1), 1, graph);
+ 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 {
- operation = new DistanceYCCMatteOperation();
- ((DistanceYCCMatteOperation *) operation)->setSettings(storage);
-
+ DistanceYCCMatteOperation *matte = new DistanceYCCMatteOperation();
+ matte->setSettings(storage);
+ converter.addOperation(matte);
+
ConvertRGBToYCCOperation *operationYCCImage = new ConvertRGBToYCCOperation();
- inputSocketImage->relinkConnections(operationYCCImage->getInputSocket(0), 0, graph);
- addLink(graph, operationYCCImage->getOutputSocket(), operation->getInputSocket(0));
- graph->addOperation(operationYCCImage);
-
ConvertRGBToYCCOperation *operationYCCMatte = new ConvertRGBToYCCOperation();
- inputSocketKey->relinkConnections(operationYCCMatte->getInputSocket(0), 1, graph);
- addLink(graph, operationYCCMatte->getOutputSocket(), operation->getInputSocket(1));
- graph->addOperation(operationYCCMatte);
- }
-
- if (outputSocketMatte->isConnected()) {
- outputSocketMatte->relinkConnections(operation->getOutputSocket());
- }
-
- graph->addOperation(operation);
-
- SetAlphaOperation *operationAlpha = new SetAlphaOperation();
- addLink(graph, operation->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
- addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
-
- graph->addOperation(operationAlpha);
- addPreviewOperation(graph, context, operationAlpha->getOutputSocket());
-
- if (outputSocketImage->isConnected()) {
- outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
+ 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.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1));
+
+ converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket());
+ 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 46ceae7c4f4..e7a514b79c4 100644
--- a/source/blender/compositor/nodes/COM_DistanceMatteNode.h
+++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.h
@@ -31,7 +31,7 @@
class DistanceMatteNode : public Node {
public:
DistanceMatteNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* COM_DistanceMatteNODE_H */
diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp
index 40a9d1fa275..1f80eeadf83 100644
--- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp
@@ -29,18 +29,17 @@ DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void DoubleEdgeMaskNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
+void DoubleEdgeMaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
DoubleEdgeMaskOperation *operation;
bNode *bnode = this->getbNode();
operation = new DoubleEdgeMaskOperation();
- operation->setbNode(bnode);
operation->setAdjecentOnly(bnode->custom1);
operation->setKeepInside(bnode->custom2);
+ converter.addOperation(operation);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, system);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- system->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_DoubleEdgeMaskNode.h b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h
index ebcddc06b05..8e5f81e5ba5 100644
--- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h
+++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h
@@ -32,7 +32,7 @@
class DoubleEdgeMaskNode : public Node {
public:
DoubleEdgeMaskNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 fe0c85c173a..b0a45c4e2fc 100644
--- a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp
@@ -32,48 +32,42 @@ EllipseMaskNode::EllipseMaskNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void EllipseMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void EllipseMaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
+ NodeInput *inputSocket = this->getInputSocket(0);
+ NodeOutput *outputSocket = this->getOutputSocket(0);
+
EllipseMaskOperation *operation;
-
operation = new EllipseMaskOperation();
operation->setData((NodeEllipseMask *)this->getbNode()->storage);
-
- InputSocket *inputSocket = this->getInputSocket(0);
- OutputSocket *outputSocket = this->getOutputSocket(0);
-
- if (inputSocket->isConnected()) {
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- outputSocket->relinkConnections(operation->getOutputSocket());
+ 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);
- graph->addOperation(valueOperation);
+ converter.addOperation(valueOperation);
/* Scale that image up to render resolution */
- const RenderData *rd = context->getRenderData();
+ 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);
- addLink(graph, valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0));
- addLink(graph, scaleOperation->getOutputSocket(0), operation->getInputSocket(0));
- outputSocket->relinkConnections(operation->getOutputSocket(0));
-
- scaleOperation->getInputSocket(0)->getConnection()->setIgnoreResizeCheck(true);
-
- graph->addOperation(scaleOperation);
+ converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0));
+ converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0));
+ converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
}
-
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- operation->setMaskType(this->getbNode()->custom1);
- graph->addOperation(operation);
+ 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 3e534451b13..370f28f1ec2 100644
--- a/source/blender/compositor/nodes/COM_EllipseMaskNode.h
+++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.h
@@ -32,7 +32,7 @@
class EllipseMaskNode : public Node {
public:
EllipseMaskNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 3b75e3e0a1a..9f3a7ae795c 100644
--- a/source/blender/compositor/nodes/COM_FilterNode.cpp
+++ b/source/blender/compositor/nodes/COM_FilterNode.cpp
@@ -32,11 +32,11 @@ FilterNode::FilterNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void FilterNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- InputSocket *inputImageSocket = this->getInputSocket(1);
- OutputSocket *outputSocket = this->getOutputSocket(0);
+ NodeInput *inputSocket = this->getInputSocket(0);
+ NodeInput *inputImageSocket = this->getInputSocket(1);
+ NodeOutput *outputSocket = this->getOutputSocket(0);
ConvolutionFilterOperation *operation = NULL;
switch (this->getbNode()->custom1) {
@@ -73,11 +73,11 @@ void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
operation->set3x3Filter(0, 0, 0, 0, 1, 0, 0, 0, 0);
break;
}
- operation->setbNode(this->getbNode());
- inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
- inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph);
- outputSocket->relinkConnections(operation->getOutputSocket());
- addPreviewOperation(graph, context, operation->getOutputSocket(0));
+ converter.addOperation(operation);
- graph->addOperation(operation);
+ converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0));
+ converter.mapInputSocket(inputSocket, operation->getInputSocket(1));
+ converter.mapOutputSocket(outputSocket, operation->getOutputSocket());
+
+ converter.addPreview(operation->getOutputSocket(0));
}
diff --git a/source/blender/compositor/nodes/COM_FilterNode.h b/source/blender/compositor/nodes/COM_FilterNode.h
index 9be3bb02494..ef228c770de 100644
--- a/source/blender/compositor/nodes/COM_FilterNode.h
+++ b/source/blender/compositor/nodes/COM_FilterNode.h
@@ -32,7 +32,7 @@
class FilterNode : public Node {
public:
FilterNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* __COM_FILTERNODE_H__ */
diff --git a/source/blender/compositor/nodes/COM_FlipNode.cpp b/source/blender/compositor/nodes/COM_FlipNode.cpp
index a50297aae1a..1dbcc97143e 100644
--- a/source/blender/compositor/nodes/COM_FlipNode.cpp
+++ b/source/blender/compositor/nodes/COM_FlipNode.cpp
@@ -30,10 +30,10 @@ FlipNode::FlipNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void FlipNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void FlipNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- OutputSocket *outputSocket = this->getOutputSocket(0);
+ 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.
@@ -50,7 +50,7 @@ void FlipNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
break;
}
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
+ 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 1e372a80b57..3e7b2de4812 100644
--- a/source/blender/compositor/nodes/COM_FlipNode.h
+++ b/source/blender/compositor/nodes/COM_FlipNode.h
@@ -32,7 +32,7 @@
class FlipNode : public Node {
public:
FlipNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 33a5cb282a1..046cd9e9a0d 100644
--- a/source/blender/compositor/nodes/COM_GammaNode.cpp
+++ b/source/blender/compositor/nodes/COM_GammaNode.cpp
@@ -29,12 +29,12 @@ GammaNode::GammaNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void GammaNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void GammaNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
GammaOperation *operation = new GammaOperation();
+ converter.addOperation(operation);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- graph->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_GammaNode.h b/source/blender/compositor/nodes/COM_GammaNode.h
index d4e1f0abd5a..858d21cad9e 100644
--- a/source/blender/compositor/nodes/COM_GammaNode.h
+++ b/source/blender/compositor/nodes/COM_GammaNode.h
@@ -32,7 +32,7 @@
class GammaNode : public Node {
public:
GammaNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 a6a83846623..0429a1a80cf 100644
--- a/source/blender/compositor/nodes/COM_GlareNode.cpp
+++ b/source/blender/compositor/nodes/COM_GlareNode.cpp
@@ -36,15 +36,13 @@ GlareNode::GlareNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext *context) \
- {
+void GlareNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
+{
bNode *node = this->getbNode();
NodeGlare *glare = (NodeGlare *)node->storage;
GlareBaseOperation *glareoperation = NULL;
-
switch (glare->type) {
-
default:
case 3:
glareoperation = new GlareGhostOperation();
@@ -59,28 +57,30 @@ void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext *
glareoperation = new GlareSimpleStarOperation();
break;
}
+ BLI_assert(glareoperation);
+ glareoperation->setGlareSettings(glare);
+
GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation();
- SetValueOperation *mixvalueoperation = new SetValueOperation();
- MixGlareOperation *mixoperation = new MixGlareOperation();
- mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT);
- thresholdOperation->setbNode(node);
- glareoperation->setbNode(node);
-
- this->getInputSocket(0)->relinkConnections(thresholdOperation->getInputSocket(0), 0, system);
- addLink(system, thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0));
- addLink(system, mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0));
- addLink(system, glareoperation->getOutputSocket(), mixoperation->getInputSocket(2));
- addLink(system, thresholdOperation->getInputSocket(0)->getConnection()->getFromSocket(), mixoperation->getInputSocket(1));
- this->getOutputSocket()->relinkConnections(mixoperation->getOutputSocket());
-
thresholdOperation->setGlareSettings(glare);
- glareoperation->setGlareSettings(glare);
+
+ 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);
+
+ converter.addOperation(glareoperation);
+ converter.addOperation(thresholdOperation);
+ converter.addOperation(mixvalueoperation);
+ converter.addOperation(mixoperation);
- system->addOperation(glareoperation);
- system->addOperation(thresholdOperation);
- system->addOperation(mixvalueoperation);
- system->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());
+
+}
diff --git a/source/blender/compositor/nodes/COM_GlareNode.h b/source/blender/compositor/nodes/COM_GlareNode.h
index beb01db733a..1e19cc5510e 100644
--- a/source/blender/compositor/nodes/COM_GlareNode.h
+++ b/source/blender/compositor/nodes/COM_GlareNode.h
@@ -32,7 +32,7 @@
class GlareNode : public Node {
public:
GlareNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif
diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp
deleted file mode 100644
index 7c0499dc04e..00000000000
--- a/source/blender/compositor/nodes/COM_GroupNode.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#include "BKE_node.h"
-
-#include "COM_GroupNode.h"
-#include "COM_SocketProxyNode.h"
-#include "COM_SetColorOperation.h"
-#include "COM_ExecutionSystemHelper.h"
-#include "COM_SetValueOperation.h"
-#include "COM_SetVectorOperation.h"
-#include "COM_SetColorOperation.h"
-
-extern "C" {
-#include "RNA_access.h"
-}
-
-GroupNode::GroupNode(bNode *editorNode) : Node(editorNode)
-{
- /* pass */
-}
-
-void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
-{
- if (this->getbNode()->id == NULL) {
- convertToOperations_invalid(graph, context);
- }
-}
-
-static int find_group_input(GroupNode *gnode, const char *identifier, InputSocket **r_sock)
-{
- int index;
- for (index = 0; index < gnode->getNumberOfInputSockets(); ++index) {
- InputSocket *sock = gnode->getInputSocket(index);
- if (STREQ(sock->getbNodeSocket()->identifier, identifier)) {
- *r_sock = sock;
- return index;
- }
- }
- *r_sock = NULL;
- return -1;
-}
-
-static int find_group_output(GroupNode *gnode, const char *identifier, OutputSocket **r_sock)
-{
- int index;
- for (index = 0; index < gnode->getNumberOfOutputSockets(); ++index) {
- OutputSocket *sock = gnode->getOutputSocket(index);
- if (STREQ(sock->getbNodeSocket()->identifier, identifier)) {
- *r_sock = sock;
- return index;
- }
- }
- *r_sock = NULL;
- return -1;
-}
-
-void GroupNode::ungroup(ExecutionSystem &system)
-{
- bNode *bnode = this->getbNode();
- bNodeTree *subtree = (bNodeTree *)bnode->id;
-
- /* get the node list size _before_ adding proxy nodes, so they are available for linking */
- int nodes_start = system.getNodes().size();
-
- /* missing node group datablock can happen with library linking */
- if (!subtree) {
- /* this error case its handled in convertToOperations() so we don't get un-convertred sockets */
- return;
- }
-
- const bool groupnodeBuffering = system.getContext().isGroupnodeBufferEnabled();
-
- bool has_output = false;
- /* create proxy nodes for group input/output nodes */
- for (bNode *bionode = (bNode *)subtree->nodes.first; bionode; bionode = bionode->next) {
- if (bionode->type == NODE_GROUP_INPUT) {
- for (bNodeSocket *bsock = (bNodeSocket *)bionode->outputs.first; bsock; bsock = bsock->next) {
- InputSocket *gsock;
- int gsock_index = find_group_input(this, bsock->identifier, &gsock);
- /* ignore virtual sockets */
- if (gsock) {
- SocketProxyNode *proxy = new SocketProxyNode(bionode, gsock->getbNodeSocket(), bsock, false);
- ExecutionSystemHelper::addNode(system.getNodes(), proxy);
-
- gsock->relinkConnectionsDuplicate(proxy->getInputSocket(0), gsock_index, &system);
- }
- }
- }
-
- if (bionode->type == NODE_GROUP_OUTPUT && (bionode->flag & NODE_DO_OUTPUT)) {
- has_output = true;
- for (bNodeSocket *bsock = (bNodeSocket *)bionode->inputs.first; bsock; bsock = bsock->next) {
- OutputSocket *gsock;
- find_group_output(this, bsock->identifier, &gsock);
- /* ignore virtual sockets */
- if (gsock) {
- SocketProxyNode *proxy = new SocketProxyNode(bionode, bsock, gsock->getbNodeSocket(), groupnodeBuffering);
- ExecutionSystemHelper::addNode(system.getNodes(), proxy);
-
- gsock->relinkConnections(proxy->getOutputSocket(0));
- }
- }
- }
- }
-
- /* in case no output node exists, add input value operations using defaults */
- if (!has_output) {
- for (int index = 0; index < getNumberOfOutputSockets(); ++index) {
- OutputSocket *output = getOutputSocket(index);
- addDefaultOutputOperation(system, output);
- }
- }
-
- /* unlink the group node itself, input links have been duplicated */
- for (int index = 0; index < this->getNumberOfInputSockets(); ++index) {
- InputSocket *sock = this->getInputSocket(index);
- sock->unlinkConnections(&system);
- }
- for (int index = 0; index < this->getNumberOfOutputSockets(); ++index) {
- OutputSocket *sock = this->getOutputSocket(index);
- sock->clearConnections();
- }
-
- ExecutionSystemHelper::addbNodeTree(system, nodes_start, subtree, this->getInstanceKey());
-}
-
-bNodeSocket *GroupNode::findInterfaceInput(InputSocket *socket)
-{
- bNode *bnode = this->getbNode();
- bNodeTree *subtree = (bNodeTree *)bnode->id;
- if (!subtree)
- return NULL;
-
- const char *identifier = socket->getbNodeSocket()->identifier;
- for (bNodeSocket *iosock = (bNodeSocket *)subtree->inputs.first; iosock; iosock = iosock->next)
- if (STREQ(iosock->identifier, identifier))
- return iosock;
- return NULL;
-}
-
-bNodeSocket *GroupNode::findInterfaceOutput(OutputSocket *socket)
-{
- bNode *bnode = this->getbNode();
- bNodeTree *subtree = (bNodeTree *)bnode->id;
- if (!subtree)
- return NULL;
-
- const char *identifier = socket->getbNodeSocket()->identifier;
- for (bNodeSocket *iosock = (bNodeSocket *)subtree->outputs.first; iosock; iosock = iosock->next)
- if (STREQ(iosock->identifier, identifier))
- return iosock;
- return NULL;
-}
-
-void GroupNode::addDefaultOutputOperation(ExecutionSystem &system, OutputSocket *outputsocket)
-{
- bNodeSocket *iosock = findInterfaceOutput(outputsocket);
- if (!iosock)
- return;
-
- PointerRNA ptr;
- RNA_pointer_create(&getbNodeTree()->id, &RNA_NodeSocket, iosock, &ptr);
-
- NodeOperation *operation = NULL;
- switch (iosock->typeinfo->type) {
- case SOCK_FLOAT:
- {
- float value = RNA_float_get(&ptr, "default_value");
- SetValueOperation *value_op = new SetValueOperation();
- value_op->setValue(value);
- operation = value_op;
- break;
- }
- case SOCK_VECTOR:
- {
- float vector[3];
- RNA_float_get_array(&ptr, "default_value", vector);
- SetVectorOperation *vector_op = new SetVectorOperation();
- vector_op->setVector(vector);
- operation = vector_op;
- break;
- }
- case SOCK_RGBA:
- {
- float color[4];
- RNA_float_get_array(&ptr, "default_value", color);
- SetColorOperation *color_op = new SetColorOperation();
- color_op->setChannels(color);
- operation = color_op;
- break;
- }
- }
-
- outputsocket->relinkConnections(operation->getOutputSocket());
- system.addOperation(operation);
-}
diff --git a/source/blender/compositor/nodes/COM_GroupNode.h b/source/blender/compositor/nodes/COM_GroupNode.h
deleted file mode 100644
index 02b63fe27e3..00000000000
--- a/source/blender/compositor/nodes/COM_GroupNode.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#ifndef _COM_GroupNode_h_
-#define _COM_GroupNode_h_
-
-#include "COM_Node.h"
-#include "COM_ExecutionSystem.h"
-
-/**
- * @brief Represents a group node
- * @ingroup Node
- */
-class GroupNode : public Node {
-public:
- GroupNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
-
- /**
- * @brief check if this node a group node.
- * @returns true
- */
- bool isGroupNode() const { return true; }
-
- /**
- * @brief ungroup this group node.
- * during ungroup the subtree (internal nodes and links) of the group node
- * are added to the ExecutionSystem.
- *
- * Between the main tree and the subtree proxy nodes will be added
- * to translate between InputSocket and OutputSocket
- *
- * @param system the ExecutionSystem where to add the subtree
- */
- void ungroup(ExecutionSystem &system);
-
- bNodeSocket *findInterfaceInput(InputSocket *socket);
- bNodeSocket *findInterfaceOutput(OutputSocket *socket);
- void addDefaultOutputOperation(ExecutionSystem &system, OutputSocket *outputsocket);
-};
-
-#endif
diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp
index 66b98b29d5e..003bc91edd3 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp
@@ -36,33 +36,33 @@ HueSaturationValueCorrectNode::HueSaturationValueCorrectNode(bNode *editorNode)
/* pass */
}
-void HueSaturationValueCorrectNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void HueSaturationValueCorrectNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *valueSocket = this->getInputSocket(0);
- InputSocket *colorSocket = this->getInputSocket(1);
- OutputSocket *outputSocket = this->getOutputSocket(0);
+ 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();
- MixBlendOperation *blend = new MixBlendOperation();
-
- colorSocket->relinkConnections(rgbToHSV->getInputSocket(0), 1, graph);
- addLink(graph, rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0));
- addLink(graph, changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0));
- addLink(graph, hsvToRGB->getOutputSocket(), blend->getInputSocket(2));
- addLink(graph, rgbToHSV->getInputSocket(0)->getConnection()->getFromSocket(), blend->getInputSocket(1));
- valueSocket->relinkConnections(blend->getInputSocket(0), 0, graph);
- outputSocket->relinkConnections(blend->getOutputSocket());
-
changeHSV->setCurveMapping(storage);
-
+ converter.addOperation(changeHSV);
+
+ MixBlendOperation *blend = new MixBlendOperation();
blend->setResolutionInputSocketIndex(1);
+ converter.addOperation(blend);
- graph->addOperation(rgbToHSV);
- graph->addOperation(hsvToRGB);
- graph->addOperation(changeHSV);
- graph->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 dd5f70f6579..099ea3d11ce 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h
@@ -32,6 +32,6 @@
class HueSaturationValueCorrectNode : public Node {
public:
HueSaturationValueCorrectNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 5001433513c..cdec1250c6e 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
@@ -35,35 +35,35 @@ HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode) : Node(editorN
/* pass */
}
-void HueSaturationValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void HueSaturationValueNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *valueSocket = this->getInputSocket(0);
- InputSocket *colorSocket = this->getInputSocket(1);
- OutputSocket *outputSocket = this->getOutputSocket(0);
+ NodeInput *valueSocket = this->getInputSocket(0);
+ NodeInput *colorSocket = this->getInputSocket(1);
+ NodeOutput *outputSocket = this->getOutputSocket(0);
bNode *editorsnode = getbNode();
NodeHueSat *storage = (NodeHueSat *)editorsnode->storage;
ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation();
+ converter.addOperation(rgbToHSV);
+
ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation();
+ converter.addOperation(hsvToRGB);
+
ChangeHSVOperation *changeHSV = new ChangeHSVOperation();
- MixBlendOperation *blend = new MixBlendOperation();
-
- colorSocket->relinkConnections(rgbToHSV->getInputSocket(0), 1, graph);
- addLink(graph, rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0));
- addLink(graph, changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0));
- addLink(graph, hsvToRGB->getOutputSocket(), blend->getInputSocket(2));
- addLink(graph, rgbToHSV->getInputSocket(0)->getConnection()->getFromSocket(), blend->getInputSocket(1));
- valueSocket->relinkConnections(blend->getInputSocket(0), 0, graph);
- outputSocket->relinkConnections(blend->getOutputSocket());
-
changeHSV->setHue(storage->hue);
changeHSV->setSaturation(storage->sat);
changeHSV->setValue(storage->val);
-
+ converter.addOperation(changeHSV);
+
+ MixBlendOperation *blend = new MixBlendOperation();
blend->setResolutionInputSocketIndex(1);
+ converter.addOperation(blend);
- graph->addOperation(rgbToHSV);
- graph->addOperation(hsvToRGB);
- graph->addOperation(changeHSV);
- graph->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_HueSaturationValueNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h
index 47b89a35269..a599781a3b1 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h
@@ -32,6 +32,6 @@
class HueSaturationValueNode : public Node {
public:
HueSaturationValueNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 12a508c75f5..2c16616dc59 100644
--- a/source/blender/compositor/nodes/COM_IDMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_IDMaskNode.cpp
@@ -29,23 +29,24 @@ IDMaskNode::IDMaskNode(bNode *editorNode) : Node(editorNode)
{
/* pass */
}
-void IDMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void IDMaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *bnode = this->getbNode();
+
IDMaskOperation *operation;
operation = new IDMaskOperation();
operation->setObjectIndex(bnode->custom1);
+ converter.addOperation(operation);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- if (bnode->custom2 == 0 || context->getRenderData()->scemode & R_FULL_SAMPLE) {
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
+ 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();
- addLink(graph, operation->getOutputSocket(), antiAliasOperation->getInputSocket(0));
- this->getOutputSocket(0)->relinkConnections(antiAliasOperation->getOutputSocket(0));
- graph->addOperation(antiAliasOperation);
+ converter.addOperation(antiAliasOperation);
+
+ converter.addLink(operation->getOutputSocket(), antiAliasOperation->getInputSocket(0));
+ converter.mapOutputSocket(getOutputSocket(0), antiAliasOperation->getOutputSocket(0));
}
- graph->addOperation(operation);
-
}
diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.h b/source/blender/compositor/nodes/COM_IDMaskNode.h
index 9fd52be2120..a549a3e6ef8 100644
--- a/source/blender/compositor/nodes/COM_IDMaskNode.h
+++ b/source/blender/compositor/nodes/COM_IDMaskNode.h
@@ -32,7 +32,7 @@
class IDMaskNode : public Node {
public:
IDMaskNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 5571a186333..e105f530eb2 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -38,9 +38,10 @@ ImageNode::ImageNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-NodeOperation *ImageNode::doMultilayerCheck(ExecutionSystem *system, RenderLayer *rl, Image *image, ImageUser *user, int framenumber, int outputsocketIndex, int passindex, DataType datatype)
+NodeOperation *ImageNode::doMultilayerCheck(NodeConverter &converter, RenderLayer *rl, Image *image, ImageUser *user,
+ int framenumber, int outputsocketIndex, int passindex, DataType datatype) const
{
- OutputSocket *outputSocket = this->getOutputSocket(outputsocketIndex);
+ NodeOutput *outputSocket = this->getOutputSocket(outputsocketIndex);
MultilayerBaseOperation *operation = NULL;
switch (datatype) {
case COM_DT_VALUE:
@@ -59,22 +60,24 @@ NodeOperation *ImageNode::doMultilayerCheck(ExecutionSystem *system, RenderLayer
operation->setRenderLayer(rl);
operation->setImageUser(user);
operation->setFramenumber(framenumber);
- outputSocket->relinkConnections(operation->getOutputSocket());
- system->addOperation(operation);
+
+ converter.addOperation(operation);
+ converter.mapOutputSocket(outputSocket, operation->getOutputSocket());
+
return operation;
}
-void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ImageNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
/// Image output
- OutputSocket *outputImage = this->getOutputSocket(0);
+ NodeOutput *outputImage = this->getOutputSocket(0);
bNode *editorNode = this->getbNode();
Image *image = (Image *)editorNode->id;
ImageUser *imageuser = (ImageUser *)editorNode->storage;
- int framenumber = context->getFramenumber();
+ 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(), 0);
+ BKE_image_user_frame_calc(imageuser, context.getFramenumber(), 0);
/* force a load, we assume iuser index will be set OK anyway */
if (image && image->type == IMA_TYPE_MULTILAYER) {
@@ -83,7 +86,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
if (image->rr) {
RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
if (rl) {
- OutputSocket *socket;
+ NodeOutput *socket;
int index;
is_multilayer_ok = true;
@@ -91,50 +94,47 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
for (index = 0; index < numberOfOutputs; index++) {
NodeOperation *operation = NULL;
socket = this->getOutputSocket(index);
- if (socket->isConnected() || index == 0) {
- bNodeSocket *bnodeSocket = socket->getbNodeSocket();
- /* Passes in the file can differ from passes stored in sockets (#36755).
- * Look up the correct file pass using the socket identifier instead.
- */
+ bNodeSocket *bnodeSocket = socket->getbNodeSocket();
+ /* Passes in the file can differ from passes stored in sockets (#36755).
+ * Look up the correct file pass using the socket identifier instead.
+ */
#if 0
- NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;*/
- int passindex = storage->pass_index;*/
- RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
+ NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;*/
+ int passindex = storage->pass_index;*/
+ RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
#endif
- int passindex;
- RenderPass *rpass;
- for (rpass = (RenderPass *)rl->passes.first, passindex = 0; rpass; rpass = rpass->next, ++passindex)
- if (STREQ(rpass->name, bnodeSocket->identifier))
+ int passindex;
+ RenderPass *rpass;
+ for (rpass = (RenderPass *)rl->passes.first, passindex = 0; rpass; rpass = rpass->next, ++passindex)
+ if (STREQ(rpass->name, bnodeSocket->identifier))
+ break;
+ if (rpass) {
+ imageuser->pass = passindex;
+ switch (rpass->channels) {
+ case 1:
+ operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index, passindex, COM_DT_VALUE);
break;
- if (rpass) {
- imageuser->pass = passindex;
- switch (rpass->channels) {
- case 1:
- operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, 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(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VECTOR);
- break;
- case 4:
- operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
- break;
- default:
- /* dummy operation is added below */
- break;
- }
-
- if (index == 0 && operation) {
- addPreviewOperation(graph, context, operation->getOutputSocket());
- }
+ case 3:
+ operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index, passindex, COM_DT_VECTOR);
+ break;
+ case 4:
+ operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
+ break;
+ default:
+ /* dummy operation is added below */
+ break;
+ }
+
+ if (index == 0 && operation) {
+ converter.addPreview(operation->getOutputSocket());
}
}
-
+
/* incase we can't load the layer */
- if (operation == NULL) {
- convertToOperations_invalid_index(graph, index);
- }
+ if (operation == NULL)
+ converter.setInvalidOutput(getOutputSocket(index));
}
}
}
@@ -142,66 +142,56 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
/* without this, multilayer that fail to load will crash blender [#32490] */
if (is_multilayer_ok == false) {
- int index;
- vector<OutputSocket *> &outputsockets = this->getOutputSockets();
- for (index = 0; index < outputsockets.size(); index++) {
- const float warning_color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
- SetColorOperation *operation = new SetColorOperation();
- operation->setChannels(warning_color);
-
- /* link the operation */
- this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
- graph->addOperation(operation);
- }
+ for (int i = 0; i < getNumberOfOutputSockets(); ++i)
+ converter.setInvalidOutput(getOutputSocket(i));
}
}
else {
if (numberOfOutputs > 0) {
ImageOperation *operation = new ImageOperation();
- if (outputImage->isConnected()) {
- if (outputStraightAlpha) {
- NodeOperation *alphaConvertOperation = new ConvertPremulToStraightOperation();
- addLink(graph, operation->getOutputSocket(0), alphaConvertOperation->getInputSocket(0));
- outputImage->relinkConnections(alphaConvertOperation->getOutputSocket());
- graph->addOperation(alphaConvertOperation);
- }
- else {
- outputImage->relinkConnections(operation->getOutputSocket());
- }
- }
operation->setImage(image);
operation->setImageUser(imageuser);
operation->setFramenumber(framenumber);
- graph->addOperation(operation);
- addPreviewOperation(graph, context, operation->getOutputSocket());
+ converter.addOperation(operation);
+
+ 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.addPreview(operation->getOutputSocket());
}
if (numberOfOutputs > 1) {
- OutputSocket *alphaImage = this->getOutputSocket(1);
- if (alphaImage->isConnected()) {
- ImageAlphaOperation *alphaOperation = new ImageAlphaOperation();
- alphaOperation->setImage(image);
- alphaOperation->setImageUser(imageuser);
- alphaOperation->setFramenumber(framenumber);
- alphaImage->relinkConnections(alphaOperation->getOutputSocket());
- graph->addOperation(alphaOperation);
- }
+ NodeOutput *alphaImage = this->getOutputSocket(1);
+ ImageAlphaOperation *alphaOperation = new ImageAlphaOperation();
+ alphaOperation->setImage(image);
+ alphaOperation->setImageUser(imageuser);
+ alphaOperation->setFramenumber(framenumber);
+ converter.addOperation(alphaOperation);
+
+ converter.mapOutputSocket(alphaImage, alphaOperation->getOutputSocket());
}
if (numberOfOutputs > 2) {
- OutputSocket *depthImage = this->getOutputSocket(2);
- if (depthImage->isConnected()) {
- ImageDepthOperation *depthOperation = new ImageDepthOperation();
- depthOperation->setImage(image);
- depthOperation->setImageUser(imageuser);
- depthOperation->setFramenumber(framenumber);
- depthImage->relinkConnections(depthOperation->getOutputSocket());
- graph->addOperation(depthOperation);
- }
+ NodeOutput *depthImage = this->getOutputSocket(2);
+ ImageDepthOperation *depthOperation = new ImageDepthOperation();
+ depthOperation->setImage(image);
+ depthOperation->setImageUser(imageuser);
+ depthOperation->setFramenumber(framenumber);
+ 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++) {
- OutputSocket *output = this->getOutputSocket(i);
+ NodeOutput *output = this->getOutputSocket(i);
NodeOperation *operation = NULL;
switch (output->getDataType()) {
case COM_DT_VALUE:
@@ -233,8 +223,8 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
}
if (operation) {
- output->relinkConnections(operation->getOutputSocket());
- graph->addOperation(operation);
+ 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 c8d53b405a0..1daa39a2a1f 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.h
+++ b/source/blender/compositor/nodes/COM_ImageNode.h
@@ -35,9 +35,10 @@ extern "C" {
*/
class ImageNode : public Node {
private:
- NodeOperation *doMultilayerCheck(ExecutionSystem *system, RenderLayer *rl, Image *image, ImageUser *user, int framenumber, int outputsocketIndex, int passindex, DataType datatype);
+ NodeOperation *doMultilayerCheck(NodeConverter &converter, RenderLayer *rl, Image *image, ImageUser *user,
+ int framenumber, int outputsocketIndex, int passindex, DataType datatype) const;
public:
ImageNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 e90a3921edc..1371cdb5f1d 100644
--- a/source/blender/compositor/nodes/COM_InpaintNode.cpp
+++ b/source/blender/compositor/nodes/COM_InpaintNode.cpp
@@ -31,7 +31,7 @@ InpaintNode::InpaintNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void InpaintNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void InpaintNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *editorNode = this->getbNode();
@@ -39,10 +39,10 @@ void InpaintNode::convertToOperations(ExecutionSystem *graph, CompositorContext
/* if (editorNode->custom1 == CMP_NODE_INPAINT_SIMPLE) { */
if (true) {
InpaintSimpleOperation *operation = new InpaintSimpleOperation();
- operation->setbNode(editorNode);
operation->setIterations(editorNode->custom2);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
+ 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_InpaintNode.h b/source/blender/compositor/nodes/COM_InpaintNode.h
index 5837b979958..c5ef1c0549e 100644
--- a/source/blender/compositor/nodes/COM_InpaintNode.h
+++ b/source/blender/compositor/nodes/COM_InpaintNode.h
@@ -32,7 +32,7 @@
class InpaintNode : public Node {
public:
InpaintNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 9c4e28a2971..ed4a21132ca 100644
--- a/source/blender/compositor/nodes/COM_InvertNode.cpp
+++ b/source/blender/compositor/nodes/COM_InvertNode.cpp
@@ -30,15 +30,15 @@ InvertNode::InvertNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void InvertNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+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);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- graph->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_InvertNode.h b/source/blender/compositor/nodes/COM_InvertNode.h
index d061f1c12bd..27f3da6cdca 100644
--- a/source/blender/compositor/nodes/COM_InvertNode.h
+++ b/source/blender/compositor/nodes/COM_InvertNode.h
@@ -32,7 +32,7 @@
class InvertNode : public Node {
public:
InvertNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 786530bd3c4..e896b7144e5 100644
--- a/source/blender/compositor/nodes/COM_KeyingNode.cpp
+++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp
@@ -47,83 +47,74 @@ KeyingNode::KeyingNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-OutputSocket *KeyingNode::setupPreBlur(ExecutionSystem *graph, InputSocket *inputImage, int size, OutputSocket **originalImage)
+NodeOperationOutput *KeyingNode::setupPreBlur(NodeConverter &converter, NodeInput *inputImage, int size) const
{
ConvertRGBToYCCOperation *convertRGBToYCCOperation = new ConvertRGBToYCCOperation();
convertRGBToYCCOperation->setMode(0); /* ITU 601 */
-
- inputImage->relinkConnections(convertRGBToYCCOperation->getInputSocket(0), 0, graph);
- graph->addOperation(convertRGBToYCCOperation);
-
+ converter.addOperation(convertRGBToYCCOperation);
+
+ converter.mapInputSocket(inputImage, convertRGBToYCCOperation->getInputSocket(0));
+
CombineChannelsOperation *combineOperation = new CombineChannelsOperation();
- graph->addOperation(combineOperation);
+ converter.addOperation(combineOperation);
for (int channel = 0; channel < 4; channel++) {
SeparateChannelOperation *separateOperation = new SeparateChannelOperation();
separateOperation->setChannel(channel);
- addLink(graph, convertRGBToYCCOperation->getOutputSocket(0), separateOperation->getInputSocket(0));
- graph->addOperation(separateOperation);
-
+ converter.addOperation(separateOperation);
+
+ converter.addLink(convertRGBToYCCOperation->getOutputSocket(0), separateOperation->getInputSocket(0));
+
if (channel == 0 || channel == 3) {
- addLink(graph, separateOperation->getOutputSocket(0), combineOperation->getInputSocket(channel));
+ converter.addLink(separateOperation->getOutputSocket(0), combineOperation->getInputSocket(channel));
}
else {
KeyingBlurOperation *blurXOperation = new KeyingBlurOperation();
- KeyingBlurOperation *blurYOperation = new KeyingBlurOperation();
-
blurXOperation->setSize(size);
blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X);
- blurXOperation->setbNode(this->getbNode());
-
+ converter.addOperation(blurXOperation);
+
+ KeyingBlurOperation *blurYOperation = new KeyingBlurOperation();
blurYOperation->setSize(size);
blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y);
- blurYOperation->setbNode(this->getbNode());
-
- addLink(graph, separateOperation->getOutputSocket(), blurXOperation->getInputSocket(0));
- addLink(graph, blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0));
- addLink(graph, blurYOperation->getOutputSocket(0), combineOperation->getInputSocket(channel));
-
- graph->addOperation(blurXOperation);
- graph->addOperation(blurYOperation);
+ 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(0); /* ITU 601 */
- addLink(graph, combineOperation->getOutputSocket(0), convertYCCToRGBOperation->getInputSocket(0));
- graph->addOperation(convertYCCToRGBOperation);
-
- *originalImage = convertRGBToYCCOperation->getInputSocket(0)->getConnection()->getFromSocket();
-
+ converter.addOperation(convertYCCToRGBOperation);
+
+ converter.addLink(combineOperation->getOutputSocket(0), convertYCCToRGBOperation->getInputSocket(0));
+
return convertYCCToRGBOperation->getOutputSocket(0);
}
-OutputSocket *KeyingNode::setupPostBlur(ExecutionSystem *graph, OutputSocket *postBlurInput, int size)
+NodeOperationOutput *KeyingNode::setupPostBlur(NodeConverter &converter, NodeOperationOutput *postBlurInput, int size) const
{
KeyingBlurOperation *blurXOperation = new KeyingBlurOperation();
- KeyingBlurOperation *blurYOperation = new KeyingBlurOperation();
-
blurXOperation->setSize(size);
blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X);
- blurXOperation->setbNode(this->getbNode());
-
+ converter.addOperation(blurXOperation);
+
+ KeyingBlurOperation *blurYOperation = new KeyingBlurOperation();
blurYOperation->setSize(size);
blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y);
- blurYOperation->setbNode(this->getbNode());
-
- addLink(graph, postBlurInput, blurXOperation->getInputSocket(0));
- addLink(graph, blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0));
-
- graph->addOperation(blurXOperation);
- graph->addOperation(blurYOperation);
-
+ converter.addOperation(blurYOperation);
+
+ converter.addLink(postBlurInput, blurXOperation->getInputSocket(0));
+ converter.addLink(blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0));
+
return blurYOperation->getOutputSocket();
}
-OutputSocket *KeyingNode::setupDilateErode(ExecutionSystem *graph, OutputSocket *dilateErodeInput, int distance)
+NodeOperationOutput *KeyingNode::setupDilateErode(NodeConverter &converter, NodeOperationOutput *dilateErodeInput, int distance) const
{
DilateDistanceOperation *dilateErodeOperation;
-
if (distance > 0) {
dilateErodeOperation = new DilateDistanceOperation();
dilateErodeOperation->setDistance(distance);
@@ -132,211 +123,194 @@ OutputSocket *KeyingNode::setupDilateErode(ExecutionSystem *graph, OutputSocket
dilateErodeOperation = new ErodeDistanceOperation();
dilateErodeOperation->setDistance(-distance);
}
- dilateErodeOperation->setbNode(this->getbNode());
-
- addLink(graph, dilateErodeInput, dilateErodeOperation->getInputSocket(0));
-
- graph->addOperation(dilateErodeOperation);
-
+ converter.addOperation(dilateErodeOperation);
+
+ converter.addLink(dilateErodeInput, dilateErodeOperation->getInputSocket(0));
+
return dilateErodeOperation->getOutputSocket(0);
}
-OutputSocket *KeyingNode::setupFeather(ExecutionSystem *graph, CompositorContext *context,
- OutputSocket *featherInput, int falloff, int distance)
+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();
+ CompositorQuality quality = context.getQuality();
/* initialize node data */
- NodeBlurData *data = &this->m_alpha_blur;
- memset(data, 0, sizeof(*data));
- data->filtertype = R_FILTER_GAUSS;
-
+ NodeBlurData data;
+ memset(&data, 0, sizeof(NodeBlurData));
+ data.filtertype = R_FILTER_GAUSS;
if (distance > 0) {
- data->sizex = data->sizey = distance;
+ data.sizex = data.sizey = distance;
}
else {
- data->sizex = data->sizey = -distance;
+ data.sizex = data.sizey = -distance;
}
GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation();
- operationx->setData(data);
+ operationx->setData(&data);
operationx->setQuality(quality);
operationx->setSize(1.0f);
operationx->setSubtract(distance < 0);
operationx->setFalloff(falloff);
- operationx->setbNode(this->getbNode());
- graph->addOperation(operationx);
+ converter.addOperation(operationx);
GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation();
- operationy->setData(data);
+ operationy->setData(&data);
operationy->setQuality(quality);
operationy->setSize(1.0f);
operationy->setSubtract(distance < 0);
operationy->setFalloff(falloff);
- operationy->setbNode(this->getbNode());
- graph->addOperation(operationy);
+ converter.addOperation(operationy);
- addLink(graph, featherInput, operationx->getInputSocket(0));
- addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
+ converter.addLink(featherInput, operationx->getInputSocket(0));
+ converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0));
return operationy->getOutputSocket();
}
-OutputSocket *KeyingNode::setupDespill(ExecutionSystem *graph, OutputSocket *despillInput, OutputSocket *inputScreen,
- float factor, float colorBalance)
+NodeOperationOutput *KeyingNode::setupDespill(NodeConverter &converter, NodeOperationOutput *despillInput, NodeInput *inputScreen,
+ float factor, float colorBalance) const
{
KeyingDespillOperation *despillOperation = new KeyingDespillOperation();
-
despillOperation->setDespillFactor(factor);
despillOperation->setColorBalance(colorBalance);
-
- addLink(graph, despillInput, despillOperation->getInputSocket(0));
- addLink(graph, inputScreen, despillOperation->getInputSocket(1));
-
- graph->addOperation(despillOperation);
-
+ converter.addOperation(despillOperation);
+
+ converter.addLink(despillInput, despillOperation->getInputSocket(0));
+ converter.mapInputSocket(inputScreen, despillOperation->getInputSocket(1));
+
return despillOperation->getOutputSocket(0);
}
-OutputSocket *KeyingNode::setupClip(ExecutionSystem *graph, OutputSocket *clipInput, int kernelRadius, float kernelTolerance,
- float clipBlack, float clipWhite, bool edgeMatte)
+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);
-
- addLink(graph, clipInput, clipOperation->getInputSocket(0));
-
- graph->addOperation(clipOperation);
-
+ converter.addOperation(clipOperation);
+
+ converter.addLink(clipInput, clipOperation->getInputSocket(0));
+
return clipOperation->getOutputSocket(0);
}
-void KeyingNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void KeyingNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputImage = this->getInputSocket(0);
- InputSocket *inputScreen = this->getInputSocket(1);
- InputSocket *inputGarbageMatte = this->getInputSocket(2);
- InputSocket *inputCoreMatte = this->getInputSocket(3);
- OutputSocket *outputImage = this->getOutputSocket(0);
- OutputSocket *outputMatte = this->getOutputSocket(1);
- OutputSocket *outputEdges = this->getOutputSocket(2);
- OutputSocket *postprocessedMatte = NULL, *postprocessedImage = NULL, *originalImage = NULL, *edgesMatte = NULL;
-
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);
-
- inputScreen->relinkConnections(keyingOperation->getInputSocket(1), 1, graph);
-
+ converter.addOperation(keyingOperation);
+
+ converter.mapInputSocket(inputScreen, keyingOperation->getInputSocket(1));
+
if (keying_data->blur_pre) {
/* chroma preblur operation for input of keying operation */
- OutputSocket *preBluredImage = setupPreBlur(graph, inputImage, keying_data->blur_pre, &originalImage);
- addLink(graph, preBluredImage, keyingOperation->getInputSocket(0));
+ NodeOperationOutput *preBluredImage = setupPreBlur(converter, inputImage, keying_data->blur_pre);
+ converter.addLink(preBluredImage, keyingOperation->getInputSocket(0));
}
else {
- inputImage->relinkConnections(keyingOperation->getInputSocket(0), 0, graph);
- originalImage = keyingOperation->getInputSocket(0)->getConnection()->getFromSocket();
+ converter.mapInputSocket(inputImage, keyingOperation->getInputSocket(0));
}
-
- graph->addOperation(keyingOperation);
-
+
postprocessedMatte = keyingOperation->getOutputSocket();
-
+
/* black / white clipping */
if (keying_data->clip_black > 0.0f || keying_data->clip_white < 1.0f) {
- postprocessedMatte = setupClip(graph, postprocessedMatte,
+ 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 */
- if (outputEdges->isConnected()) {
- edgesMatte = setupClip(graph, postprocessedMatte,
- keying_data->edge_kernel_radius, keying_data->edge_kernel_tolerance,
- keying_data->clip_black, keying_data->clip_white, true);
- }
-
+ 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->isConnected()) {
+ 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();
-
- valueOperation->setValue(1.0f);
-
- addLink(graph, valueOperation->getOutputSocket(), subtractOperation->getInputSocket(0));
- inputGarbageMatte->relinkConnections(subtractOperation->getInputSocket(1), 0, graph);
-
- addLink(graph, subtractOperation->getOutputSocket(), minOperation->getInputSocket(0));
- addLink(graph, postprocessedMatte, minOperation->getInputSocket(1));
-
+ 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();
-
- graph->addOperation(valueOperation);
- graph->addOperation(subtractOperation);
- graph->addOperation(minOperation);
}
-
+
/* apply core matte */
- if (inputCoreMatte->isConnected()) {
+ if (inputCoreMatte->isLinked()) {
MathMaximumOperation *maxOperation = new MathMaximumOperation();
-
- inputCoreMatte->relinkConnections(maxOperation->getInputSocket(0), 0, graph);
-
- addLink(graph, postprocessedMatte, maxOperation->getInputSocket(1));
-
+ converter.addOperation(maxOperation);
+
+ converter.mapInputSocket(inputCoreMatte, maxOperation->getInputSocket(0));
+ converter.addLink(postprocessedMatte, maxOperation->getInputSocket(1));
+
postprocessedMatte = maxOperation->getOutputSocket();
-
- graph->addOperation(maxOperation);
}
-
+
/* apply blur on matte if needed */
if (keying_data->blur_post)
- postprocessedMatte = setupPostBlur(graph, postprocessedMatte, keying_data->blur_post);
+ postprocessedMatte = setupPostBlur(converter, postprocessedMatte, keying_data->blur_post);
/* matte dilate/erode */
if (keying_data->dilate_distance != 0) {
- postprocessedMatte = setupDilateErode(graph, postprocessedMatte, keying_data->dilate_distance);
+ postprocessedMatte = setupDilateErode(converter, postprocessedMatte, keying_data->dilate_distance);
}
/* matte feather */
if (keying_data->feather_distance != 0) {
- postprocessedMatte = setupFeather(graph, context, postprocessedMatte, keying_data->feather_falloff,
+ postprocessedMatte = setupFeather(converter, context, postprocessedMatte, keying_data->feather_falloff,
keying_data->feather_distance);
}
/* set alpha channel to output image */
SetAlphaOperation *alphaOperation = new SetAlphaOperation();
- addLink(graph, originalImage, alphaOperation->getInputSocket(0));
- addLink(graph, postprocessedMatte, alphaOperation->getInputSocket(1));
+ 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(graph, postprocessedImage,
- keyingOperation->getInputSocket(1)->getConnection()->getFromSocket(),
+ postprocessedImage = setupDespill(converter, postprocessedImage,
+ inputScreen,
keying_data->despill_factor,
keying_data->despill_balance);
}
/* connect result to output sockets */
- outputImage->relinkConnections(postprocessedImage);
- outputMatte->relinkConnections(postprocessedMatte);
+ converter.mapOutputSocket(outputImage, postprocessedImage);
+ converter.mapOutputSocket(outputMatte, postprocessedMatte);
if (edgesMatte)
- outputEdges->relinkConnections(edgesMatte);
-
- graph->addOperation(alphaOperation);
+ converter.mapOutputSocket(outputEdges, edgesMatte);
}
diff --git a/source/blender/compositor/nodes/COM_KeyingNode.h b/source/blender/compositor/nodes/COM_KeyingNode.h
index 6ab6a60a44d..f4a6c02aa56 100644
--- a/source/blender/compositor/nodes/COM_KeyingNode.h
+++ b/source/blender/compositor/nodes/COM_KeyingNode.h
@@ -29,19 +29,17 @@
*/
class KeyingNode : public Node {
protected:
- NodeBlurData m_alpha_blur; /* only used for blurring alpha, since the dilate/erode node doesnt have this */
-
- OutputSocket *setupPreBlur(ExecutionSystem *graph, InputSocket *inputImage, int size, OutputSocket **originalImage);
- OutputSocket *setupPostBlur(ExecutionSystem *graph, OutputSocket *postBlurInput, int size);
- OutputSocket *setupDilateErode(ExecutionSystem *graph, OutputSocket *dilateErodeInput, int distance);
- OutputSocket *setupFeather(ExecutionSystem *graph, CompositorContext *context, OutputSocket *featherInput,
- int falloff, int distance);
- OutputSocket *setupDespill(ExecutionSystem *graph, OutputSocket *despillInput, OutputSocket *inputSrceen,
- float factor, float colorBalance);
- OutputSocket *setupClip(ExecutionSystem *graph, OutputSocket *clipInput, int kernelRadius, float kernelTolerance,
- float clipBlack, float clipWhite, bool edgeMatte);
+ 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(ExecutionSystem *graph, CompositorContext *context);
+ 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 59d889d0c84..70b3b696e37 100644
--- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp
+++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp
@@ -34,26 +34,20 @@ KeyingScreenNode::KeyingScreenNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void KeyingScreenNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void KeyingScreenNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- OutputSocket *outputScreen = this->getOutputSocket(0);
-
bNode *editorNode = this->getbNode();
MovieClip *clip = (MovieClip *) editorNode->id;
-
NodeKeyingScreenData *keyingscreen_data = (NodeKeyingScreenData *) editorNode->storage;
-
+
+ NodeOutput *outputScreen = this->getOutputSocket(0);
+
// always connect the output image
KeyingScreenOperation *operation = new KeyingScreenOperation();
- operation->setbNode(editorNode);
-
- if (outputScreen->isConnected()) {
- outputScreen->relinkConnections(operation->getOutputSocket());
- }
-
operation->setMovieClip(clip);
operation->setTrackingObject(keyingscreen_data->tracking_object);
- operation->setFramenumber(context->getFramenumber());
-
- graph->addOperation(operation);
+ operation->setFramenumber(context.getFramenumber());
+ converter.addOperation(operation);
+
+ converter.mapOutputSocket(outputScreen, operation->getOutputSocket());
}
diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.h b/source/blender/compositor/nodes/COM_KeyingScreenNode.h
index 9b8ac88bb6e..be29b939690 100644
--- a/source/blender/compositor/nodes/COM_KeyingScreenNode.h
+++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.h
@@ -31,6 +31,6 @@
class KeyingScreenNode : public Node {
public:
KeyingScreenNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 9af1fceaae0..32db452e6c2 100644
--- a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp
+++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp
@@ -30,38 +30,33 @@ LensDistortionNode::LensDistortionNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+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();
- operation->setbNode(editorNode);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(2)->relinkConnections(operation->getInputSocket(1), 2, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
-
- graph->addOperation(operation);
-
+ 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->setbNode(editorNode);
operation->setFit(data->fit);
operation->setJitter(data->jit);
- if (!getInputSocket(1)->isConnected())
+ if (!getInputSocket(1)->isLinked())
operation->setDistortion(getInputSocket(1)->getEditorValueFloat());
- if (!getInputSocket(2)->isConnected())
+ if (!getInputSocket(2)->isLinked())
operation->setDispersion(getInputSocket(2)->getEditorValueFloat());
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph);
-
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
-
- graph->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));
}
-
}
diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.h b/source/blender/compositor/nodes/COM_LensDistortionNode.h
index 52529823441..4d5dc2e2705 100644
--- a/source/blender/compositor/nodes/COM_LensDistortionNode.h
+++ b/source/blender/compositor/nodes/COM_LensDistortionNode.h
@@ -32,7 +32,7 @@
class LensDistortionNode : public Node {
public:
LensDistortionNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 b1e6967ba42..e23ec243ff4 100644
--- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
@@ -30,34 +30,29 @@ LuminanceMatteNode::LuminanceMatteNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void LuminanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void LuminanceMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- OutputSocket *outputSocketImage = this->getOutputSocket(0);
- OutputSocket *outputSocketMatte = this->getOutputSocket(1);
+ bNode *editorsnode = getbNode();
+ NodeInput *inputSocket = this->getInputSocket(0);
+ NodeOutput *outputSocketImage = this->getOutputSocket(0);
+ NodeOutput *outputSocketMatte = this->getOutputSocket(1);
ConvertRGBToYUVOperation *rgbToYUV = new ConvertRGBToYUVOperation();
LuminanceMatteOperation *operationSet = new LuminanceMatteOperation();
- bNode *editorsnode = getbNode();
operationSet->setSettings((NodeChroma *)editorsnode->storage);
+ converter.addOperation(rgbToYUV);
+ converter.addOperation(operationSet);
- inputSocket->relinkConnections(rgbToYUV->getInputSocket(0), 0, graph);
- addLink(graph, rgbToYUV->getOutputSocket(), operationSet->getInputSocket(0));
-
- if (outputSocketMatte->isConnected()) {
- outputSocketMatte->relinkConnections(operationSet->getOutputSocket(0));
- }
-
- graph->addOperation(rgbToYUV);
- graph->addOperation(operationSet);
+ converter.mapInputSocket(inputSocket, rgbToYUV->getInputSocket(0));
+ converter.addLink(rgbToYUV->getOutputSocket(), operationSet->getInputSocket(0));
+ converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0));
SetAlphaOperation *operation = new SetAlphaOperation();
- addLink(graph, rgbToYUV->getInputSocket(0)->getConnection()->getFromSocket(), operation->getInputSocket(0));
- addLink(graph, operationSet->getOutputSocket(), operation->getInputSocket(1));
- graph->addOperation(operation);
- addPreviewOperation(graph, context, operation->getOutputSocket());
-
- if (outputSocketImage->isConnected()) {
- outputSocketImage->relinkConnections(operation->getOutputSocket());
- }
+ converter.addOperation(operation);
+
+ converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
+ converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1));
+ converter.mapOutputSocket(outputSocketImage, 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 a71e68cf636..a36e6f2e732 100644
--- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h
+++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h
@@ -31,7 +31,7 @@
class LuminanceMatteNode : public Node {
public:
LuminanceMatteNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* __COM_LUMINANCEMATTENODE_H__ */
diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.cpp b/source/blender/compositor/nodes/COM_MapRangeNode.cpp
index 232be3d41b0..2c164cfad32 100644
--- a/source/blender/compositor/nodes/COM_MapRangeNode.cpp
+++ b/source/blender/compositor/nodes/COM_MapRangeNode.cpp
@@ -30,25 +30,23 @@ MapRangeNode::MapRangeNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void MapRangeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void MapRangeNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *valueSocket = this->getInputSocket(0);
- InputSocket *sourceMinSocket = this->getInputSocket(1);
- InputSocket *sourceMaxSocket = this->getInputSocket(2);
- InputSocket *destMinSocket = this->getInputSocket(3);
- InputSocket *destMaxSocket = this->getInputSocket(4);
- OutputSocket *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();
-
- valueSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- sourceMinSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
- sourceMaxSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
- destMinSocket->relinkConnections(operation->getInputSocket(3), 3, graph);
- destMaxSocket->relinkConnections(operation->getInputSocket(4), 4, graph);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
-
operation->setUseClamp(this->getbNode()->custom1);
-
- graph->addOperation(operation);
+ 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));
}
diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.h b/source/blender/compositor/nodes/COM_MapRangeNode.h
index 6667720be3d..0ef4309602d 100644
--- a/source/blender/compositor/nodes/COM_MapRangeNode.h
+++ b/source/blender/compositor/nodes/COM_MapRangeNode.h
@@ -32,7 +32,7 @@
class MapRangeNode : public Node {
public:
MapRangeNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* __COM_MAPRANGENODE_H__ */
diff --git a/source/blender/compositor/nodes/COM_MapUVNode.cpp b/source/blender/compositor/nodes/COM_MapUVNode.cpp
index 447b8239a93..25ca7b8b8c6 100644
--- a/source/blender/compositor/nodes/COM_MapUVNode.cpp
+++ b/source/blender/compositor/nodes/COM_MapUVNode.cpp
@@ -28,17 +28,16 @@ MapUVNode::MapUVNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void MapUVNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void MapUVNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- MapUVOperation *operation = new MapUVOperation();
-
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
bNode *node = this->getbNode();
+
+ MapUVOperation *operation = new MapUVOperation();
operation->setAlpha((float)node->custom1);
operation->setResolutionInputSocketIndex(1);
+ converter.addOperation(operation);
- graph->addOperation(operation);
+ 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 2e5616e0bd0..286ec4205f1 100644
--- a/source/blender/compositor/nodes/COM_MapUVNode.h
+++ b/source/blender/compositor/nodes/COM_MapUVNode.h
@@ -31,6 +31,6 @@
class MapUVNode : public Node {
public:
MapUVNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 ac57ffed9da..d7ee4e6a38b 100644
--- a/source/blender/compositor/nodes/COM_MapValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_MapValueNode.cpp
@@ -30,14 +30,17 @@ MapValueNode::MapValueNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void MapValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void MapValueNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *colorSocket = this->getInputSocket(0);
- OutputSocket *valueSocket = this->getOutputSocket(0);
TexMapping *storage = (TexMapping *)this->getbNode()->storage;
+
+ NodeInput *colorSocket = this->getInputSocket(0);
+ NodeOutput *valueSocket = this->getOutputSocket(0);
+
MapValueOperation *convertProg = new MapValueOperation();
convertProg->setSettings(storage);
- colorSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph);
- valueSocket->relinkConnections(convertProg->getOutputSocket(0));
- graph->addOperation(convertProg);
+ converter.addOperation(convertProg);
+
+ 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 bd8e3d08e9c..8b82b31350d 100644
--- a/source/blender/compositor/nodes/COM_MapValueNode.h
+++ b/source/blender/compositor/nodes/COM_MapValueNode.h
@@ -32,7 +32,7 @@
class MapValueNode : public Node {
public:
MapValueNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* __COM_MAPVALUENODE_H__ */
diff --git a/source/blender/compositor/nodes/COM_MaskNode.cpp b/source/blender/compositor/nodes/COM_MaskNode.cpp
index 65ff443b55b..be05840f601 100644
--- a/source/blender/compositor/nodes/COM_MaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_MaskNode.cpp
@@ -34,11 +34,11 @@ MaskNode::MaskNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void MaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- const RenderData *rd = context->getRenderData();
+ const RenderData *rd = context.getRenderData();
- OutputSocket *outputMask = this->getOutputSocket(0);
+ NodeOutput *outputMask = this->getOutputSocket(0);
bNode *editorNode = this->getbNode();
NodeMask *data = (NodeMask *)editorNode->storage;
@@ -46,7 +46,6 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
// always connect the output image
MaskOperation *operation = new MaskOperation();
- operation->setbNode(editorNode);
if (editorNode->custom1 & CMP_NODEFLAG_MASK_FIXED) {
operation->setMaskWidth(data->size_x);
@@ -61,12 +60,8 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
operation->setMaskHeight(rd->ysch * rd->size / 100.0f);
}
- if (outputMask->isConnected()) {
- outputMask->relinkConnections(operation->getOutputSocket());
- }
-
operation->setMask(mask);
- operation->setFramenumber(context->getFramenumber());
+ operation->setFramenumber(context.getFramenumber());
operation->setSmooth((bool)(editorNode->custom1 & CMP_NODEFLAG_MASK_AA) != 0);
operation->setFeather((bool)(editorNode->custom1 & CMP_NODEFLAG_MASK_NO_FEATHER) == 0);
@@ -78,5 +73,6 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
operation->setMotionBlurShutter(editorNode->custom3);
}
- graph->addOperation(operation);
+ 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 9ef3e5deb50..834c421ac08 100644
--- a/source/blender/compositor/nodes/COM_MaskNode.h
+++ b/source/blender/compositor/nodes/COM_MaskNode.h
@@ -34,7 +34,7 @@
class MaskNode : public Node {
public:
MaskNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp
index 23e9a9d623d..42a8cb032ce 100644
--- a/source/blender/compositor/nodes/COM_MathNode.cpp
+++ b/source/blender/compositor/nodes/COM_MathNode.cpp
@@ -24,7 +24,7 @@
#include "COM_MathBaseOperation.h"
#include "COM_ExecutionSystem.h"
-void MathNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void MathNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
MathBaseOperation *operation = NULL;
@@ -85,15 +85,13 @@ void MathNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
break;
}
- if (operation != NULL) {
- bool useClamp = this->getbNode()->custom2;
-
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
+ if (operation) {
+ bool useClamp = getbNode()->custom2;
operation->setUseClamp(useClamp);
-
- graph->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());
}
}
diff --git a/source/blender/compositor/nodes/COM_MathNode.h b/source/blender/compositor/nodes/COM_MathNode.h
index 4f8e64754e7..72403e7059f 100644
--- a/source/blender/compositor/nodes/COM_MathNode.h
+++ b/source/blender/compositor/nodes/COM_MathNode.h
@@ -32,7 +32,7 @@
class MathNode : public Node {
public:
MathNode(bNode *editorNode) : Node(editorNode) {}
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 42217243fdf..b12dfc02ed7 100644
--- a/source/blender/compositor/nodes/COM_MixNode.cpp
+++ b/source/blender/compositor/nodes/COM_MixNode.cpp
@@ -34,18 +34,17 @@ MixNode::MixNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void MixNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *valueSocket = this->getInputSocket(0);
- InputSocket *color1Socket = this->getInputSocket(1);
- InputSocket *color2Socket = this->getInputSocket(2);
- OutputSocket *outputSocket = this->getOutputSocket(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;
bool useClamp = this->getbNode()->custom2 & 2;
MixBaseOperation *convertProg;
-
switch (editorNode->custom1) {
case MA_RAMP_ADD:
convertProg = new MixAddOperation();
@@ -106,14 +105,12 @@ void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext *con
}
convertProg->setUseValueAlphaMultiply(useAlphaPremultiply);
convertProg->setUseClamp(useClamp);
-
- valueSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph);
- color1Socket->relinkConnections(convertProg->getInputSocket(1), 1, graph);
- color2Socket->relinkConnections(convertProg->getInputSocket(2), 2, graph);
- outputSocket->relinkConnections(convertProg->getOutputSocket(0));
- addPreviewOperation(graph, context, convertProg->getOutputSocket(0));
+ converter.addOperation(convertProg);
- convertProg->getInputSocket(2)->setResizeMode(color2Socket->getResizeMode());
+ converter.mapInputSocket(valueSocket, convertProg->getInputSocket(0));
+ converter.mapInputSocket(color1Socket, convertProg->getInputSocket(1));
+ converter.mapInputSocket(color2Socket, convertProg->getInputSocket(2));
+ converter.mapOutputSocket(outputSocket, convertProg->getOutputSocket(0));
- graph->addOperation(convertProg);
+ converter.addPreview(convertProg->getOutputSocket(0));
}
diff --git a/source/blender/compositor/nodes/COM_MixNode.h b/source/blender/compositor/nodes/COM_MixNode.h
index 76076d01427..3e61a855d31 100644
--- a/source/blender/compositor/nodes/COM_MixNode.h
+++ b/source/blender/compositor/nodes/COM_MixNode.h
@@ -32,6 +32,6 @@
class MixNode : public Node {
public:
MixNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 041fa9f7c4c..933223dacac 100644
--- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp
+++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
@@ -38,19 +38,19 @@ MovieClipNode::MovieClipNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void MovieClipNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- OutputSocket *outputMovieClip = this->getOutputSocket(0);
- OutputSocket *alphaMovieClip = this->getOutputSocket(1);
- OutputSocket *offsetXMovieClip = this->getOutputSocket(2);
- OutputSocket *offsetYMovieClip = this->getOutputSocket(3);
- OutputSocket *scaleMovieClip = this->getOutputSocket(4);
- OutputSocket *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();
+ bool cacheFrame = !context.isRendering();
ImBuf *ibuf = NULL;
if (movieClip) {
@@ -62,27 +62,23 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
// always connect the output image
MovieClipOperation *operation = new MovieClipOperation();
-
- addPreviewOperation(graph, context, operation->getOutputSocket());
- if (outputMovieClip->isConnected()) {
- outputMovieClip->relinkConnections(operation->getOutputSocket());
- }
-
operation->setMovieClip(movieClip);
operation->setMovieClipUser(movieClipUser);
- operation->setFramenumber(context->getFramenumber());
+ operation->setFramenumber(context.getFramenumber());
operation->setCacheFrame(cacheFrame);
- graph->addOperation(operation);
- if (alphaMovieClip->isConnected()) {
- MovieClipAlphaOperation *alphaOperation = new MovieClipAlphaOperation();
- alphaOperation->setMovieClip(movieClip);
- alphaOperation->setMovieClipUser(movieClipUser);
- alphaOperation->setFramenumber(context->getFramenumber());
- alphaOperation->setCacheFrame(cacheFrame);
- alphaMovieClip->relinkConnections(alphaOperation->getOutputSocket());
- graph->addOperation(alphaOperation);
- }
+ 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);
+
+ converter.addOperation(alphaOperation);
+ converter.mapOutputSocket(alphaMovieClip, alphaOperation->getOutputSocket());
MovieTrackingStabilization *stab = &movieClip->tracking.stabilization;
float loc[2], scale, angle;
@@ -93,37 +89,17 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
if (ibuf) {
if (stab->flag & TRACKING_2D_STABILIZATION) {
- int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip, context->getFramenumber());
+ int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip, context.getFramenumber());
BKE_tracking_stabilization_data_get(&movieClip->tracking, clip_framenr, ibuf->x, ibuf->y, loc, &scale, &angle);
}
}
- if (offsetXMovieClip->isConnected()) {
- SetValueOperation *operationSetValue = new SetValueOperation();
- operationSetValue->setValue(loc[0]);
- offsetXMovieClip->relinkConnections(operationSetValue->getOutputSocket());
- graph->addOperation(operationSetValue);
- }
- if (offsetYMovieClip->isConnected()) {
- SetValueOperation *operationSetValue = new SetValueOperation();
- operationSetValue->setValue(loc[1]);
- offsetYMovieClip->relinkConnections(operationSetValue->getOutputSocket());
- graph->addOperation(operationSetValue);
- }
- if (scaleMovieClip->isConnected()) {
- SetValueOperation *operationSetValue = new SetValueOperation();
- operationSetValue->setValue(scale);
- scaleMovieClip->relinkConnections(operationSetValue->getOutputSocket());
- graph->addOperation(operationSetValue);
- }
- if (angleMovieClip->isConnected()) {
- SetValueOperation *operationSetValue = new SetValueOperation();
- operationSetValue->setValue(angle);
- angleMovieClip->relinkConnections(operationSetValue->getOutputSocket());
- graph->addOperation(operationSetValue);
- }
-
+ converter.addOutputValue(offsetXMovieClip, loc[0]);
+ converter.addOutputValue(offsetYMovieClip, loc[1]);
+ converter.addOutputValue(scaleMovieClip, scale);
+ converter.addOutputValue(angleMovieClip, angle);
+
if (ibuf) {
IMB_freeImBuf(ibuf);
}
diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.h b/source/blender/compositor/nodes/COM_MovieClipNode.h
index 2fb38860a34..ff7b2869f05 100644
--- a/source/blender/compositor/nodes/COM_MovieClipNode.h
+++ b/source/blender/compositor/nodes/COM_MovieClipNode.h
@@ -33,7 +33,7 @@
class MovieClipNode : public Node {
public:
MovieClipNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* __COM_MOVIECLIPNODE_H__ */
diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp b/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
index c29bc27cd80..fd907465984 100644
--- a/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
+++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
@@ -31,18 +31,19 @@ MovieDistortionNode::MovieDistortionNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void MovieDistortionNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
+void MovieDistortionNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- OutputSocket *outputSocket = this->getOutputSocket(0);
bNode *bnode = this->getbNode();
MovieClip *clip = (MovieClip *)bnode->id;
+ NodeInput *inputSocket = this->getInputSocket(0);
+ NodeOutput *outputSocket = this->getOutputSocket(0);
+
MovieDistortionOperation *operation = new MovieDistortionOperation(bnode->custom1 == 1);
operation->setMovieClip(clip);
- operation->setFramenumber(context->getFramenumber());
+ operation->setFramenumber(context.getFramenumber());
+ converter.addOperation(operation);
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, system);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- system->addOperation(operation);
+ 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 b97600bb64e..6ff0295083f 100644
--- a/source/blender/compositor/nodes/COM_MovieDistortionNode.h
+++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.h
@@ -32,7 +32,7 @@
class MovieDistortionNode : public Node {
public:
MovieDistortionNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif
diff --git a/source/blender/compositor/nodes/COM_MuteNode.cpp b/source/blender/compositor/nodes/COM_MuteNode.cpp
deleted file mode 100644
index 5155b55a2ec..00000000000
--- a/source/blender/compositor/nodes/COM_MuteNode.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#include "COM_MuteNode.h"
-#include "COM_SocketConnection.h"
-#include "COM_SetValueOperation.h"
-#include "COM_SetVectorOperation.h"
-#include "COM_SetColorOperation.h"
-
-extern "C" {
-# include "BLI_listbase.h"
-}
-
-MuteNode::MuteNode(bNode *editorNode) : Node(editorNode)
-{
- /* pass */
-}
-
-void MuteNode::reconnect(ExecutionSystem *graph, OutputSocket *output)
-{
- vector<InputSocket *> &inputsockets = this->getInputSockets();
- for (unsigned int index = 0; index < inputsockets.size(); index++) {
- InputSocket *input = inputsockets[index];
- if (input->getDataType() == output->getDataType()) {
- if (input->isConnected()) {
- output->relinkConnections(input->getConnection()->getFromSocket(), false);
- /* output connections have been redirected,
- * remove the input connection to completely unlink the node.
- */
- input->unlinkConnections(graph);
- return;
- }
- }
- }
-
- createDefaultOutput(graph, output);
-}
-
-void MuteNode::createDefaultOutput(ExecutionSystem *graph, OutputSocket *output)
-{
- 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) {
- output->relinkConnections(operation->getOutputSocket(), false);
- graph->addOperation(operation);
- }
-
- output->clearConnections();
-}
-
-template<class SocketType> void MuteNode::fillSocketMap(vector<SocketType *> &sockets, SocketMap &socketMap)
-{
- for (typename vector<SocketType *>::iterator it = sockets.begin(); it != sockets.end(); it++) {
- Socket *socket = (Socket *) *it;
-
- socketMap.insert(std::pair<bNodeSocket *, Socket *>(socket->getbNodeSocket(), socket));
- }
-}
-
-void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
-{
- bNode *editorNode = this->getbNode();
- vector<OutputSocket *> &outputsockets = this->getOutputSockets();
-
- /* mute node is also used for unknown nodes and couple of nodes in fast mode
- * can't use generic routines in that case
- */
- if (editorNode->flag & NODE_MUTED) {
- vector<InputSocket *> &inputsockets = this->getInputSockets();
- vector<OutputSocket *> relinkedsockets;
- SocketMap socketMap;
- bNodeLink *link;
-
- this->fillSocketMap<OutputSocket>(outputsockets, socketMap);
- this->fillSocketMap<InputSocket>(inputsockets, socketMap);
-
- for (link = (bNodeLink *) editorNode->internal_links.first; link; link = link->next) {
- if (link->fromnode == editorNode) {
- InputSocket *fromSocket = (InputSocket *) socketMap.find(link->fromsock)->second;
- OutputSocket *toSocket = (OutputSocket *) socketMap.find(link->tosock)->second;
-
- if (toSocket->isConnected()) {
- if (fromSocket->isConnected()) {
- toSocket->relinkConnections(fromSocket->getConnection()->getFromSocket(), false);
- }
- else {
- createDefaultOutput(graph, toSocket);
- }
-
- relinkedsockets.push_back(toSocket);
- }
- }
- }
-
- /* in some cases node could be marked as muted, but it wouldn't have internal connections
- * this happens in such cases as muted render layer node
- *
- * to deal with such cases create default operation for not-relinked output sockets
- */
-
- for (unsigned int index = 0; index < outputsockets.size(); index++) {
- OutputSocket *output = outputsockets[index];
-
- if (output->isConnected()) {
- bool relinked = false;
- vector<OutputSocket *>::iterator it;
-
- for (it = relinkedsockets.begin(); it != relinkedsockets.end(); it++) {
- if (*it == output) {
- relinked = true;
- break;
- }
- }
-
- if (!relinked)
- createDefaultOutput(graph, output);
- }
- }
- }
- else {
- for (unsigned int index = 0; index < outputsockets.size(); index++) {
- OutputSocket *output = outputsockets[index];
- if (output->isConnected()) {
- reconnect(graph, output);
- }
- }
- }
-}
diff --git a/source/blender/compositor/nodes/COM_MuteNode.h b/source/blender/compositor/nodes/COM_MuteNode.h
deleted file mode 100644
index 7b0f1c2c298..00000000000
--- a/source/blender/compositor/nodes/COM_MuteNode.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#ifndef _COM_MuteNode_h_
-#define _COM_MuteNode_h_
-
-#include <map>
-
-#include "COM_Node.h"
-
-extern "C" {
-# include "BKE_node.h"
-}
-
-/**
- * @brief MuteNode
- * @ingroup Node
- */
-class MuteNode : public Node {
-public:
- MuteNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
-private:
- typedef std::map<bNodeSocket *, Socket *> SocketMap;
-
- void reconnect(ExecutionSystem *graph, OutputSocket *output);
- void createDefaultOutput(ExecutionSystem *graph, OutputSocket *output);
-
- template<class SocketType> void fillSocketMap(vector<SocketType *> &sockets, SocketMap &socketMap);
-};
-
-#endif
diff --git a/source/blender/compositor/nodes/COM_NormalNode.cpp b/source/blender/compositor/nodes/COM_NormalNode.cpp
index 41b91f61328..d7c3fd11844 100644
--- a/source/blender/compositor/nodes/COM_NormalNode.cpp
+++ b/source/blender/compositor/nodes/COM_NormalNode.cpp
@@ -31,32 +31,29 @@ NormalNode::NormalNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void NormalNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void NormalNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- OutputSocket *outputSocket = this->getOutputSocket(0);
- OutputSocket *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);
+
+ converter.mapOutputSocket(outputSocket, operationSet->getOutputSocket(0));
- outputSocket->relinkConnections(operationSet->getOutputSocket(0));
- graph->addOperation(operationSet);
+ DotproductOperation *operation = new DotproductOperation();
+ converter.addOperation(operation);
- if (outputSocketDotproduct->isConnected()) {
- DotproductOperation *operation = new DotproductOperation();
- outputSocketDotproduct->relinkConnections(operation->getOutputSocket(0));
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- addLink(graph, operationSet->getOutputSocket(0), operation->getInputSocket(1));
- graph->addOperation(operation);
- }
+ 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 64d4e3a3656..5cccaab5875 100644
--- a/source/blender/compositor/nodes/COM_NormalNode.h
+++ b/source/blender/compositor/nodes/COM_NormalNode.h
@@ -32,7 +32,7 @@
class NormalNode : public Node {
public:
NormalNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* COM_NormalNODE_H */
diff --git a/source/blender/compositor/nodes/COM_NormalizeNode.cpp b/source/blender/compositor/nodes/COM_NormalizeNode.cpp
index 7c1c695f8b6..f6e919c168f 100644
--- a/source/blender/compositor/nodes/COM_NormalizeNode.cpp
+++ b/source/blender/compositor/nodes/COM_NormalizeNode.cpp
@@ -28,12 +28,11 @@ NormalizeNode::NormalizeNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void NormalizeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void NormalizeNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
NormalizeOperation *operation = new NormalizeOperation();
+ converter.addOperation(operation);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
-
- graph->addOperation(operation);
+ 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 ea1497efdc6..a0eb7c9f5a9 100644
--- a/source/blender/compositor/nodes/COM_NormalizeNode.h
+++ b/source/blender/compositor/nodes/COM_NormalizeNode.h
@@ -31,7 +31,7 @@
class NormalizeNode : public Node {
public:
NormalizeNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 94e5efe77e0..83b138c1b07 100644
--- a/source/blender/compositor/nodes/COM_OutputFileNode.cpp
+++ b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
@@ -32,52 +32,46 @@ OutputFileNode::OutputFileNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void OutputFileNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
NodeImageMultiFile *storage = (NodeImageMultiFile *)this->getbNode()->storage;
- if (!context->isRendering()) {
+ 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.
*/
-
- /* still, need to unlink input sockets to remove the node from the graph completely */
- int num_inputs = getNumberOfInputSockets();
- for (int i = 0; i < num_inputs; ++i) {
- getInputSocket(i)->unlinkConnections(graph);
- }
return;
}
if (storage->format.imtype == R_IMF_IMTYPE_MULTILAYER) {
/* single output operation for the multilayer file */
OutputOpenExrMultiLayerOperation *outputOperation = new OutputOpenExrMultiLayerOperation(
- context->getRenderData(), context->getbNodeTree(), storage->base_path, storage->format.exr_codec);
+ context.getRenderData(), context.getbNodeTree(), storage->base_path, storage->format.exr_codec);
+ converter.addOperation(outputOperation);
int num_inputs = getNumberOfInputSockets();
- bool hasConnections = false;
+ bool previewAdded = false;
for (int i = 0; i < num_inputs; ++i) {
- InputSocket *input = getInputSocket(i);
+ NodeInput *input = getInputSocket(i);
NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage;
outputOperation->add_layer(sockdata->layer, input->getDataType());
- if (input->isConnected()) {
- hasConnections = true;
- input->relinkConnections(outputOperation->getInputSocket(i));
+ converter.mapInputSocket(input, outputOperation->getInputSocket(i));
+
+ if (!previewAdded) {
+ converter.addNodeInputPreview(input);
+ previewAdded = true;
}
}
- if (hasConnections) addPreviewOperation(graph, context, outputOperation->getInputSocket(0));
-
- graph->addOperation(outputOperation);
}
else { /* single layer format */
int num_inputs = getNumberOfInputSockets();
bool previewAdded = false;
for (int i = 0; i < num_inputs; ++i) {
- InputSocket *input = getInputSocket(i);
- if (input->isConnected()) {
+ 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];
@@ -86,16 +80,17 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
BLI_join_dirfile(path, FILE_MAX, storage->base_path, sockdata->path);
OutputSingleLayerOperation *outputOperation = new OutputSingleLayerOperation(
- context->getRenderData(), context->getbNodeTree(), input->getDataType(), format, path,
- context->getViewSettings(), context->getDisplaySettings());
- input->relinkConnections(outputOperation->getInputSocket(0));
- graph->addOperation(outputOperation);
+ context.getRenderData(), context.getbNodeTree(), input->getDataType(), format, path,
+ context.getViewSettings(), context.getDisplaySettings());
+ converter.addOperation(outputOperation);
+
+ converter.mapInputSocket(input, outputOperation->getInputSocket(0));
+
if (!previewAdded) {
- addPreviewOperation(graph, context, outputOperation->getInputSocket(0));
+ converter.addNodeInputPreview(input);
previewAdded = true;
}
}
}
}
}
-
diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.h b/source/blender/compositor/nodes/COM_OutputFileNode.h
index e3194436f7f..54e29417c14 100644
--- a/source/blender/compositor/nodes/COM_OutputFileNode.h
+++ b/source/blender/compositor/nodes/COM_OutputFileNode.h
@@ -34,7 +34,7 @@
class OutputFileNode : public Node {
public:
OutputFileNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 b751c9a6e9f..da3cd74e771 100644
--- a/source/blender/compositor/nodes/COM_PixelateNode.cpp
+++ b/source/blender/compositor/nodes/COM_PixelateNode.cpp
@@ -30,19 +30,20 @@ PixelateNode::PixelateNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void PixelateNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void PixelateNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- OutputSocket *outputSocket = this->getOutputSocket(0);
+ NodeInput *inputSocket = this->getInputSocket(0);
+ NodeOutput *outputSocket = this->getOutputSocket(0);
DataType datatype = inputSocket->getDataType();
- if (inputSocket->isConnected()) {
- SocketConnection *connection = inputSocket->getConnection();
- OutputSocket *otherOutputSocket = connection->getFromSocket();
- datatype = otherOutputSocket->getDataType();
+
+ if (inputSocket->isLinked()) {
+ NodeOutput *link = inputSocket->getLink();
+ datatype = link->getDataType();
}
PixelateOperation *operation = new PixelateOperation(datatype);
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ 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 c142d2d7a5b..a5e73eb3683 100644
--- a/source/blender/compositor/nodes/COM_PixelateNode.h
+++ b/source/blender/compositor/nodes/COM_PixelateNode.h
@@ -32,7 +32,7 @@
class PixelateNode : public Node {
public:
PixelateNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 944e04e4f4f..9b69bc5a46e 100644
--- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp
+++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp
@@ -37,44 +37,34 @@ PlaneTrackDeformNode::PlaneTrackDeformNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void PlaneTrackDeformNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void PlaneTrackDeformNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *input_image = this->getInputSocket(0);
-
- OutputSocket *output_warped_image = this->getOutputSocket(0);
- OutputSocket *output_plane = this->getOutputSocket(1);
-
bNode *editorNode = this->getbNode();
MovieClip *clip = (MovieClip *) editorNode->id;
-
NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *) editorNode->storage;
-
- int frame_number = context->getFramenumber();
-
- if (output_warped_image->isConnected()) {
- 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);
-
- input_image->relinkConnections(warp_image_operation->getInputSocket(0), 0, graph);
- output_warped_image->relinkConnections(warp_image_operation->getOutputSocket());
-
- graph->addOperation(warp_image_operation);
- }
-
- if (output_plane->isConnected()) {
- 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);
-
- output_plane->relinkConnections(plane_mask_operation->getOutputSocket());
-
- graph->addOperation(plane_mask_operation);
- }
+
+ int frame_number = context.getFramenumber();
+
+ 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);
+ converter.addOperation(warp_image_operation);
+
+ 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);
+ converter.addOperation(plane_mask_operation);
+
+ 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 3c37f4474dd..71e6ab12dfc 100644
--- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h
+++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h
@@ -34,5 +34,5 @@ extern "C" {
class PlaneTrackDeformNode : public Node {
public:
PlaneTrackDeformNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 512f8eec90f..cc66c688379 100644
--- a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
+++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
@@ -21,7 +21,6 @@
*/
#include "COM_RenderLayersNode.h"
-#include "COM_ExecutionSystem.h"
#include "COM_RenderLayersProg.h"
#include "COM_TranslateOperation.h"
#include "COM_RotateOperation.h"
@@ -33,69 +32,57 @@ RenderLayersNode::RenderLayersNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void RenderLayersNode::testSocketConnection(ExecutionSystem *system, CompositorContext *context, int outputSocketNumber, RenderLayersBaseProg *operation)
+void RenderLayersNode::testSocketLink(NodeConverter &converter, const CompositorContext &context,
+ int outputSocketNumber, RenderLayersBaseProg *operation) const
{
- OutputSocket *outputSocket = this->getOutputSocket(outputSocketNumber);
+ NodeOutput *outputSocket = this->getOutputSocket(outputSocketNumber);
Scene *scene = (Scene *)this->getbNode()->id;
short layerId = this->getbNode()->custom1;
- if (outputSocket->isConnected()) {
- operation->setScene(scene);
- operation->setLayerId(layerId);
- operation->setRenderData(context->getRenderData());
- outputSocket->relinkConnections(operation->getOutputSocket());
- system->addOperation(operation);
- if (outputSocketNumber == 0) { // only do for image socket if connected
- addPreviewOperation(system, context, operation->getOutputSocket());
- }
- }
- else {
- if (outputSocketNumber == 0) {
- system->addOperation(operation);
- operation->setScene(scene);
- operation->setLayerId(layerId);
- operation->setRenderData(context->getRenderData());
- addPreviewOperation(system, context, operation->getOutputSocket());
- }
- else {
- delete operation;
- }
- }
+ operation->setScene(scene);
+ operation->setLayerId(layerId);
+ operation->setRenderData(context.getRenderData());
+
+ converter.mapOutputSocket(outputSocket, operation->getOutputSocket());
+ converter.addOperation(operation);
+
+ if (outputSocketNumber == 0) /* only for image socket */
+ converter.addPreview(operation->getOutputSocket());
}
-void RenderLayersNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void RenderLayersNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- testSocketConnection(graph, context, 0, new RenderLayersColorProg());
- testSocketConnection(graph, context, 1, new RenderLayersAlphaProg());
- testSocketConnection(graph, context, 2, new RenderLayersDepthProg());
- testSocketConnection(graph, context, 3, new RenderLayersNormalOperation());
- testSocketConnection(graph, context, 4, new RenderLayersUVOperation());
- testSocketConnection(graph, context, 5, new RenderLayersSpeedOperation());
- testSocketConnection(graph, context, 6, new RenderLayersColorOperation());
- testSocketConnection(graph, context, 7, new RenderLayersDiffuseOperation());
- testSocketConnection(graph, context, 8, new RenderLayersSpecularOperation());
- testSocketConnection(graph, context, 9, new RenderLayersShadowOperation());
- testSocketConnection(graph, context, 10, new RenderLayersAOOperation());
- testSocketConnection(graph, context, 11, new RenderLayersReflectionOperation());
- testSocketConnection(graph, context, 12, new RenderLayersRefractionOperation());
- testSocketConnection(graph, context, 13, new RenderLayersIndirectOperation());
- testSocketConnection(graph, context, 14, new RenderLayersObjectIndexOperation());
- testSocketConnection(graph, context, 15, new RenderLayersMaterialIndexOperation());
- testSocketConnection(graph, context, 16, new RenderLayersMistOperation());
- testSocketConnection(graph, context, 17, new RenderLayersEmitOperation());
- testSocketConnection(graph, context, 18, new RenderLayersEnvironmentOperation());
+ testSocketLink(converter, context, 0, new RenderLayersColorProg());
+ testSocketLink(converter, context, 1, new RenderLayersAlphaProg());
+ testSocketLink(converter, context, 2, new RenderLayersDepthProg());
+ testSocketLink(converter, context, 3, new RenderLayersNormalOperation());
+ testSocketLink(converter, context, 4, new RenderLayersUVOperation());
+ testSocketLink(converter, context, 5, new RenderLayersSpeedOperation());
+ testSocketLink(converter, context, 6, new RenderLayersColorOperation());
+ testSocketLink(converter, context, 7, new RenderLayersDiffuseOperation());
+ testSocketLink(converter, context, 8, new RenderLayersSpecularOperation());
+ testSocketLink(converter, context, 9, new RenderLayersShadowOperation());
+ testSocketLink(converter, context, 10, new RenderLayersAOOperation());
+ testSocketLink(converter, context, 11, new RenderLayersReflectionOperation());
+ testSocketLink(converter, context, 12, new RenderLayersRefractionOperation());
+ testSocketLink(converter, context, 13, new RenderLayersIndirectOperation());
+ testSocketLink(converter, context, 14, new RenderLayersObjectIndexOperation());
+ testSocketLink(converter, context, 15, new RenderLayersMaterialIndexOperation());
+ testSocketLink(converter, context, 16, new RenderLayersMistOperation());
+ testSocketLink(converter, context, 17, new RenderLayersEmitOperation());
+ testSocketLink(converter, context, 18, new RenderLayersEnvironmentOperation());
// cycles passes
- testSocketConnection(graph, context, 19, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_DIRECT));
- testSocketConnection(graph, context, 20, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_INDIRECT));
- testSocketConnection(graph, context, 21, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_COLOR));
- testSocketConnection(graph, context, 22, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_DIRECT));
- testSocketConnection(graph, context, 23, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_INDIRECT));
- testSocketConnection(graph, context, 24, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_COLOR));
- testSocketConnection(graph, context, 25, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_DIRECT));
- testSocketConnection(graph, context, 26, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_INDIRECT));
- testSocketConnection(graph, context, 27, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_COLOR));
- testSocketConnection(graph, context, 28, new RenderLayersCyclesOperation(SCE_PASS_SUBSURFACE_DIRECT));
- testSocketConnection(graph, context, 29, new RenderLayersCyclesOperation(SCE_PASS_SUBSURFACE_INDIRECT));
- testSocketConnection(graph, context, 30, new RenderLayersCyclesOperation(SCE_PASS_SUBSURFACE_COLOR));
+ testSocketLink(converter, context, 19, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_DIRECT));
+ testSocketLink(converter, context, 20, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_INDIRECT));
+ testSocketLink(converter, context, 21, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_COLOR));
+ testSocketLink(converter, context, 22, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_DIRECT));
+ testSocketLink(converter, context, 23, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_INDIRECT));
+ testSocketLink(converter, context, 24, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_COLOR));
+ testSocketLink(converter, context, 25, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_DIRECT));
+ testSocketLink(converter, context, 26, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_INDIRECT));
+ testSocketLink(converter, context, 27, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_COLOR));
+ testSocketLink(converter, context, 28, new RenderLayersCyclesOperation(SCE_PASS_SUBSURFACE_DIRECT));
+ testSocketLink(converter, context, 29, new RenderLayersCyclesOperation(SCE_PASS_SUBSURFACE_INDIRECT));
+ testSocketLink(converter, context, 30, new RenderLayersCyclesOperation(SCE_PASS_SUBSURFACE_COLOR));
}
diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.h b/source/blender/compositor/nodes/COM_RenderLayersNode.h
index 0c769d32aea..5863cbb390c 100644
--- a/source/blender/compositor/nodes/COM_RenderLayersNode.h
+++ b/source/blender/compositor/nodes/COM_RenderLayersNode.h
@@ -31,7 +31,7 @@
class RenderLayersNode : public Node {
public:
RenderLayersNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
private:
- void testSocketConnection(ExecutionSystem *graph, CompositorContext *context, int outputSocketNumber, RenderLayersBaseProg *operation);
+ void testSocketLink(NodeConverter &converter, const CompositorContext &context, int outputSocketNumber, RenderLayersBaseProg *operation) const;
};
diff --git a/source/blender/compositor/nodes/COM_RotateNode.cpp b/source/blender/compositor/nodes/COM_RotateNode.cpp
index d7712323a27..c5fe88b3636 100644
--- a/source/blender/compositor/nodes/COM_RotateNode.cpp
+++ b/source/blender/compositor/nodes/COM_RotateNode.cpp
@@ -31,21 +31,20 @@ RotateNode::RotateNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void RotateNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
+void RotateNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- InputSocket *inputDegreeSocket = this->getInputSocket(1);
- OutputSocket *outputSocket = this->getOutputSocket(0);
+ 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);
- addLink(system, sampler->getOutputSocket(), operation->getInputSocket(0));
- inputSocket->relinkConnections(sampler->getInputSocket(0), 0, system);
- inputDegreeSocket->relinkConnections(operation->getInputSocket(1), 1, system);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- system->addOperation(sampler);
- system->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));
}
diff --git a/source/blender/compositor/nodes/COM_RotateNode.h b/source/blender/compositor/nodes/COM_RotateNode.h
index 6e3801e5353..f192fa8db25 100644
--- a/source/blender/compositor/nodes/COM_RotateNode.h
+++ b/source/blender/compositor/nodes/COM_RotateNode.h
@@ -32,7 +32,7 @@
class RotateNode : public Node {
public:
RotateNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 e139eb83e04..61eea9227dc 100644
--- a/source/blender/compositor/nodes/COM_ScaleNode.cpp
+++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp
@@ -33,71 +33,70 @@ ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ScaleNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- InputSocket *inputXSocket = this->getInputSocket(1);
- InputSocket *inputYSocket = this->getInputSocket(2);
- OutputSocket *outputSocket = this->getOutputSocket(0);
- BaseScaleOperation *scaleoperation = NULL;
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();
-
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
- inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
-
- scaleoperation = operation;
+ 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));
break;
}
case CMP_SCALE_SCENEPERCENT:
{
SetValueOperation *scaleFactorOperation = new SetValueOperation();
- scaleFactorOperation->setValue(context->getRenderData()->size / 100.0f);
+ scaleFactorOperation->setValue(context.getRenderData()->size / 100.0f);
+ converter.addOperation(scaleFactorOperation);
+
ScaleOperation *operation = new ScaleOperation();
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- addLink(graph, scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1));
- addLink(graph, scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2));
- graph->addOperation(scaleFactorOperation);
-
- scaleoperation = operation;
+ 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));
break;
}
case CMP_SCALE_RENDERPERCENT:
{
- const RenderData *rd = context->getRenderData();
+ 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);
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- operation->getInputSocket(0)->getConnection()->setIgnoreResizeCheck(true);
-
- scaleoperation = operation;
+ operation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE);
+ converter.addOperation(operation);
+
+ converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
+ converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
break;
}
case CMP_SCALE_ABSOLUTE:
{
- ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); // TODO: what is the use of this one.... perhaps some issues when the ui was updated....
-
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
- inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
-
- scaleoperation = operation;
+ /* 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));
break;
}
}
-
- outputSocket->relinkConnections(scaleoperation->getOutputSocket(0));
- graph->addOperation(scaleoperation);
}
diff --git a/source/blender/compositor/nodes/COM_ScaleNode.h b/source/blender/compositor/nodes/COM_ScaleNode.h
index 17c7b672a59..d009b3f6781 100644
--- a/source/blender/compositor/nodes/COM_ScaleNode.h
+++ b/source/blender/compositor/nodes/COM_ScaleNode.h
@@ -32,7 +32,7 @@
class ScaleNode : public Node {
public:
ScaleNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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
new file mode 100644
index 00000000000..fba8744f58e
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_SeparateColorNode.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Lukas Toenne
+ */
+
+#include "COM_SeparateColorNode.h"
+
+#include "COM_ConvertOperation.h"
+
+
+SeparateColorNode::SeparateColorNode(bNode *editorNode) :
+ Node(editorNode)
+{
+}
+
+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));
+ }
+}
+
+
+NodeOperation *SeparateRGBANode::getColorConverter(const CompositorContext &context) const
+{
+ return NULL; /* no conversion needed */
+}
+
+NodeOperation *SeparateHSVANode::getColorConverter(const CompositorContext &context) const
+{
+ return new ConvertRGBToHSVOperation();
+}
+
+NodeOperation *SeparateYCCANode::getColorConverter(const CompositorContext &context) const
+{
+ return new ConvertRGBToYCCOperation();
+}
+
+NodeOperation *SeparateYUVANode::getColorConverter(const CompositorContext &context) const
+{
+ return new ConvertRGBToYUVOperation();
+}
diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.h b/source/blender/compositor/nodes/COM_SeparateColorNode.h
new file mode 100644
index 00000000000..6730e471e06
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_SeparateColorNode.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Lukas Toenne
+ */
+
+#ifndef _COM_SeparateColorNode_h_
+#define _COM_SeparateColorNode_h_
+
+#include "COM_Node.h"
+
+class SeparateColorNode : public Node {
+public:
+ SeparateColorNode(bNode *editorNode);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
+
+protected:
+ virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0;
+};
+
+class SeparateRGBANode : public SeparateColorNode {
+public:
+ SeparateRGBANode(bNode *editorNode) :
+ SeparateColorNode(editorNode)
+ {}
+
+ NodeOperation *getColorConverter(const CompositorContext &context) const;
+};
+
+class SeparateHSVANode : public SeparateColorNode {
+public:
+ SeparateHSVANode(bNode *editorNode) :
+ SeparateColorNode(editorNode)
+ {}
+
+ NodeOperation *getColorConverter(const CompositorContext &context) const;
+};
+
+class SeparateYCCANode : public SeparateColorNode {
+public:
+ SeparateYCCANode(bNode *editorNode) :
+ SeparateColorNode(editorNode)
+ {}
+
+ NodeOperation *getColorConverter(const CompositorContext &context) const;
+};
+
+class SeparateYUVANode : public SeparateColorNode {
+public:
+ SeparateYUVANode(bNode *editorNode) :
+ SeparateColorNode(editorNode)
+ {}
+
+ NodeOperation *getColorConverter(const CompositorContext &context) const;
+};
+
+#endif
diff --git a/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp b/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp
deleted file mode 100644
index 4cd77d4bae6..00000000000
--- a/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#include "COM_SeparateHSVANode.h"
-
-#include "COM_ExecutionSystem.h"
-#include "COM_SetValueOperation.h"
-#include "COM_ConvertOperation.h"
-
-SeparateHSVANode::SeparateHSVANode(bNode *editorNode) : SeparateRGBANode(editorNode)
-{
- /* pass */
-}
-
-void SeparateHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
-{
- ConvertRGBToHSVOperation *operation = new ConvertRGBToHSVOperation();
- InputSocket *inputSocket = this->getInputSocket(0);
- if (inputSocket->isConnected()) {
- inputSocket->relinkConnections(operation->getInputSocket(0));
- addLink(graph, operation->getOutputSocket(), inputSocket);
- }
- graph->addOperation(operation);
- SeparateRGBANode::convertToOperations(graph, context);
-}
diff --git a/source/blender/compositor/nodes/COM_SeparateHSVANode.h b/source/blender/compositor/nodes/COM_SeparateHSVANode.h
deleted file mode 100644
index 6199237ebda..00000000000
--- a/source/blender/compositor/nodes/COM_SeparateHSVANode.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#ifndef _COM_SeparateHSVANode_h_
-#define _COM_SeparateHSVANode_h_
-
-#include "COM_Node.h"
-#include "DNA_node_types.h"
-#include "COM_SeparateRGBANode.h"
-
-/**
- * @brief SeparateHSVANode
- * @ingroup Node
- */
-class SeparateHSVANode : public SeparateRGBANode {
-public:
- SeparateHSVANode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
-};
-#endif
diff --git a/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp b/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp
deleted file mode 100644
index 7d9bff30a93..00000000000
--- a/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#include "COM_SeparateRGBANode.h"
-
-#include "COM_ConvertOperation.h"
-#include "COM_ExecutionSystem.h"
-#include "COM_SetValueOperation.h"
-#include "DNA_material_types.h" // the ramp types
-
-
-SeparateRGBANode::SeparateRGBANode(bNode *editorNode) : Node(editorNode)
-{
- /* pass */
-}
-
-
-void SeparateRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
-{
- InputSocket *imageSocket = this->getInputSocket(0);
- OutputSocket *outputRSocket = this->getOutputSocket(0);
- OutputSocket *outputGSocket = this->getOutputSocket(1);
- OutputSocket *outputBSocket = this->getOutputSocket(2);
- OutputSocket *outputASocket = this->getOutputSocket(3);
-
- if (outputRSocket->isConnected()) {
- SeparateChannelOperation *operation = new SeparateChannelOperation();
- operation->setChannel(0);
- imageSocket->relinkConnectionsDuplicate(operation->getInputSocket(0), 0, graph);
- outputRSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- }
- if (outputGSocket->isConnected()) {
- SeparateChannelOperation *operation = new SeparateChannelOperation();
- operation->setChannel(1);
- imageSocket->relinkConnectionsDuplicate(operation->getInputSocket(0), 0, graph);
- outputGSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- }
- if (outputBSocket->isConnected()) {
- SeparateChannelOperation *operation = new SeparateChannelOperation();
- operation->setChannel(2);
- imageSocket->relinkConnectionsDuplicate(operation->getInputSocket(0), 0, graph);
- outputBSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- }
- if (outputASocket->isConnected()) {
- SeparateChannelOperation *operation = new SeparateChannelOperation();
- operation->setChannel(3);
- imageSocket->relinkConnectionsDuplicate(operation->getInputSocket(0), 0, graph);
- outputASocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- }
-
- /* remove the original connection to the node, this has been duplicated for all operations */
- imageSocket->unlinkConnections(graph);
-}
diff --git a/source/blender/compositor/nodes/COM_SeparateRGBANode.h b/source/blender/compositor/nodes/COM_SeparateRGBANode.h
deleted file mode 100644
index 35321304d99..00000000000
--- a/source/blender/compositor/nodes/COM_SeparateRGBANode.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-#ifndef _COM_SeparateRGBANode_h_
-#define _COM_SeparateRGBANode_h_
-
-#include "COM_Node.h"
-#include "DNA_node_types.h"
-/**
- * @brief SeparateRGBANode
- * @ingroup Node
- */
-class SeparateRGBANode : public Node {
-public:
- SeparateRGBANode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
-};
-#endif
diff --git a/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp b/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp
deleted file mode 100644
index 797cd49316a..00000000000
--- a/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Dalai Felinto
- */
-
-#include "COM_SeparateYCCANode.h"
-#include "COM_ExecutionSystem.h"
-#include "COM_SetValueOperation.h"
-#include "COM_ConvertOperation.h"
-
-SeparateYCCANode::SeparateYCCANode(bNode *editorNode) : SeparateRGBANode(editorNode)
-{
- /* pass */
-}
-
-void SeparateYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
-{
- ConvertRGBToYCCOperation *operation = new ConvertRGBToYCCOperation();
- InputSocket *inputSocket = this->getInputSocket(0);
-
- bNode *node = this->getbNode();
- operation->setMode(node->custom1);
-
- if (inputSocket->isConnected()) {
- inputSocket->relinkConnections(operation->getInputSocket(0));
- addLink(graph, operation->getOutputSocket(), inputSocket);
- }
- graph->addOperation(operation);
- SeparateRGBANode::convertToOperations(graph, context);
-}
diff --git a/source/blender/compositor/nodes/COM_SeparateYCCANode.h b/source/blender/compositor/nodes/COM_SeparateYCCANode.h
deleted file mode 100644
index 542e1693932..00000000000
--- a/source/blender/compositor/nodes/COM_SeparateYCCANode.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Dalai Felinto
- */
-
-#ifndef _COM_SeparateYCCANode_h_
-#define _COM_SeparateYCCANode_h_
-
-#include "COM_Node.h"
-#include "DNA_node_types.h"
-#include "COM_SeparateRGBANode.h"
-
-/**
- * @brief SeparateYCCANode
- * @ingroup Node
- */
-class SeparateYCCANode : public SeparateRGBANode {
-public:
- SeparateYCCANode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
-};
-#endif
diff --git a/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp b/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp
deleted file mode 100644
index 9a6ec20fa80..00000000000
--- a/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Dalai Felinto
- */
-
-#include "COM_SeparateYUVANode.h"
-#include "COM_ExecutionSystem.h"
-#include "COM_SetValueOperation.h"
-#include "COM_ConvertOperation.h"
-
-SeparateYUVANode::SeparateYUVANode(bNode *editorNode) : SeparateRGBANode(editorNode)
-{
- /* pass */
-}
-
-void SeparateYUVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
-{
- ConvertRGBToYUVOperation *operation = new ConvertRGBToYUVOperation();
- InputSocket *inputSocket = this->getInputSocket(0);
- if (inputSocket->isConnected()) {
- inputSocket->relinkConnections(operation->getInputSocket(0));
- addLink(graph, operation->getOutputSocket(), inputSocket);
- }
- graph->addOperation(operation);
- SeparateRGBANode::convertToOperations(graph, context);
-}
diff --git a/source/blender/compositor/nodes/COM_SeparateYUVANode.h b/source/blender/compositor/nodes/COM_SeparateYUVANode.h
deleted file mode 100644
index e51c0ce4fa6..00000000000
--- a/source/blender/compositor/nodes/COM_SeparateYUVANode.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Dalai Felinto
- */
-
-#ifndef _COM_SeparateYUVANode_h_
-#define _COM_SeparateYUVANode_h_
-
-#include "COM_Node.h"
-#include "DNA_node_types.h"
-#include "COM_SeparateRGBANode.h"
-
-/**
- * @brief SeparateYUVANode
- * @ingroup Node
- */
-class SeparateYUVANode : public SeparateRGBANode {
-public:
- SeparateYUVANode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
-};
-#endif
diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
index dd3ff5fbaa7..22ddd5bb157 100644
--- a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
+++ b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
@@ -24,17 +24,17 @@
#include "COM_SetAlphaOperation.h"
#include "COM_ExecutionSystem.h"
-void SetAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void SetAlphaNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
SetAlphaOperation *operation = new SetAlphaOperation();
-
- if (!this->getInputSocket(0)->isConnected() && this->getInputSocket(1)->isConnected()) {
+
+ if (!this->getInputSocket(0)->isLinked() && this->getInputSocket(1)->isLinked()) {
operation->setResolutionInputSocketIndex(1);
}
-
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- graph->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());
}
diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.h b/source/blender/compositor/nodes/COM_SetAlphaNode.h
index e82fa210a89..6dbc7ebed04 100644
--- a/source/blender/compositor/nodes/COM_SetAlphaNode.h
+++ b/source/blender/compositor/nodes/COM_SetAlphaNode.h
@@ -32,7 +32,7 @@
class SetAlphaNode : public Node {
public:
SetAlphaNode(bNode *editorNode) : Node(editorNode) {}
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 c822d2107ec..f750a44a788 100644
--- a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
+++ b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
@@ -21,7 +21,6 @@
*/
#include "COM_SocketProxyNode.h"
-#include "COM_SocketConnection.h"
#include "COM_SocketProxyOperation.h"
#include "COM_ExecutionSystem.h"
#include "COM_SetValueOperation.h"
@@ -30,15 +29,14 @@
#include "COM_WriteBufferOperation.h"
#include "COM_ReadBufferOperation.h"
-SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool buffer) : Node(editorNode, false)
+SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput) : Node(editorNode, false)
{
DataType dt;
- this->m_buffer = buffer;
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, (InputSocketResizeMode)editorInput->resizemode, editorInput);
+ this->addInputSocket(dt, editorInput);
dt = COM_DT_VALUE;
if (editorOutput->type == SOCK_RGBA) dt = COM_DT_COLOR;
@@ -46,59 +44,39 @@ SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bN
this->addOutputSocket(dt, editorOutput);
}
-void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void SocketProxyNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- OutputSocket *outputsocket = this->getOutputSocket(0);
- InputSocket *inputsocket = this->getInputSocket(0);
- if (inputsocket->isConnected()) {
- SocketProxyOperation *operation = new SocketProxyOperation(this->getOutputSocket()->getDataType());
- inputsocket->relinkConnections(operation->getInputSocket(0));
- outputsocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
-
- if (m_buffer) {
- WriteBufferOperation *writeOperation = new WriteBufferOperation();
- ReadBufferOperation *readOperation = new ReadBufferOperation();
- readOperation->setMemoryProxy(writeOperation->getMemoryProxy());
-
- operation->getOutputSocket()->relinkConnections(readOperation->getOutputSocket());
- addLink(graph, operation->getOutputSocket(), writeOperation->getInputSocket(0));
-
- graph->addOperation(writeOperation);
- graph->addOperation(readOperation);
- }
- }
- else if (outputsocket->isConnected()) {
- /* If input is not connected, add a constant value operation instead */
- switch (outputsocket->getDataType()) {
- case COM_DT_VALUE:
- {
- SetValueOperation *operation = new SetValueOperation();
- operation->setValue(inputsocket->getEditorValueFloat());
- outputsocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- break;
- }
- case COM_DT_COLOR:
- {
- SetColorOperation *operation = new SetColorOperation();
- float col[4];
- inputsocket->getEditorValueColor(col);
- operation->setChannels(col);
- outputsocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- break;
- }
- case COM_DT_VECTOR:
- {
- SetVectorOperation *operation = new SetVectorOperation();
- float vec[3];
- inputsocket->getEditorValueVector(vec);
- operation->setVector(vec);
- outputsocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- break;
- }
- }
- }
+ NodeOperationOutput *proxy_output = converter.addInputProxy(getInputSocket(0));
+ converter.mapOutputSocket(getOutputSocket(), proxy_output);
+}
+
+
+SocketBufferNode::SocketBufferNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput) : Node(editorNode, false)
+{
+ 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 (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
+{
+ NodeOutput *output = this->getOutputSocket(0);
+ NodeInput *input = this->getInputSocket(0);
+
+ WriteBufferOperation *writeOperation = new WriteBufferOperation();
+ ReadBufferOperation *readOperation = new ReadBufferOperation();
+ readOperation->setMemoryProxy(writeOperation->getMemoryProxy());
+ converter.addOperation(writeOperation);
+ converter.addOperation(readOperation);
+
+ 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 b679901ba2c..2fbaa71421c 100644
--- a/source/blender/compositor/nodes/COM_SocketProxyNode.h
+++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h
@@ -30,13 +30,16 @@
* @ingroup Node
*/
class SocketProxyNode : public Node {
-private:
- bool m_buffer;
public:
- SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool buffer);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
+};
+
- virtual bool isProxyNode() const { return true; }
+class SocketBufferNode : public Node {
+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 6fb8467674b..8eb1b76e890 100644
--- a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
@@ -32,14 +32,14 @@ SplitViewerNode::SplitViewerNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void SplitViewerNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *editorNode = this->getbNode();
- bool is_active = ((editorNode->flag & NODE_DO_OUTPUT_RECALC || context->isRendering()) &&
+ bool is_active = ((editorNode->flag & NODE_DO_OUTPUT_RECALC || context.isRendering()) &&
(editorNode->flag & NODE_DO_OUTPUT) && this->isInActiveGroup());
- InputSocket *image1Socket = this->getInputSocket(0);
- InputSocket *image2Socket = this->getInputSocket(1);
+ NodeInput *image1Socket = this->getInputSocket(0);
+ NodeInput *image2Socket = this->getInputSocket(1);
Image *image = (Image *)this->getbNode()->id;
ImageUser *imageUser = (ImageUser *) this->getbNode()->storage;
@@ -47,15 +47,16 @@ void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorCont
splitViewerOperation->setSplitPercentage(this->getbNode()->custom1);
splitViewerOperation->setXSplit(!this->getbNode()->custom2);
- image1Socket->relinkConnections(splitViewerOperation->getInputSocket(0), 0, graph);
- image2Socket->relinkConnections(splitViewerOperation->getInputSocket(1), 1, graph);
+ 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->setActive(is_active);
- viewerOperation->setViewSettings(context->getViewSettings());
- viewerOperation->setDisplaySettings(context->getDisplaySettings());
+ viewerOperation->setViewSettings(context.getViewSettings());
+ viewerOperation->setDisplaySettings(context.getDisplaySettings());
/* 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 */
@@ -63,10 +64,8 @@ void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorCont
viewerOperation->setCenterX(0.5f);
viewerOperation->setCenterY(0.5f);
- addLink(graph, splitViewerOperation->getOutputSocket(), viewerOperation->getInputSocket(0));
+ converter.addOperation(viewerOperation);
+ converter.addLink(splitViewerOperation->getOutputSocket(), viewerOperation->getInputSocket(0));
- addPreviewOperation(graph, context, viewerOperation->getInputSocket(0));
-
- graph->addOperation(splitViewerOperation);
- graph->addOperation(viewerOperation);
+ converter.addPreview(splitViewerOperation->getOutputSocket());
}
diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.h b/source/blender/compositor/nodes/COM_SplitViewerNode.h
index f17cfd57cbf..1cc0c4cb9a8 100644
--- a/source/blender/compositor/nodes/COM_SplitViewerNode.h
+++ b/source/blender/compositor/nodes/COM_SplitViewerNode.h
@@ -32,6 +32,6 @@
class SplitViewerNode : public Node {
public:
SplitViewerNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 8f17c4d9345..d1babcc8103 100644
--- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
+++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
@@ -38,60 +38,59 @@ Stabilize2dNode::Stabilize2dNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void Stabilize2dNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *imageInput = this->getInputSocket(0);
+ NodeInput *imageInput = this->getInputSocket(0);
MovieClip *clip = (MovieClip *)getbNode()->id;
ScaleOperation *scaleOperation = new ScaleOperation();
+ scaleOperation->setSampler((PixelSampler)this->getbNode()->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)this->getbNode()->custom1);
+
scaleAttribute->setAttribute(MCA_SCALE);
- scaleAttribute->setFramenumber(context->getFramenumber());
+ scaleAttribute->setFramenumber(context.getFramenumber());
scaleAttribute->setMovieClip(clip);
-
+
angleAttribute->setAttribute(MCA_ANGLE);
- angleAttribute->setFramenumber(context->getFramenumber());
+ angleAttribute->setFramenumber(context.getFramenumber());
angleAttribute->setMovieClip(clip);
-
+
xAttribute->setAttribute(MCA_X);
- xAttribute->setFramenumber(context->getFramenumber());
+ xAttribute->setFramenumber(context.getFramenumber());
xAttribute->setMovieClip(clip);
yAttribute->setAttribute(MCA_Y);
- yAttribute->setFramenumber(context->getFramenumber());
+ yAttribute->setFramenumber(context.getFramenumber());
yAttribute->setMovieClip(clip);
- imageInput->relinkConnections(scaleOperation->getInputSocket(0), 0, graph);
- addLink(graph, scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1));
- addLink(graph, scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2));
+ converter.addOperation(scaleAttribute);
+ converter.addOperation(angleAttribute);
+ converter.addOperation(xAttribute);
+ converter.addOperation(yAttribute);
+ converter.addOperation(scaleOperation);
+ converter.addOperation(translateOperation);
+ converter.addOperation(rotateOperation);
+ converter.addOperation(psoperation);
- scaleOperation->setSampler((PixelSampler)this->getbNode()->custom1);
+ converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0));
+ converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1));
+ converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2));
- addLink(graph, scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0));
- addLink(graph, angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1));
- rotateOperation->setDoDegree2RadConversion(false);
+ converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0));
+ converter.addLink(angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1));
- addLink(graph, rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0));
- addLink(graph, xAttribute->getOutputSocket(), translateOperation->getInputSocket(1));
- addLink(graph, yAttribute->getOutputSocket(), translateOperation->getInputSocket(2));
-
- psoperation->setSampler((PixelSampler)this->getbNode()->custom1);
- addLink(graph, translateOperation->getOutputSocket(), psoperation->getInputSocket(0));
- this->getOutputSocket()->relinkConnections(psoperation->getOutputSocket());
+ converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0));
+ converter.addLink(xAttribute->getOutputSocket(), translateOperation->getInputSocket(1));
+ converter.addLink(yAttribute->getOutputSocket(), translateOperation->getInputSocket(2));
- graph->addOperation(scaleAttribute);
- graph->addOperation(angleAttribute);
- graph->addOperation(xAttribute);
- graph->addOperation(yAttribute);
- graph->addOperation(scaleOperation);
- graph->addOperation(translateOperation);
- graph->addOperation(rotateOperation);
- graph->addOperation(psoperation);
+ 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 3363ff4142c..3b5890460c2 100644
--- a/source/blender/compositor/nodes/COM_Stabilize2dNode.h
+++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.h
@@ -33,7 +33,7 @@
class Stabilize2dNode : public Node {
public:
Stabilize2dNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 2a4616fcd3e..692b8d743f6 100644
--- a/source/blender/compositor/nodes/COM_SwitchNode.cpp
+++ b/source/blender/compositor/nodes/COM_SwitchNode.cpp
@@ -21,27 +21,21 @@
*/
#include "COM_SwitchNode.h"
-#include "COM_ExecutionSystem.h"
-#include "COM_SocketProxyOperation.h"
SwitchNode::SwitchNode(bNode *editorNode) : Node(editorNode)
{
/* pass */
}
-
-void SwitchNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void SwitchNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- SocketProxyOperation *operation = new SocketProxyOperation(COM_DT_COLOR);
- int switchFrame = this->getbNode()->custom1;
-
- if (!switchFrame) {
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- }
- else {
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(0), 1, graph);
- }
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
- graph->addOperation(operation);
+ bool condition = this->getbNode()->custom1;
+
+ NodeOperationOutput *result;
+ if (!condition)
+ result = converter.addInputProxy(getInputSocket(0));
+ else
+ result = converter.addInputProxy(getInputSocket(1));
+
+ converter.mapOutputSocket(getOutputSocket(0), result);
}
diff --git a/source/blender/compositor/nodes/COM_SwitchNode.h b/source/blender/compositor/nodes/COM_SwitchNode.h
index 16d9e18885b..4fedf4b0aa7 100644
--- a/source/blender/compositor/nodes/COM_SwitchNode.h
+++ b/source/blender/compositor/nodes/COM_SwitchNode.h
@@ -33,6 +33,6 @@
class SwitchNode : public Node {
public:
SwitchNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 6f2baa63b0e..2ac027ca326 100644
--- a/source/blender/compositor/nodes/COM_TextureNode.cpp
+++ b/source/blender/compositor/nodes/COM_TextureNode.cpp
@@ -29,30 +29,31 @@ TextureNode::TextureNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
+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();
+ const ColorManagedDisplaySettings *displaySettings = context.getDisplaySettings();
bool sceneColorManage = strcmp(displaySettings->display_device, "None") != 0;
- this->getOutputSocket(1)->relinkConnections(operation->getOutputSocket());
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, system);
operation->setTexture(texture);
- operation->setRenderData(context->getRenderData());
+ operation->setRenderData(context.getRenderData());
operation->setSceneColorManage(sceneColorManage);
- system->addOperation(operation);
- addPreviewOperation(system, context, operation->getOutputSocket());
+ converter.addOperation(operation);
+
+ converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
+ converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
+ converter.mapOutputSocket(getOutputSocket(1), operation->getOutputSocket());
+
+ converter.addPreview(operation->getOutputSocket());
- if (this->getOutputSocket(0)->isConnected()) {
- TextureAlphaOperation *alphaOperation = new TextureAlphaOperation();
- this->getOutputSocket(0)->relinkConnections(alphaOperation->getOutputSocket());
- addLink(system, operation->getInputSocket(0)->getConnection()->getFromSocket(), alphaOperation->getInputSocket(0));
- addLink(system, operation->getInputSocket(1)->getConnection()->getFromSocket(), alphaOperation->getInputSocket(1));
- alphaOperation->setTexture(texture);
- alphaOperation->setRenderData(context->getRenderData());
- alphaOperation->setSceneColorManage(sceneColorManage);
- system->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());
}
diff --git a/source/blender/compositor/nodes/COM_TextureNode.h b/source/blender/compositor/nodes/COM_TextureNode.h
index e0d931c65da..8d0fb467b1b 100644
--- a/source/blender/compositor/nodes/COM_TextureNode.h
+++ b/source/blender/compositor/nodes/COM_TextureNode.h
@@ -30,5 +30,5 @@
class TextureNode : public Node {
public:
TextureNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 83f99a16d9f..b5e8ece9028 100644
--- a/source/blender/compositor/nodes/COM_TimeNode.cpp
+++ b/source/blender/compositor/nodes/COM_TimeNode.cpp
@@ -33,15 +33,14 @@ TimeNode::TimeNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void TimeNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
SetValueOperation *operation = new SetValueOperation();
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
bNode *node = this->getbNode();
/* stack order output: fac */
float fac = 0.0f;
- const int framenumber = context->getFramenumber();
+ const int framenumber = context.getFramenumber();
if (framenumber < node->custom1) {
fac = 0.0f;
@@ -50,11 +49,13 @@ void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
fac = 1.0f;
}
else if (node->custom1 < node->custom2) {
- fac = (context->getFramenumber() - node->custom1) / (float)(node->custom2 - node->custom1);
+ 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(CLAMPIS(fac, 0.0f, 1.0f));
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ 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 df3cf024714..078720f7150 100644
--- a/source/blender/compositor/nodes/COM_TimeNode.h
+++ b/source/blender/compositor/nodes/COM_TimeNode.h
@@ -32,7 +32,7 @@
class TimeNode : public Node {
public:
TimeNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 440e6b62414..5ac73b9f9c2 100644
--- a/source/blender/compositor/nodes/COM_TonemapNode.cpp
+++ b/source/blender/compositor/nodes/COM_TonemapNode.cpp
@@ -29,13 +29,14 @@ TonemapNode::TonemapNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void TonemapNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
+void TonemapNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
NodeTonemap *data = (NodeTonemap *)this->getbNode()->storage;
+
TonemapOperation *operation = data->type == 1 ? new PhotoreceptorTonemapOperation() : new TonemapOperation();
- operation->setbNode(this->getbNode());
operation->setData(data);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- system->addOperation(operation);
+ 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_TonemapNode.h b/source/blender/compositor/nodes/COM_TonemapNode.h
index ad0d218826a..4a8636fd041 100644
--- a/source/blender/compositor/nodes/COM_TonemapNode.h
+++ b/source/blender/compositor/nodes/COM_TonemapNode.h
@@ -32,7 +32,7 @@
class TonemapNode : public Node {
public:
TonemapNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 bb8cecc60ad..75c8c786ae8 100644
--- a/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
+++ b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
@@ -36,27 +36,24 @@ TrackPositionNode::TrackPositionNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void TrackPositionNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void TrackPositionNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- OutputSocket *outputX = this->getOutputSocket(0);
- OutputSocket *outputY = this->getOutputSocket(1);
-
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);
int frame_number;
if (editorNode->custom1 == CMP_TRACKPOS_ABSOLUTE_FRAME) {
frame_number = editorNode->custom2;
}
else {
- frame_number = context->getFramenumber();
+ frame_number = context.getFramenumber();
}
TrackPositionOperation *operationX = new TrackPositionOperation();
- TrackPositionOperation *operationY = new TrackPositionOperation();
-
operationX->setMovieClip(clip);
operationX->setTrackingObject(trackpos_data->tracking_object);
operationX->setTrackName(trackpos_data->track_name);
@@ -64,7 +61,9 @@ void TrackPositionNode::convertToOperations(ExecutionSystem *graph, CompositorCo
operationX->setAxis(0);
operationX->setPosition(editorNode->custom1);
operationX->setRelativeFrame(editorNode->custom2);
-
+ converter.addOperation(operationX);
+
+ TrackPositionOperation *operationY = new TrackPositionOperation();
operationY->setMovieClip(clip);
operationY->setTrackingObject(trackpos_data->tracking_object);
operationY->setTrackName(trackpos_data->track_name);
@@ -72,10 +71,8 @@ void TrackPositionNode::convertToOperations(ExecutionSystem *graph, CompositorCo
operationY->setAxis(1);
operationY->setPosition(editorNode->custom1);
operationY->setRelativeFrame(editorNode->custom2);
-
- outputX->relinkConnections(operationX->getOutputSocket());
- outputY->relinkConnections(operationY->getOutputSocket());
-
- graph->addOperation(operationX);
- graph->addOperation(operationY);
+ converter.addOperation(operationY);
+
+ converter.mapOutputSocket(outputX, operationX->getOutputSocket());
+ converter.mapOutputSocket(outputY, operationY->getOutputSocket());
}
diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.h b/source/blender/compositor/nodes/COM_TrackPositionNode.h
index 3d92ec3978c..375e28b6f8f 100644
--- a/source/blender/compositor/nodes/COM_TrackPositionNode.h
+++ b/source/blender/compositor/nodes/COM_TrackPositionNode.h
@@ -31,6 +31,6 @@
class TrackPositionNode : public Node {
public:
TrackPositionNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 154761665cf..8878d4f706e 100644
--- a/source/blender/compositor/nodes/COM_TransformNode.cpp
+++ b/source/blender/compositor/nodes/COM_TransformNode.cpp
@@ -33,38 +33,39 @@ TransformNode::TransformNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void TransformNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void TransformNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *imageInput = this->getInputSocket(0);
- InputSocket *xInput = this->getInputSocket(1);
- InputSocket *yInput = this->getInputSocket(2);
- InputSocket *angleInput = this->getInputSocket(3);
- InputSocket *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);
+
RotateOperation *rotateOperation = new RotateOperation();
+ rotateOperation->setDoDegree2RadConversion(false);
+ converter.addOperation(rotateOperation);
+
TranslateOperation *translateOperation = new TranslateOperation();
+ converter.addOperation(translateOperation);
+
SetSamplerOperation *sampler = new SetSamplerOperation();
-
sampler->setSampler((PixelSampler)this->getbNode()->custom1);
+ converter.addOperation(sampler);
- imageInput->relinkConnections(sampler->getInputSocket(0), 0, graph);
- addLink(graph, sampler->getOutputSocket(), scaleOperation->getInputSocket(0));
- scaleInput->relinkConnections(scaleOperation->getInputSocket(1), 4, graph);
- addLink(graph, scaleOperation->getInputSocket(1)->getConnection()->getFromSocket(), 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.addLink(sampler->getOutputSocket(), scaleOperation->getInputSocket(2)); // xscale = yscale
- addLink(graph, scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0));
- rotateOperation->setDoDegree2RadConversion(false);
- angleInput->relinkConnections(rotateOperation->getInputSocket(1), 3, graph);
-
- addLink(graph, rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0));
- xInput->relinkConnections(translateOperation->getInputSocket(1), 1, graph);
- yInput->relinkConnections(translateOperation->getInputSocket(2), 2, graph);
+ converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0));
+ converter.mapInputSocket(angleInput, rotateOperation->getInputSocket(1));
- this->getOutputSocket()->relinkConnections(translateOperation->getOutputSocket());
+ converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0));
+ converter.mapInputSocket(xInput, translateOperation->getInputSocket(1));
+ converter.mapInputSocket(yInput, translateOperation->getInputSocket(2));
- graph->addOperation(sampler);
- graph->addOperation(scaleOperation);
- graph->addOperation(rotateOperation);
- graph->addOperation(translateOperation);
+ converter.mapOutputSocket(getOutputSocket(), translateOperation->getOutputSocket());
}
diff --git a/source/blender/compositor/nodes/COM_TransformNode.h b/source/blender/compositor/nodes/COM_TransformNode.h
index 666f2da775e..6e210d266de 100644
--- a/source/blender/compositor/nodes/COM_TransformNode.h
+++ b/source/blender/compositor/nodes/COM_TransformNode.h
@@ -33,7 +33,7 @@
class TransformNode : public Node {
public:
TransformNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif /* __COM_TRANSFORMNODE_H__ */
diff --git a/source/blender/compositor/nodes/COM_TranslateNode.cpp b/source/blender/compositor/nodes/COM_TranslateNode.cpp
index d2cd009449c..990cbe19be2 100644
--- a/source/blender/compositor/nodes/COM_TranslateNode.cpp
+++ b/source/blender/compositor/nodes/COM_TranslateNode.cpp
@@ -32,44 +32,43 @@ TranslateNode::TranslateNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void TranslateNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void TranslateNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *inputSocket = this->getInputSocket(0);
- InputSocket *inputXSocket = this->getInputSocket(1);
- InputSocket *inputYSocket = this->getInputSocket(2);
- OutputSocket *outputSocket = this->getOutputSocket(0);
- TranslateOperation *operation = new TranslateOperation();
-
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);
+
+ 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);
+ }
+
+ 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();
WrapOperation *wrapOperation = new WrapOperation();
wrapOperation->setMemoryProxy(writeOperation->getMemoryProxy());
wrapOperation->setWrapping(data->wrap_axis);
- inputSocket->relinkConnections(writeOperation->getInputSocket(0), 0, graph);
- addLink(graph, wrapOperation->getOutputSocket(), operation->getInputSocket(0));
-
- graph->addOperation(writeOperation);
- graph->addOperation(wrapOperation);
+ converter.addOperation(writeOperation);
+ converter.addOperation(wrapOperation);
+ converter.mapInputSocket(inputSocket, writeOperation->getInputSocket(0));
+ converter.addLink(wrapOperation->getOutputSocket(), operation->getInputSocket(0));
}
else {
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
+ converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
}
-
- 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);
- }
-
- inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
- inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
}
diff --git a/source/blender/compositor/nodes/COM_TranslateNode.h b/source/blender/compositor/nodes/COM_TranslateNode.h
index 8c350e9cfb3..160da410aff 100644
--- a/source/blender/compositor/nodes/COM_TranslateNode.h
+++ b/source/blender/compositor/nodes/COM_TranslateNode.h
@@ -32,7 +32,7 @@
class TranslateNode : public Node {
public:
TranslateNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 ed4440aa099..62a312da67c 100644
--- a/source/blender/compositor/nodes/COM_ValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_ValueNode.cpp
@@ -29,11 +29,12 @@ ValueNode::ValueNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ValueNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
SetValueOperation *operation = new SetValueOperation();
- OutputSocket *output = this->getOutputSocket(0);
- output->relinkConnections(operation->getOutputSocket());
+ NodeOutput *output = this->getOutputSocket(0);
operation->setValue(output->getEditorValueFloat());
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ converter.mapOutputSocket(output, operation->getOutputSocket());
}
diff --git a/source/blender/compositor/nodes/COM_ValueNode.h b/source/blender/compositor/nodes/COM_ValueNode.h
index 4f478ae93af..e5b80fb4c60 100644
--- a/source/blender/compositor/nodes/COM_ValueNode.h
+++ b/source/blender/compositor/nodes/COM_ValueNode.h
@@ -32,7 +32,7 @@
class ValueNode : public Node {
public:
ValueNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 07c8120b1d2..cbe02388f90 100644
--- a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp
@@ -29,17 +29,18 @@ VectorBlurNode::VectorBlurNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void VectorBlurNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
+void VectorBlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *node = this->getbNode();
NodeBlurData *vectorBlurSettings = (NodeBlurData *)node->storage;
+
VectorBlurOperation *operation = new VectorBlurOperation();
- operation->setbNode(node);
operation->setVectorBlurSettings(vectorBlurSettings);
- operation->setQuality(context->getQuality());
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, system);
- this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, system);
- this->getOutputSocket()->relinkConnections(operation->getOutputSocket());
- system->addOperation(operation);
+ 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());
}
diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.h b/source/blender/compositor/nodes/COM_VectorBlurNode.h
index 6b5d277a54b..f402aee9670 100644
--- a/source/blender/compositor/nodes/COM_VectorBlurNode.h
+++ b/source/blender/compositor/nodes/COM_VectorBlurNode.h
@@ -32,7 +32,7 @@
class VectorBlurNode : public Node {
public:
VectorBlurNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 dcf1059ece6..197b2c8bd0c 100644
--- a/source/blender/compositor/nodes/COM_VectorCurveNode.cpp
+++ b/source/blender/compositor/nodes/COM_VectorCurveNode.cpp
@@ -29,14 +29,12 @@ VectorCurveNode::VectorCurveNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void VectorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void VectorCurveNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
VectorCurveOperation *operation = new VectorCurveOperation();
-
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
operation->setCurveMapping((CurveMapping *)this->getbNode()->storage);
-
- graph->addOperation(operation);
+ converter.addOperation(operation);
+
+ 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 3201090df14..8499bbf99df 100644
--- a/source/blender/compositor/nodes/COM_VectorCurveNode.h
+++ b/source/blender/compositor/nodes/COM_VectorCurveNode.h
@@ -32,7 +32,7 @@
class VectorCurveNode : public Node {
public:
VectorCurveNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 a515bfc7f47..30f51794e8d 100644
--- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
@@ -31,52 +31,34 @@ ViewLevelsNode::ViewLevelsNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ViewLevelsNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ViewLevelsNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- InputSocket *input = this->getInputSocket(0);
- bool firstOperationConnected = false;
- if (input->isConnected()) {
- OutputSocket *inputSocket = input->getConnection()->getFromSocket();
+ NodeInput *input = this->getInputSocket(0);
+ if (input->isLinked()) {
// add preview to inputSocket;
- OutputSocket *socket = this->getOutputSocket(0);
- if (socket->isConnected()) {
- // calculate mean operation
+ /* calculate mean operation */
+ {
CalculateMeanOperation *operation = new CalculateMeanOperation();
- input->relinkConnections(operation->getInputSocket(0), 0, graph);
- firstOperationConnected = true;
operation->setSetting(this->getbNode()->custom1);
- socket->relinkConnections(operation->getOutputSocket());
- graph->addOperation(operation);
+
+ converter.addOperation(operation);
+ converter.mapInputSocket(input, operation->getInputSocket(0));
+ converter.mapOutputSocket(this->getOutputSocket(0), operation->getOutputSocket());
}
- socket = this->getOutputSocket(1);
- if (socket->isConnected()) {
- // calculate standard deviation operation
+ /* calculate standard deviation operation */
+ {
CalculateStandardDeviationOperation *operation = new CalculateStandardDeviationOperation();
- if (firstOperationConnected) {
- addLink(graph, inputSocket, operation->getInputSocket(0));
- }
- else {
- input->relinkConnections(operation->getInputSocket(0), 0, graph);
- }
operation->setSetting(this->getbNode()->custom1);
- socket->relinkConnections(operation->getOutputSocket());
- graph->addOperation(operation);
+
+ converter.addOperation(operation);
+ converter.mapInputSocket(input, operation->getInputSocket(0));
+ converter.mapOutputSocket(this->getOutputSocket(1), operation->getOutputSocket());
}
}
else {
- SetValueOperation *meanOutput = new SetValueOperation();
- SetValueOperation *stdDevOutput = new SetValueOperation();
-
- meanOutput->setValue(0.0f);
- stdDevOutput->setValue(0.0f);
-
- this->getOutputSocket(0)->relinkConnections(meanOutput->getOutputSocket());
- this->getOutputSocket(1)->relinkConnections(stdDevOutput->getOutputSocket());
-
- graph->addOperation(meanOutput);
- graph->addOperation(stdDevOutput);
+ converter.addOutputValue(getOutputSocket(0), 0.0f);
+ converter.addOutputValue(getOutputSocket(1), 0.0f);
}
}
-
diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.h b/source/blender/compositor/nodes/COM_ViewLevelsNode.h
index 2ac84fad22f..dbcc770f88a 100644
--- a/source/blender/compositor/nodes/COM_ViewLevelsNode.h
+++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.h
@@ -32,7 +32,7 @@
class ViewLevelsNode : public Node {
public:
ViewLevelsNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 531fa4158bc..5e37bf06dc2 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp
@@ -31,19 +31,19 @@ ViewerNode::ViewerNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+void ViewerNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *editorNode = this->getbNode();
- bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC || context->isRendering()) &&
+ bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC || context.isRendering()) &&
((editorNode->flag & NODE_DO_OUTPUT) && this->isInActiveGroup());
- InputSocket *imageSocket = this->getInputSocket(0);
- InputSocket *alphaSocket = this->getInputSocket(1);
- InputSocket *depthSocket = this->getInputSocket(2);
+ 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->setbNodeTree(context.getbNodeTree());
viewerOperation->setImage(image);
viewerOperation->setImageUser(imageUser);
viewerOperation->setActive(is_active);
@@ -52,20 +52,20 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
viewerOperation->setCenterY(editorNode->custom4);
viewerOperation->setIgnoreAlpha(editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA);
- viewerOperation->setViewSettings(context->getViewSettings());
- viewerOperation->setDisplaySettings(context->getDisplaySettings());
+ viewerOperation->setViewSettings(context.getViewSettings());
+ viewerOperation->setDisplaySettings(context.getDisplaySettings());
viewerOperation->setResolutionInputSocketIndex(0);
- if (!imageSocket->isConnected()) {
- if (alphaSocket->isConnected()) {
+ if (!imageSocket->isLinked()) {
+ if (alphaSocket->isLinked()) {
viewerOperation->setResolutionInputSocketIndex(1);
}
}
- imageSocket->relinkConnections(viewerOperation->getInputSocket(0), 0, graph);
- alphaSocket->relinkConnections(viewerOperation->getInputSocket(1));
- depthSocket->relinkConnections(viewerOperation->getInputSocket(2));
- graph->addOperation(viewerOperation);
+ converter.addOperation(viewerOperation);
+ converter.mapInputSocket(imageSocket, viewerOperation->getInputSocket(0));
+ converter.mapInputSocket(alphaSocket, viewerOperation->getInputSocket(1));
+ converter.mapInputSocket(depthSocket, viewerOperation->getInputSocket(2));
- addPreviewOperation(graph, context, viewerOperation->getInputSocket(0));
+ converter.addNodeInputPreview(imageSocket);
}
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.h b/source/blender/compositor/nodes/COM_ViewerNode.h
index 3a9954b8aea..289c2650342 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.h
+++ b/source/blender/compositor/nodes/COM_ViewerNode.h
@@ -32,6 +32,6 @@
class ViewerNode : public Node {
public:
ViewerNode(bNode *editorNode);
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ 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 685c9695eec..d46600cc368 100644
--- a/source/blender/compositor/nodes/COM_ZCombineNode.cpp
+++ b/source/blender/compositor/nodes/COM_ZCombineNode.cpp
@@ -32,79 +32,71 @@
#include "DNA_material_types.h" // the ramp types
-void ZCombineNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
+void ZCombineNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
- if ((context->getRenderData()->scemode & R_FULL_SAMPLE) || this->getbNode()->custom2) {
- if (this->getOutputSocket(0)->isConnected()) {
- ZCombineOperation *operation = NULL;
- if (this->getbNode()->custom1) {
- operation = new ZCombineAlphaOperation();
- }
- else {
- operation = new ZCombineOperation();
- }
-
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, system);
- this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, system);
- this->getInputSocket(3)->relinkConnections(operation->getInputSocket(3), 3, system);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- system->addOperation(operation);
- if (this->getOutputSocket(1)->isConnected()) {
- MathMinimumOperation *zoperation = new MathMinimumOperation();
- addLink(system, operation->getInputSocket(1)->getConnection()->getFromSocket(), zoperation->getInputSocket(0));
- addLink(system, operation->getInputSocket(3)->getConnection()->getFromSocket(), zoperation->getInputSocket(1));
- this->getOutputSocket(1)->relinkConnections(zoperation->getOutputSocket());
- system->addOperation(zoperation);
- }
+ if ((context.getRenderData()->scemode & R_FULL_SAMPLE) || this->getbNode()->custom2) {
+ ZCombineOperation *operation = NULL;
+ if (this->getbNode()->custom1) {
+ operation = new ZCombineAlphaOperation();
}
else {
- if (this->getOutputSocket(1)->isConnected()) {
- MathMinimumOperation *zoperation = new MathMinimumOperation();
- this->getInputSocket(1)->relinkConnections(zoperation->getInputSocket(0), 1, system);
- this->getInputSocket(3)->relinkConnections(zoperation->getInputSocket(1), 3, system);
- this->getOutputSocket(1)->relinkConnections(zoperation->getOutputSocket());
- system->addOperation(zoperation);
- }
+ 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();
- this->getInputSocket(1)->relinkConnections(maskoperation->getInputSocket(0), 3, system);
- this->getInputSocket(3)->relinkConnections(maskoperation->getInputSocket(1), 1, system);
+ converter.addOperation(maskoperation);
+
+ converter.mapInputSocket(getInputSocket(1), maskoperation->getInputSocket(0));
+ converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1));
}
else {
maskoperation = new MathLessThanOperation();
- this->getInputSocket(1)->relinkConnections(maskoperation->getInputSocket(0), 1, system);
- this->getInputSocket(3)->relinkConnections(maskoperation->getInputSocket(1), 3, system);
+ 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();
- addLink(system, maskoperation->getOutputSocket(), antialiasoperation->getInputSocket(0));
+ 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();
- addLink(system, antialiasoperation->getOutputSocket(), zcombineoperation->getInputSocket(0));
- this->getInputSocket(0)->relinkConnections(zcombineoperation->getInputSocket(1), 0, system);
- this->getInputSocket(2)->relinkConnections(zcombineoperation->getInputSocket(2), 2, system);
- this->getOutputSocket(0)->relinkConnections(zcombineoperation->getOutputSocket());
+ 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());
- system->addOperation(maskoperation);
- system->addOperation(antialiasoperation);
- system->addOperation(zcombineoperation);
-
- if (this->getOutputSocket(1)->isConnected()) {
- MathMinimumOperation *zoperation = new MathMinimumOperation();
- addLink(system, maskoperation->getInputSocket(0)->getConnection()->getFromSocket(), zoperation->getInputSocket(0));
- addLink(system, maskoperation->getInputSocket(1)->getConnection()->getFromSocket(), zoperation->getInputSocket(1));
- this->getOutputSocket(1)->relinkConnections(zoperation->getOutputSocket());
- system->addOperation(zoperation);
- }
+ 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 61f4037be90..474be8db6ba 100644
--- a/source/blender/compositor/nodes/COM_ZCombineNode.h
+++ b/source/blender/compositor/nodes/COM_ZCombineNode.h
@@ -32,7 +32,7 @@
class ZCombineNode : public Node {
public:
ZCombineNode(bNode *editorNode) : Node(editorNode) {}
- void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+ void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
};
#endif