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:
authorLukas Tönne <lukas.toenne@gmail.com>2014-04-15 18:06:12 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-04-15 18:28:10 +0400
commit09874df135888b89f51d7becaa369ebb1d1623c6 (patch)
treebccf5950d42963992adff95dbc3f00ed7db1cf16
parent28a829893c702918afc5ac1945a06eaefa611594 (diff)
Structural cleanup and improvements for the compositor.
Many parts of the compositor are unnecessarily complicated. This patch aims at reducing the complexity of writing nodes and making the code more transparent. == Separating Nodes and Operations == Currently these are both mixed in the same graph, even though they have very different purposes and are used at distinct stages in the compositing process. The patch introduces dedicated graph classes for nodes and for operations. This removes the need for a lot of special case checks (isOperation etc.) and explicit type casts. It simplifies the code since it becomes clear at every stage what type of node we are dealing with. The compiler can use static typing to avoid common bugs from mixing up these types and fewer runtime sanity checks are needed. == Simplified Node Conversion == Converting nodes to operations was previously based on "relinking", i.e. nodes would start with by mirroring links in the Blender DNA node trees, then add operations and redirect these links to them. This was very hard to follow in many cases and required a lot of attention to avoid invalid states. Now there is a helper class called the NodeConverter, which is passed to nodes and implements a much simpler API for this process. Nodes can add operations and explicit connections as before, but defining "external" links to the inputs/outputs of the original node now uses mapping instead of directly modifying link data. Input data (node graph) and result (operations graph) are cleanly separated. == Removed Redundant Data Structures == A few redundant data structures have been removed, notably the SocketConnection. These are only needed temporarily during graph construction. For executing the compositor operations it is perfectly sufficient to store only the direct input link pointers. A common pointer indirection is avoided this way (which might also give a little performance improvement). == Avoid virtual recursive functions == Recursive virtual functions are evil. They are very hard to follow during debugging. At least in the parts this patch is concerned with these functions have been replaced by a non-virtual recursive core function (which might then call virtual non-recursive functions if needed). See for example NodeOperationBuilder::group_operations.
-rw-r--r--source/blender/compositor/CMakeLists.txt46
-rw-r--r--source/blender/compositor/COM_compositor.h4
-rw-r--r--source/blender/compositor/COM_defines.h2
-rw-r--r--source/blender/compositor/intern/COM_CPUDevice.cpp2
-rw-r--r--source/blender/compositor/intern/COM_ChannelInfo.h10
-rw-r--r--source/blender/compositor/intern/COM_CompositorContext.h6
-rw-r--r--source/blender/compositor/intern/COM_Converter.cpp151
-rw-r--r--source/blender/compositor/intern/COM_Converter.h34
-rw-r--r--source/blender/compositor/intern/COM_Debug.cpp141
-rw-r--r--source/blender/compositor/intern/COM_Debug.h31
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cpp104
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.h49
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp230
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.h91
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp171
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystemHelper.h126
-rw-r--r--source/blender/compositor/intern/COM_InputSocket.cpp159
-rw-r--r--source/blender/compositor/intern/COM_InputSocket.h149
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cpp5
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.h1
-rw-r--r--source/blender/compositor/intern/COM_MemoryProxy.h1
-rw-r--r--source/blender/compositor/intern/COM_Node.cpp235
-rw-r--r--source/blender/compositor/intern/COM_Node.h234
-rw-r--r--source/blender/compositor/intern/COM_NodeBase.cpp96
-rw-r--r--source/blender/compositor/intern/COM_NodeBase.h185
-rw-r--r--source/blender/compositor/intern/COM_NodeConverter.cpp131
-rw-r--r--source/blender/compositor/intern/COM_NodeConverter.h103
-rw-r--r--source/blender/compositor/intern/COM_NodeGraph.cpp280
-rw-r--r--source/blender/compositor/intern/COM_NodeGraph.h109
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.cpp138
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.h175
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.cpp661
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.h158
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.cpp2
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.h2
-rw-r--r--source/blender/compositor/intern/COM_OutputSocket.cpp119
-rw-r--r--source/blender/compositor/intern/COM_OutputSocket.h84
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedOperation.cpp (renamed from source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp)12
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedOperation.h (renamed from source/blender/compositor/intern/COM_SingleThreadedNodeOperation.h)8
-rw-r--r--source/blender/compositor/intern/COM_Socket.cpp68
-rw-r--r--source/blender/compositor/intern/COM_Socket.h100
-rw-r--r--source/blender/compositor/intern/COM_SocketConnection.cpp95
-rw-r--r--source/blender/compositor/intern/COM_SocketConnection.h127
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.cpp10
-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
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.cpp34
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp14
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp34
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_GlareBaseOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GlareBaseOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_MixOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.h1
-rw-r--r--source/blender/compositor/operations/COM_SetVectorOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_SocketProxyOperation.cpp18
-rw-r--r--source/blender/compositor/operations/COM_SocketProxyOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_SplitOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_TextureOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_TextureOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_TonemapOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_WriteBufferOperation.h3
-rw-r--r--source/blender/makesdna/DNA_node_types.h3
251 files changed, 4227 insertions, 5346 deletions
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index cbb1017facd..a19433436f1 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -54,28 +54,22 @@ set(SRC
intern/COM_compositor.cpp
intern/COM_ExecutionSystem.cpp
intern/COM_ExecutionSystem.h
- intern/COM_ExecutionSystemHelper.cpp
- intern/COM_ExecutionSystemHelper.h
+ intern/COM_NodeConverter.cpp
+ intern/COM_NodeConverter.h
+ intern/COM_NodeOperationBuilder.cpp
+ intern/COM_NodeOperationBuilder.h
+ intern/COM_NodeGraph.cpp
+ intern/COM_NodeGraph.h
intern/COM_Converter.cpp
intern/COM_Converter.h
intern/COM_ExecutionGroup.cpp
intern/COM_ExecutionGroup.h
intern/COM_Node.cpp
intern/COM_Node.h
- intern/COM_NodeBase.cpp
- intern/COM_NodeBase.h
intern/COM_NodeOperation.cpp
intern/COM_NodeOperation.h
- intern/COM_Socket.cpp
- intern/COM_Socket.h
intern/COM_SocketReader.cpp
intern/COM_SocketReader.h
- intern/COM_InputSocket.cpp
- intern/COM_InputSocket.h
- intern/COM_OutputSocket.cpp
- intern/COM_OutputSocket.h
- intern/COM_SocketConnection.cpp
- intern/COM_SocketConnection.h
intern/COM_MemoryProxy.cpp
intern/COM_MemoryProxy.h
intern/COM_MemoryBuffer.cpp
@@ -98,8 +92,8 @@ set(SRC
intern/COM_CompositorContext.h
intern/COM_ChannelInfo.cpp
intern/COM_ChannelInfo.h
- intern/COM_SingleThreadedNodeOperation.cpp
- intern/COM_SingleThreadedNodeOperation.h
+ intern/COM_SingleThreadedOperation.cpp
+ intern/COM_SingleThreadedOperation.h
intern/COM_Debug.cpp
intern/COM_Debug.h
@@ -107,10 +101,6 @@ set(SRC
operations/COM_QualityStepHelper.cpp
# Internal nodes
- nodes/COM_MuteNode.cpp
- nodes/COM_MuteNode.h
- nodes/COM_GroupNode.cpp
- nodes/COM_GroupNode.h
nodes/COM_SocketProxyNode.cpp
nodes/COM_SocketProxyNode.h
@@ -245,22 +235,10 @@ set(SRC
# converter nodes
nodes/COM_IDMaskNode.cpp
nodes/COM_IDMaskNode.h
- nodes/COM_SeparateRGBANode.cpp
- nodes/COM_SeparateRGBANode.h
- nodes/COM_CombineRGBANode.cpp
- nodes/COM_CombineRGBANode.h
- nodes/COM_SeparateHSVANode.cpp
- nodes/COM_SeparateHSVANode.h
- nodes/COM_CombineHSVANode.cpp
- nodes/COM_CombineHSVANode.h
- nodes/COM_SeparateYUVANode.cpp
- nodes/COM_SeparateYUVANode.h
- nodes/COM_CombineYUVANode.cpp
- nodes/COM_CombineYUVANode.h
- nodes/COM_SeparateYCCANode.cpp
- nodes/COM_SeparateYCCANode.h
- nodes/COM_CombineYCCANode.cpp
- nodes/COM_CombineYCCANode.h
+ nodes/COM_SeparateColorNode.cpp
+ nodes/COM_SeparateColorNode.h
+ nodes/COM_CombineColorNode.cpp
+ nodes/COM_CombineColorNode.h
nodes/COM_NormalNode.cpp
nodes/COM_NormalNode.h
diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h
index b79c26aa236..2cf2c690d3e 100644
--- a/source/blender/compositor/COM_compositor.h
+++ b/source/blender/compositor/COM_compositor.h
@@ -213,8 +213,8 @@ extern "C" {
* (is called from [@ref ExecutionGroup.scheduleChunkWhenPossible])
* @see ExecutionGroup.scheduleChunk Schedule a chunk on the WorkScheduler
* @see NodeOperation.determineDependingAreaOfInterest Influence the area of interest of a chunk.
- * @see WriteBufferOperation NodeOperation to write to a MemoryProxy/MemoryBuffer
- * @see ReadBufferOperation NodeOperation to read from a MemoryProxy/MemoryBuffer
+ * @see WriteBufferOperation Operation to write to a MemoryProxy/MemoryBuffer
+ * @see ReadBufferOperation Operation to read from a MemoryProxy/MemoryBuffer
* @see MemoryProxy proxy for information about memory image (a image consist out of multiple chunks)
* @see MemoryBuffer Allocated memory for a single chunk
*
diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h
index 6c07aadc3aa..d086f81d03c 100644
--- a/source/blender/compositor/COM_defines.h
+++ b/source/blender/compositor/COM_defines.h
@@ -24,7 +24,7 @@
#define __COM_DEFINES_H__
/**
- * @brief possible data types for SocketConnection
+ * @brief possible data types for sockets
* @ingroup Model
*/
typedef enum DataType {
diff --git a/source/blender/compositor/intern/COM_CPUDevice.cpp b/source/blender/compositor/intern/COM_CPUDevice.cpp
index 7029aa032cc..c7c3f7769fe 100644
--- a/source/blender/compositor/intern/COM_CPUDevice.cpp
+++ b/source/blender/compositor/intern/COM_CPUDevice.cpp
@@ -30,7 +30,7 @@ void CPUDevice::execute(WorkPackage *work)
executionGroup->determineChunkRect(&rect, chunkNumber);
- executionGroup->getOutputNodeOperation()->executeRegion(&rect, chunkNumber);
+ executionGroup->getOutputOperation()->executeRegion(&rect, chunkNumber);
executionGroup->finalizeChunkExecution(chunkNumber, NULL);
}
diff --git a/source/blender/compositor/intern/COM_ChannelInfo.h b/source/blender/compositor/intern/COM_ChannelInfo.h
index 44664442359..ec78e7e1cb1 100644
--- a/source/blender/compositor/intern/COM_ChannelInfo.h
+++ b/source/blender/compositor/intern/COM_ChannelInfo.h
@@ -49,8 +49,8 @@ typedef enum ChannelType {
/**
* @brief ChannelInfo holds information about a channel.
*
- * Channels are transported from node to node via a SocketConnection.
- * ChannelInfo holds specific setting of these channels in order that the to-node of the connection
+ * Channels are transported from node to node via a NodeLink.
+ * ChannelInfo holds specific setting of these channels in order that the to-node of the link
* Can handle specific logic per channel setting.
*
* @note currently this is not used, but a future place to implement color spacing and other things.
@@ -59,7 +59,7 @@ typedef enum ChannelType {
class ChannelInfo {
private:
/**
- * @brief the channel number, in the connection. [0-3]
+ * @brief the channel number, in the link. [0-3]
*/
int m_number;
@@ -87,12 +87,12 @@ public:
ChannelInfo();
/**
- * @brief set the index of this channel in the SocketConnection
+ * @brief set the index of this channel in the NodeLink
*/
void setNumber(const int number) { this->m_number = number; }
/**
- * @brief get the index of this channel in the SocketConnection
+ * @brief get the index of this channel in the NodeLink
*/
const int getNumber() const { return this->m_number; }
diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h
index 223f900b391..a398ae937a3 100644
--- a/source/blender/compositor/intern/COM_CompositorContext.h
+++ b/source/blender/compositor/intern/COM_CompositorContext.h
@@ -181,11 +181,11 @@ public:
*/
void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices) { this->m_hasActiveOpenCLDevices = hasAvtiveOpenCLDevices; }
- int getChunksize() { return this->getbNodeTree()->chunksize; }
+ int getChunksize() const { return this->getbNodeTree()->chunksize; }
void setFastCalculation(bool fastCalculation) {this->m_fastCalculation = fastCalculation;}
- bool isFastCalculation() {return this->m_fastCalculation;}
- inline bool isGroupnodeBufferEnabled() {return this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER;}
+ bool isFastCalculation() const { return this->m_fastCalculation; }
+ bool isGroupnodeBufferEnabled() const { return this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER; }
};
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index 7103b49f32f..9251e161839 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -22,7 +22,14 @@
#include <string.h>
+extern "C" {
+#include "DNA_node_types.h"
+
#include "BKE_node.h"
+}
+
+#include "COM_NodeOperationBuilder.h"
+#include "COM_NodeOperation.h"
#include "COM_AlphaOverNode.h"
#include "COM_BilateralBlurNode.h"
@@ -41,10 +48,7 @@
#include "COM_ColorRampNode.h"
#include "COM_ColorSpillNode.h"
#include "COM_ColorToBWNode.h"
-#include "COM_CombineHSVANode.h"
-#include "COM_CombineRGBANode.h"
-#include "COM_CombineYCCANode.h"
-#include "COM_CombineYUVANode.h"
+#include "COM_CombineColorNode.h"
#include "COM_CompositorNode.h"
#include "COM_ConvertAlphaNode.h"
#include "COM_ConvertOperation.h"
@@ -61,12 +65,10 @@
#include "COM_DoubleEdgeMaskNode.h"
#include "COM_EllipseMaskNode.h"
#include "COM_ExecutionSystem.h"
-#include "COM_ExecutionSystemHelper.h"
#include "COM_FilterNode.h"
#include "COM_FlipNode.h"
#include "COM_GammaNode.h"
#include "COM_GlareNode.h"
-#include "COM_GroupNode.h"
#include "COM_HueSaturationValueCorrectNode.h"
#include "COM_HueSaturationValueNode.h"
#include "COM_IDMaskNode.h"
@@ -85,7 +87,6 @@
#include "COM_MixNode.h"
#include "COM_MovieClipNode.h"
#include "COM_MovieDistortionNode.h"
-#include "COM_MuteNode.h"
#include "COM_NormalNode.h"
#include "COM_NormalizeNode.h"
#include "COM_OutputFileNode.h"
@@ -93,13 +94,9 @@
#include "COM_RotateNode.h"
#include "COM_ScaleNode.h"
#include "COM_ScaleOperation.h"
-#include "COM_SeparateHSVANode.h"
-#include "COM_SeparateRGBANode.h"
-#include "COM_SeparateYCCANode.h"
-#include "COM_SeparateYUVANode.h"
+#include "COM_SeparateColorNode.h"
#include "COM_SetAlphaNode.h"
#include "COM_SetValueOperation.h"
-#include "COM_SocketConnection.h"
#include "COM_SplitViewerNode.h"
#include "COM_Stabilize2dNode.h"
#include "COM_SwitchNode.h"
@@ -119,30 +116,24 @@
#include "COM_PixelateNode.h"
#include "COM_PlaneTrackDeformNode.h"
-Node *Converter::convert(bNode *b_node, bool fast)
+bool Converter::is_fast_node(bNode *b_node)
{
- Node *node = NULL;
+ return !(b_node->type == CMP_NODE_BLUR ||
+ b_node->type == CMP_NODE_VECBLUR ||
+ b_node->type == CMP_NODE_BILATERALBLUR ||
+ b_node->type == CMP_NODE_DEFOCUS ||
+ b_node->type == CMP_NODE_BOKEHBLUR ||
+ b_node->type == CMP_NODE_GLARE ||
+ b_node->type == CMP_NODE_DBLUR ||
+ b_node->type == CMP_NODE_MOVIEDISTORTION ||
+ b_node->type == CMP_NODE_LENSDIST ||
+ b_node->type == CMP_NODE_DOUBLEEDGEMASK ||
+ b_node->type == CMP_NODE_DILATEERODE);
+}
- if (b_node->flag & NODE_MUTED) {
- node = new MuteNode(b_node);
- return node;
- }
- if (fast) {
- if (b_node->type == CMP_NODE_BLUR ||
- b_node->type == CMP_NODE_VECBLUR ||
- b_node->type == CMP_NODE_BILATERALBLUR ||
- b_node->type == CMP_NODE_DEFOCUS ||
- b_node->type == CMP_NODE_BOKEHBLUR ||
- b_node->type == CMP_NODE_GLARE ||
- b_node->type == CMP_NODE_DBLUR ||
- b_node->type == CMP_NODE_MOVIEDISTORTION ||
- b_node->type == CMP_NODE_LENSDIST ||
- b_node->type == CMP_NODE_DOUBLEEDGEMASK ||
- b_node->type == CMP_NODE_DILATEERODE)
- {
- return new MuteNode(b_node);
- }
- }
+Node *Converter::convert(bNode *b_node)
+{
+ Node *node = NULL;
switch (b_node->type) {
case CMP_NODE_COMPOSITE:
@@ -221,11 +212,9 @@ Node *Converter::convert(bNode *b_node, bool fast)
node = new InvertNode(b_node);
break;
case NODE_GROUP:
- node = new GroupNode(b_node);
- break;
case NODE_GROUP_INPUT:
case NODE_GROUP_OUTPUT:
- /* handled in GroupNode::ungroup */
+ /* handled in NodeCompiler */
break;
case CMP_NODE_NORMAL:
node = new NormalNode(b_node);
@@ -405,52 +394,45 @@ Node *Converter::convert(bNode *b_node, bool fast)
case CMP_NODE_CORNERPIN:
node = new CornerPinNode(b_node);
break;
- default:
- node = new MuteNode(b_node);
- break;
}
return node;
}
-void Converter::convertDataType(SocketConnection *connection, ExecutionSystem *system)
+
+NodeOperation *Converter::convertDataType(NodeOperationOutput *from, NodeOperationInput *to)
{
- OutputSocket *outputSocket = connection->getFromSocket();
- InputSocket *inputSocket = connection->getToSocket();
- DataType fromDatatype = outputSocket->getDataType();
- DataType toDatatype = inputSocket->getDataType();
- NodeOperation *converter = NULL;
+ DataType fromDatatype = from->getDataType();
+ DataType toDatatype = to->getDataType();
+
if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_COLOR) {
- converter = new ConvertValueToColorOperation();
+ return new ConvertValueToColorOperation();
}
else if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_VECTOR) {
- converter = new ConvertValueToVectorOperation();
+ return new ConvertValueToVectorOperation();
}
else if (fromDatatype == COM_DT_COLOR && toDatatype == COM_DT_VALUE) {
- converter = new ConvertColorToValueOperation();
+ return new ConvertColorToValueOperation();
}
else if (fromDatatype == COM_DT_COLOR && toDatatype == COM_DT_VECTOR) {
- converter = new ConvertColorToVectorOperation();
+ return new ConvertColorToVectorOperation();
}
else if (fromDatatype == COM_DT_VECTOR && toDatatype == COM_DT_VALUE) {
- converter = new ConvertVectorToValueOperation();
+ return new ConvertVectorToValueOperation();
}
else if (fromDatatype == COM_DT_VECTOR && toDatatype == COM_DT_COLOR) {
- converter = new ConvertVectorToColorOperation();
- }
- if (converter != NULL) {
- inputSocket->relinkConnections(converter->getInputSocket(0));
- ExecutionSystemHelper::addLink(system->getConnections(), converter->getOutputSocket(), inputSocket);
- system->addOperation(converter);
+ return new ConvertVectorToColorOperation();
}
+
+ return NULL;
}
-void Converter::convertResolution(SocketConnection *connection, ExecutionSystem *system)
+void Converter::convertResolution(NodeOperationBuilder &builder, NodeOperationOutput *fromSocket, NodeOperationInput *toSocket)
{
- InputSocketResizeMode mode = connection->getToSocket()->getResizeMode();
+ InputResizeMode mode = toSocket->getResizeMode();
- NodeOperation *toOperation = (NodeOperation *)connection->getToNode();
+ NodeOperation *toOperation = &toSocket->getOperation();
const float toWidth = toOperation->getWidth();
const float toHeight = toOperation->getHeight();
- NodeOperation *fromOperation = (NodeOperation *)connection->getFromNode();
+ NodeOperation *fromOperation = &fromSocket->getOperation();
const float fromWidth = fromOperation->getWidth();
const float fromHeight = fromOperation->getHeight();
bool doCenter = false;
@@ -499,62 +481,59 @@ void Converter::convertResolution(SocketConnection *connection, ExecutionSystem
if (doCenter) {
NodeOperation *first = NULL;
- SocketConnection *c;
ScaleOperation *scaleOperation = NULL;
if (doScale) {
scaleOperation = new ScaleOperation();
+ scaleOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE);
+ scaleOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE);
first = scaleOperation;
SetValueOperation *sxop = new SetValueOperation();
sxop->setValue(scaleX);
- c = ExecutionSystemHelper::addLink(system->getConnections(), sxop->getOutputSocket(), scaleOperation->getInputSocket(1));
- c->setIgnoreResizeCheck(true);
+ builder.addLink(sxop->getOutputSocket(), scaleOperation->getInputSocket(1));
SetValueOperation *syop = new SetValueOperation();
syop->setValue(scaleY);
- c = ExecutionSystemHelper::addLink(system->getConnections(), syop->getOutputSocket(), scaleOperation->getInputSocket(2));
- c->setIgnoreResizeCheck(true);
- system->addOperation(sxop);
- system->addOperation(syop);
+ builder.addLink(syop->getOutputSocket(), scaleOperation->getInputSocket(2));
+ builder.addOperation(sxop);
+ builder.addOperation(syop);
unsigned int resolution[2] = {fromOperation->getWidth(),
fromOperation->getHeight()};
scaleOperation->setResolution(resolution);
sxop->setResolution(resolution);
syop->setResolution(resolution);
- system->addOperation(scaleOperation);
-
- c->setIgnoreResizeCheck(true);
+ builder.addOperation(scaleOperation);
}
TranslateOperation *translateOperation = new TranslateOperation();
+ translateOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE);
+ translateOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE);
if (!first) first = translateOperation;
SetValueOperation *xop = new SetValueOperation();
xop->setValue(addX);
- c = ExecutionSystemHelper::addLink(system->getConnections(), xop->getOutputSocket(), translateOperation->getInputSocket(1));
- c->setIgnoreResizeCheck(true);
+ builder.addLink(xop->getOutputSocket(), translateOperation->getInputSocket(1));
SetValueOperation *yop = new SetValueOperation();
yop->setValue(addY);
- c = ExecutionSystemHelper::addLink(system->getConnections(), yop->getOutputSocket(), translateOperation->getInputSocket(2));
- c->setIgnoreResizeCheck(true);
- system->addOperation(xop);
- system->addOperation(yop);
+ builder.addLink(yop->getOutputSocket(), translateOperation->getInputSocket(2));
+ builder.addOperation(xop);
+ builder.addOperation(yop);
unsigned int resolution[2] = {toOperation->getWidth(),
toOperation->getHeight()};
translateOperation->setResolution(resolution);
xop->setResolution(resolution);
yop->setResolution(resolution);
- system->addOperation(translateOperation);
+ builder.addOperation(translateOperation);
if (doScale) {
- c = ExecutionSystemHelper::addLink(system->getConnections(), scaleOperation->getOutputSocket(), translateOperation->getInputSocket(0));
- c->setIgnoreResizeCheck(true);
+ translateOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE);
+ builder.addLink(scaleOperation->getOutputSocket(), translateOperation->getInputSocket(0));
}
- InputSocket *inputSocket = connection->getToSocket();
- inputSocket->relinkConnections(first->getInputSocket(0));
- c = ExecutionSystemHelper::addLink(system->getConnections(), translateOperation->getOutputSocket(), inputSocket);
- c->setIgnoreResizeCheck(true);
+ /* remove previous link and replace */
+ builder.removeInputLink(toSocket);
+ first->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE);
+ toSocket->setResizeMode(COM_SC_NO_RESIZE);
+ builder.addLink(fromSocket, first->getInputSocket(0));
+ builder.addLink(translateOperation->getOutputSocket(), toSocket);
}
-
- connection->setIgnoreResizeCheck(true);
}
diff --git a/source/blender/compositor/intern/COM_Converter.h b/source/blender/compositor/intern/COM_Converter.h
index 15bda0839fa..c1ad45bbf54 100644
--- a/source/blender/compositor/intern/COM_Converter.h
+++ b/source/blender/compositor/intern/COM_Converter.h
@@ -23,8 +23,13 @@
#ifndef _COM_Converter_h
#define _COM_Converter_h
-#include "DNA_node_types.h"
-#include "COM_Node.h"
+struct bNode;
+
+class Node;
+class NodeOperation;
+class NodeOperationInput;
+class NodeOperationOutput;
+class NodeOperationBuilder;
/**
* @brief Conversion methods for the compositor
@@ -35,37 +40,42 @@ public:
* @brief Convert/wraps a bNode in its Node instance.
*
* For all nodetypes a wrapper class is created.
- * Muted nodes are wrapped with MuteNode.
*
* @note When adding a new node to blender, this method needs to be changed to return the correct Node instance.
*
* @see Node
- * @see MuteNode
*/
- static Node *convert(bNode *b_node, bool fast);
+ static Node *convert(bNode *b_node);
+
+ /**
+ * @brief True if the node is considered 'fast'.
+ *
+ * Slow nodes will be skipped if fast execution is required.
+ */
+ static bool is_fast_node(bNode *b_node);
/**
* @brief This method will add a datetype conversion rule when the to-socket does not support the from-socket actual data type.
*
* @note this method is called when conversion is needed.
*
- * @param connection the SocketConnection what needs conversion
+ * @param link the NodeLink what needs conversion
* @param system the ExecutionSystem to add the conversion to.
- * @see SocketConnection - a link between two sockets
+ * @see NodeLink - a link between two sockets
*/
- static void convertDataType(SocketConnection *connection, ExecutionSystem *system);
+ static NodeOperation *convertDataType(NodeOperationOutput *from, NodeOperationInput *to);
/**
- * @brief This method will add a resolution rule based on the settings of the InputSocket.
+ * @brief This method will add a resolution rule based on the settings of the NodeInput.
*
* @note Conversion logic is implemented in this method
* @see InputSocketResizeMode for the possible conversions.
*
- * @param connection the SocketConnection what needs conversion
+ * @param link the NodeLink what needs conversion
* @param system the ExecutionSystem to add the conversion to.
- * @see SocketConnection - a link between two sockets
+ * @see NodeLink - a link between two sockets
*/
- static void convertResolution(SocketConnection *connection, ExecutionSystem *system);
+ static void convertResolution(NodeOperationBuilder &builder, NodeOperationOutput *fromSocket, NodeOperationInput *toSocket);
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:Converter")
diff --git a/source/blender/compositor/intern/COM_Debug.cpp b/source/blender/compositor/intern/COM_Debug.cpp
index f5e3cca976c..a453af5ad13 100644
--- a/source/blender/compositor/intern/COM_Debug.cpp
+++ b/source/blender/compositor/intern/COM_Debug.cpp
@@ -46,10 +46,12 @@ extern "C" {
int DebugInfo::m_file_index = 0;
DebugInfo::NodeNameMap DebugInfo::m_node_names;
+DebugInfo::OpNameMap DebugInfo::m_op_names;
std::string DebugInfo::m_current_node_name;
+std::string DebugInfo::m_current_op_name;
DebugInfo::GroupStateMap DebugInfo::m_group_states;
-std::string DebugInfo::node_name(NodeBase *node)
+std::string DebugInfo::node_name(const Node *node)
{
NodeNameMap::const_iterator it = m_node_names.find(node);
if (it != m_node_names.end())
@@ -58,56 +60,65 @@ std::string DebugInfo::node_name(NodeBase *node)
return "";
}
+std::string DebugInfo::operation_name(const NodeOperation *op)
+{
+ OpNameMap::const_iterator it = m_op_names.find(op);
+ if (it != m_op_names.end())
+ return it->second;
+ else
+ return "";
+}
+
void DebugInfo::convert_started()
{
- m_node_names.clear();
+ m_op_names.clear();
}
-void DebugInfo::execute_started(ExecutionSystem *system)
+void DebugInfo::execute_started(const ExecutionSystem *system)
{
m_file_index = 1;
m_group_states.clear();
- for (int i = 0; i < system->getExecutionGroups().size(); ++i)
- m_group_states[system->getExecutionGroups()[i]] = EG_WAIT;
+ for (ExecutionSystem::Groups::const_iterator it = system->m_groups.begin(); it != system->m_groups.end(); ++it)
+ m_group_states[*it] = EG_WAIT;
}
-void DebugInfo::node_added(Node *node)
+void DebugInfo::node_added(const Node *node)
{
m_node_names[node] = std::string(node->getbNode() ? node->getbNode()->name : "");
}
-void DebugInfo::node_to_operations(Node *node)
+void DebugInfo::node_to_operations(const Node *node)
{
m_current_node_name = m_node_names[node];
}
-void DebugInfo::operation_added(NodeOperation *operation)
+void DebugInfo::operation_added(const NodeOperation *operation)
{
- m_node_names[operation] = m_current_node_name;
+ m_op_names[operation] = m_current_node_name;
}
-void DebugInfo::operation_read_write_buffer(NodeOperation *operation)
+void DebugInfo::operation_read_write_buffer(const NodeOperation *operation)
{
- m_current_node_name = m_node_names[operation];
+ m_current_op_name = m_op_names[operation];
}
-void DebugInfo::execution_group_started(ExecutionGroup *group)
+void DebugInfo::execution_group_started(const ExecutionGroup *group)
{
m_group_states[group] = EG_RUNNING;
}
-void DebugInfo::execution_group_finished(ExecutionGroup *group)
+void DebugInfo::execution_group_finished(const ExecutionGroup *group)
{
m_group_states[group] = EG_FINISHED;
}
-int DebugInfo::graphviz_operation(ExecutionSystem *system, NodeOperation *operation, ExecutionGroup *group, char *str, int maxlen)
+int DebugInfo::graphviz_operation(const ExecutionSystem *system, const NodeOperation *operation, const ExecutionGroup *group, char *str, int maxlen)
{
int len = 0;
std::string fillcolor = "gainsboro";
if (operation->isViewerOperation()) {
- ViewerOperation *viewer = (ViewerOperation *)operation;
+ const ViewerOperation *viewer = (const ViewerOperation *)operation;
if (viewer->isActiveViewerOutput()) {
fillcolor = "lightskyblue1";
}
@@ -139,7 +150,7 @@ int DebugInfo::graphviz_operation(ExecutionSystem *system, NodeOperation *operat
if (totinputs != 0) {
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "{");
for (int k = 0; k < totinputs; k++) {
- InputSocket *socket = operation->getInputSocket(k);
+ NodeOperationInput *socket = operation->getInputSocket(k);
if (k != 0) {
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|");
}
@@ -160,7 +171,7 @@ int DebugInfo::graphviz_operation(ExecutionSystem *system, NodeOperation *operat
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|");
}
- len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "%s\\n(%s)", m_node_names[operation].c_str(), typeid(*operation).name());
+ len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "%s\\n(%s)", m_op_names[operation].c_str(), typeid(*operation).name());
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, " (%d,%d)", operation->getWidth(), operation->getHeight());
@@ -169,7 +180,7 @@ int DebugInfo::graphviz_operation(ExecutionSystem *system, NodeOperation *operat
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "{");
for (int k = 0; k < totoutputs; k++) {
- OutputSocket *socket = operation->getOutputSocket(k);
+ NodeOperationOutput *socket = operation->getOutputSocket(k);
if (k != 0) {
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|");
}
@@ -227,7 +238,7 @@ int DebugInfo::graphviz_legend(char *str, int maxlen)
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, " <TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"4\">\r\n");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "<TR><TD COLSPAN=\"2\"><B>Legend</B></TD></TR>\r\n");
- len += graphviz_legend_color("Operation", "gainsboro", str + len, maxlen > len ? maxlen - len : 0);
+ len += graphviz_legend_color("NodeOperation", "gainsboro", str + len, maxlen > len ? maxlen - len : 0);
len += graphviz_legend_color("Output", "dodgerblue1", str + len, maxlen > len ? maxlen - len : 0);
len += graphviz_legend_color("Viewer", "lightskyblue3", str + len, maxlen > len ? maxlen - len : 0);
len += graphviz_legend_color("Active Viewer", "lightskyblue1", str + len, maxlen > len ? maxlen - len : 0);
@@ -248,26 +259,29 @@ int DebugInfo::graphviz_legend(char *str, int maxlen)
return len;
}
-bool DebugInfo::graphviz_system(ExecutionSystem *system, char *str, int maxlen)
+bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int maxlen)
{
char strbuf[64];
int len = 0;
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "digraph compositorexecution {\r\n");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "ranksep=1.5\r\n");
+ len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "rankdir=LR\r\n");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "splines=false\r\n");
- int totnodes = system->getNodes().size();
- for (int i = 0; i < totnodes; i++) {
- Node *node = system->getNodes()[i];
- len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// NODE: %s\r\n", node->getbNode()->typeinfo->ui_name);
+#if 0
+ for (ExecutionSystem::Operations::const_iterator it = system->m_operations.begin();
+ it != system->m_operations.end(); ++it) {
+ NodeOperation *op = *it;
+ len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// OPERATION: %s\r\n", node->getbNode()->typeinfo->ui_name);
}
+#endif
- int totgroups = system->getExecutionGroups().size();
- int totops = system->getOperations().size();
+ int totops = system->m_operations.size();
+ int totgroups = system->m_groups.size();
std::map<NodeOperation *, std::vector<std::string> > op_groups;
for (int i = 0; i < totgroups; ++i) {
- ExecutionGroup *group = system->getExecutionGroups()[i];
+ const ExecutionGroup *group = system->m_groups[i];
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// GROUP: %d\r\n", i);
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "subgraph cluster_%d{\r\n", i);
@@ -286,10 +300,8 @@ bool DebugInfo::graphviz_system(ExecutionSystem *system, char *str, int maxlen)
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "fillcolor=chartreuse4\r\n");
}
- for (int j = 0; j < totops; ++j) {
- NodeOperation *operation = system->getOperations()[j];
- if (!group->containsOperation(operation))
- continue;
+ for (ExecutionGroup::Operations::const_iterator it = group->m_operations.begin(); it != group->m_operations.end(); ++it) {
+ NodeOperation *operation = *it;
sprintf(strbuf, "_%p", group);
op_groups[operation].push_back(std::string(strbuf));
@@ -297,14 +309,14 @@ bool DebugInfo::graphviz_system(ExecutionSystem *system, char *str, int maxlen)
len += graphviz_operation(system, operation, group, str + len, maxlen > len ? maxlen - len : 0);
}
-// len += snprintf(str+len, maxlen>len ? maxlen-len : 0, "// OUTPUTOPERATION: %p\r\n", group->getOutputNodeOperation());
-// len += snprintf(str+len, maxlen>len ? maxlen-len : 0, " O_%p\r\n", group->getOutputNodeOperation());
+// len += snprintf(str+len, maxlen>len ? maxlen-len : 0, "// OUTPUTOPERATION: %p\r\n", group->getOutputOperation());
+// len += snprintf(str+len, maxlen>len ? maxlen-len : 0, " O_%p\r\n", group->getOutputOperation());
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "}\r\n");
}
/* operations not included in any group */
for (int j = 0; j < totops; ++j) {
- NodeOperation *operation = system->getOperations()[j];
+ NodeOperation *operation = system->m_operations[j];
if (op_groups.find(operation) != op_groups.end())
continue;
@@ -314,7 +326,7 @@ bool DebugInfo::graphviz_system(ExecutionSystem *system, char *str, int maxlen)
}
for (int i = 0; i < totops; i++) {
- NodeOperation *operation = system->getOperations()[i];
+ NodeOperation *operation = system->m_operations[i];
if (operation->isReadBufferOperation()) {
ReadBufferOperation *read = (ReadBufferOperation *)operation;
@@ -330,16 +342,18 @@ bool DebugInfo::graphviz_system(ExecutionSystem *system, char *str, int maxlen)
}
}
- int totcon = system->getConnections().size();
- for (int i = 0; i < totcon; i++) {
- SocketConnection *connection = system->getConnections()[i];
+ for (int i = 0; i < totops; i++) {
+ NodeOperation *op = system->m_operations[i];
- std::string color;
- if (!connection->isValid()) {
- color = "red";
- }
- else {
- switch (connection->getFromSocket()->getDataType()) {
+ for (NodeOperation::Inputs::const_iterator it = op->m_inputs.begin(); it != op->m_inputs.end(); ++it) {
+ NodeOperationInput *to = *it;
+ NodeOperationOutput *from = to->getLink();
+
+ if (!from)
+ continue;
+
+ std::string color;
+ switch (from->getDataType()) {
case COM_DT_VALUE:
color = "grey";
break;
@@ -350,22 +364,18 @@ bool DebugInfo::graphviz_system(ExecutionSystem *system, char *str, int maxlen)
color = "orange";
break;
}
- }
-
- NodeBase *from_node = connection->getFromNode();
- NodeBase *to_node = connection->getToNode();
- OutputSocket *from_sock = connection->getFromSocket();
- InputSocket *to_sock = connection->getToSocket();
- if (from_node->isOperation() && to_node->isOperation()) {
- NodeOperation *from_op = (NodeOperation *)from_node;
- NodeOperation *to_op = (NodeOperation *)to_node;
+
+ NodeOperation *to_op = &to->getOperation();
+ NodeOperation *from_op = &from->getOperation();
std::vector<std::string> &from_groups = op_groups[from_op];
std::vector<std::string> &to_groups = op_groups[to_op];
- len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// CONNECTION: %p.%p -> %p.%p\r\n", from_op, from_sock, to_op, to_sock);
+ len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// CONNECTION: %p.%p -> %p.%p\r\n",
+ from_op, from, to_op, to);
for (int k = 0; k < from_groups.size(); ++k) {
for (int l = 0; l < to_groups.size(); ++l) {
- len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p%s\":\"OUT_%p\":s -> \"O_%p%s\":\"IN_%p\":n", from_op, from_groups[k].c_str(), from_sock, to_op, to_groups[l].c_str(), to_sock);
+ len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p%s\":\"OUT_%p\":e -> \"O_%p%s\":\"IN_%p\":w",
+ from_op, from_groups[k].c_str(), from, to_op, to_groups[l].c_str(), to);
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, " [color=%s]", color.c_str());
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\r\n");
}
@@ -380,7 +390,7 @@ bool DebugInfo::graphviz_system(ExecutionSystem *system, char *str, int maxlen)
return (len < maxlen);
}
-void DebugInfo::graphviz(ExecutionSystem *system)
+void DebugInfo::graphviz(const ExecutionSystem *system)
{
char str[1000000];
if (graphviz_system(system, str, sizeof(str) - 1)) {
@@ -399,15 +409,16 @@ void DebugInfo::graphviz(ExecutionSystem *system)
#else
-std::string DebugInfo::node_name(NodeBase * /*node*/) { return ""; }
+std::string DebugInfo::node_name(const Node * /*node*/) { return ""; }
+std::string DebugInfo::operation_name(const NodeOperation * /*op*/) { return ""; }
void DebugInfo::convert_started() {}
-void DebugInfo::execute_started(ExecutionSystem * /*system*/) {}
-void DebugInfo::node_added(Node * /*node*/) {}
-void DebugInfo::node_to_operations(Node * /*node*/) {}
-void DebugInfo::operation_added(NodeOperation * /*operation*/) {}
-void DebugInfo::operation_read_write_buffer(NodeOperation * /*operation*/) {}
-void DebugInfo::execution_group_started(ExecutionGroup * /*group*/) {}
-void DebugInfo::execution_group_finished(ExecutionGroup * /*group*/) {}
-void DebugInfo::graphviz(ExecutionSystem * /*system*/) {}
+void DebugInfo::execute_started(const ExecutionSystem * /*system*/) {}
+void DebugInfo::node_added(const Node * /*node*/) {}
+void DebugInfo::node_to_operations(const Node * /*node*/) {}
+void DebugInfo::operation_added(const NodeOperation * /*operation*/) {}
+void DebugInfo::operation_read_write_buffer(const NodeOperation * /*operation*/) {}
+void DebugInfo::execution_group_started(const ExecutionGroup * /*group*/) {}
+void DebugInfo::execution_group_finished(const ExecutionGroup * /*group*/) {}
+void DebugInfo::graphviz(const ExecutionSystem * /*system*/) {}
#endif
diff --git a/source/blender/compositor/intern/COM_Debug.h b/source/blender/compositor/intern/COM_Debug.h
index cc108157769..204e7e4f57c 100644
--- a/source/blender/compositor/intern/COM_Debug.h
+++ b/source/blender/compositor/intern/COM_Debug.h
@@ -27,7 +27,6 @@
#include "COM_defines.h"
-class NodeBase;
class Node;
class NodeOperation;
class ExecutionSystem;
@@ -41,37 +40,41 @@ public:
EG_FINISHED
} GroupState;
- typedef std::map<NodeBase *, std::string> NodeNameMap;
- typedef std::map<ExecutionGroup *, GroupState> GroupStateMap;
+ typedef std::map<const Node *, std::string> NodeNameMap;
+ typedef std::map<const NodeOperation *, std::string> OpNameMap;
+ typedef std::map<const ExecutionGroup *, GroupState> GroupStateMap;
- static std::string node_name(NodeBase *node);
+ static std::string node_name(const Node *node);
+ static std::string operation_name(const NodeOperation *op);
static void convert_started();
- static void execute_started(ExecutionSystem *system);
+ static void execute_started(const ExecutionSystem *system);
- static void node_added(Node *node);
- static void node_to_operations(Node *node);
- static void operation_added(NodeOperation *operation);
- static void operation_read_write_buffer(NodeOperation *operation);
+ static void node_added(const Node *node);
+ static void node_to_operations(const Node *node);
+ static void operation_added(const NodeOperation *operation);
+ static void operation_read_write_buffer(const NodeOperation *operation);
- static void execution_group_started(ExecutionGroup *group);
- static void execution_group_finished(ExecutionGroup *group);
+ static void execution_group_started(const ExecutionGroup *group);
+ static void execution_group_finished(const ExecutionGroup *group);
- static void graphviz(ExecutionSystem *system);
+ static void graphviz(const ExecutionSystem *system);
#ifdef COM_DEBUG
protected:
- static int graphviz_operation(ExecutionSystem *system, NodeOperation *operation, ExecutionGroup *group, char *str, int maxlen);
+ static int graphviz_operation(const ExecutionSystem *system, const NodeOperation *operation, const ExecutionGroup *group, char *str, int maxlen);
static int graphviz_legend_color(const char *name, const char *color, char *str, int maxlen);
static int graphviz_legend_line(const char *name, const char *color, const char *style, char *str, int maxlen);
static int graphviz_legend_group(const char *name, const char *color, const char *style, char *str, int maxlen);
static int graphviz_legend(char *str, int maxlen);
- static bool graphviz_system(ExecutionSystem *system, char *str, int maxlen);
+ static bool graphviz_system(const ExecutionSystem *system, char *str, int maxlen);
private:
static int m_file_index;
static NodeNameMap m_node_names; /**< map nodes to usable names for debug output */
+ static OpNameMap m_op_names; /**< map operations to usable names for debug output */
static std::string m_current_node_name; /**< base name for all operations added by a node */
+ static std::string m_current_op_name; /**< base name for automatic sub-operations */
static GroupStateMap m_group_states; /**< for visualizing group states */
#endif
};
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index a2e4e809a3d..586a774b89e 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -26,8 +26,6 @@
#include <stdlib.h>
#include "COM_ExecutionGroup.h"
-#include "COM_InputSocket.h"
-#include "COM_SocketConnection.h"
#include "COM_defines.h"
#include "COM_ExecutionSystem.h"
#include "COM_ReadBufferOperation.h"
@@ -36,7 +34,6 @@
#include "COM_WorkScheduler.h"
#include "COM_ViewerOperation.h"
#include "COM_ChunkOrder.h"
-#include "COM_ExecutionSystemHelper.h"
#include "COM_Debug.h"
#include "MEM_guardedalloc.h"
@@ -69,84 +66,43 @@ ExecutionGroup::ExecutionGroup()
CompositorPriority ExecutionGroup::getRenderPriotrity()
{
- return this->getOutputNodeOperation()->getRenderPriority();
-}
-
-bool ExecutionGroup::containsOperation(NodeOperation *operation)
-{
- for (vector<NodeOperation *>::const_iterator iterator = this->m_operations.begin(); iterator != this->m_operations.end(); ++iterator) {
- NodeOperation *inListOperation = *iterator;
- if (inListOperation == operation) {
- return true;
- }
- }
- return false;
-}
-
-const bool ExecutionGroup::isComplex() const
-{
- return this->m_complex;
+ return this->getOutputOperation()->getRenderPriority();
}
bool ExecutionGroup::canContainOperation(NodeOperation *operation)
{
if (!this->m_initialized) { return true; }
+
if (operation->isReadBufferOperation()) { return true; }
if (operation->isWriteBufferOperation()) { return false; }
if (operation->isSetOperation()) { return true; }
-
- if (!this->isComplex()) {
- return (!operation->isComplex());
- }
- else {
- return false;
- }
+
+ /* complex groups don't allow further ops (except read buffer and values, see above) */
+ if (m_complex) { return false; }
+ /* complex ops can't be added to other groups (except their own, which they initialize, see above) */
+ if (operation->isComplex()) { return false; }
+
+ return true;
}
-void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operation)
+bool ExecutionGroup::addOperation(NodeOperation *operation)
{
- /* should never happen but in rare cases it can - it causes confusing crashes */
- BLI_assert(operation->isOperation() == true);
-
- if (containsOperation(operation)) return;
- if (canContainOperation(operation)) {
- if (!operation->isBufferOperation()) {
- this->m_complex = operation->isComplex();
- this->m_openCL = operation->isOpenCL();
- this->m_singleThreaded = operation->isSingleThreaded();
- this->m_initialized = true;
- }
- this->m_operations.push_back(operation);
- if (operation->isReadBufferOperation()) {
- ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
- WriteBufferOperation *writeOperation = readOperation->getMemoryProxy()->getWriteBufferOperation();
- this->addOperation(system, writeOperation);
- }
- else {
- unsigned int index;
- for (index = 0; index < operation->getNumberOfInputSockets(); index++) {
- InputSocket *inputSocket = operation->getInputSocket(index);
- if (inputSocket->isConnected()) {
- NodeOperation *node = (NodeOperation *)inputSocket->getConnection()->getFromNode();
- this->addOperation(system, node);
- }
- }
- }
- }
- else {
- if (operation->isWriteBufferOperation()) {
- WriteBufferOperation *writeoperation = (WriteBufferOperation *)operation;
- if (writeoperation->getMemoryProxy()->getExecutor() == NULL) {
- ExecutionGroup *newGroup = new ExecutionGroup();
- writeoperation->getMemoryProxy()->setExecutor(newGroup);
- newGroup->addOperation(system, operation);
- ExecutionSystemHelper::addExecutionGroup(system->getExecutionGroups(), newGroup);
- }
- }
+ if (!canContainOperation(operation))
+ return false;
+
+ if (!operation->isReadBufferOperation() && !operation->isWriteBufferOperation()) {
+ m_complex = operation->isComplex();
+ m_openCL = operation->isOpenCL();
+ m_singleThreaded = operation->isSingleThreaded();
+ m_initialized = true;
}
+
+ m_operations.push_back(operation);
+
+ return true;
}
-NodeOperation *ExecutionGroup::getOutputNodeOperation() const
+NodeOperation *ExecutionGroup::getOutputOperation() const
{
return this->m_operations[0]; // the first operation of the group is always the output operation.
}
@@ -197,7 +153,7 @@ void ExecutionGroup::deinitExecution()
}
void ExecutionGroup::determineResolution(unsigned int resolution[2])
{
- NodeOperation *operation = this->getOutputNodeOperation();
+ NodeOperation *operation = this->getOutputOperation();
resolution[0] = operation->getWidth();
resolution[1] = operation->getHeight();
this->setResolution(resolution);
@@ -226,7 +182,7 @@ void ExecutionGroup::determineNumberOfChunks()
*/
void ExecutionGroup::execute(ExecutionSystem *graph)
{
- CompositorContext &context = graph->getContext();
+ const CompositorContext &context = graph->getContext();
const bNodeTree *bTree = context.getbNodeTree();
if (this->m_width == 0 || this->m_height == 0) {return; } /// @note: break out... no pixels to calculate.
if (bTree->test_break && bTree->test_break(bTree->tbh)) {return; } /// @note: early break out for blur and preview nodes
@@ -243,7 +199,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
for (chunkNumber = 0; chunkNumber < this->m_numberOfChunks; chunkNumber++) {
chunkOrder[chunkNumber] = chunkNumber;
}
- NodeOperation *operation = this->getOutputNodeOperation();
+ NodeOperation *operation = this->getOutputOperation();
float centerX = 0.5;
float centerY = 0.5;
OrderOfChunks chunkorder = COM_ORDER_OF_CHUNKS_DEFAULT;
@@ -506,7 +462,7 @@ void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int chunkNumb
MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int chunkNumber, rcti *rect)
{
// we asume that this method is only called from complex execution groups.
- NodeOperation *operation = this->getOutputNodeOperation();
+ NodeOperation *operation = this->getOutputOperation();
if (operation->isWriteBufferOperation()) {
WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation;
MemoryBuffer *buffer = new MemoryBuffer(writeOperation->getMemoryProxy(), rect);
@@ -615,7 +571,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChun
void ExecutionGroup::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
- this->getOutputNodeOperation()->determineDependingAreaOfInterest(input, readOperation, output);
+ this->getOutputOperation()->determineDependingAreaOfInterest(input, readOperation, output);
}
void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy *> *memoryProxies)
@@ -634,7 +590,7 @@ bool ExecutionGroup::isOpenCL()
void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float ymax)
{
- NodeOperation *operation = this->getOutputNodeOperation();
+ NodeOperation *operation = this->getOutputOperation();
if (operation->isViewerOperation() || operation->isPreviewOperation()) {
BLI_rcti_init(&this->m_viewerBorder, xmin * this->m_width, xmax * this->m_width,
@@ -644,7 +600,7 @@ void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float y
void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float ymax)
{
- NodeOperation *operation = this->getOutputNodeOperation();
+ NodeOperation *operation = this->getOutputOperation();
if (operation->isOutputOperation(true)) {
/* Basically, setting border need to happen for only operations
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h
index 47f8447015d..4b6f51c72c0 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.h
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.h
@@ -31,6 +31,12 @@
#include "COM_Device.h"
#include "COM_CompositorContext.h"
+using std::vector;
+
+class ExecutionSystem;
+class MemoryProxy;
+class ReadBufferOperation;
+class Device;
/**
* @brief the execution state of a chunk in an ExecutionGroup
@@ -51,23 +57,22 @@ typedef enum ChunkExecutionState {
COM_ES_EXECUTED = 2
} ChunkExecutionState;
-class MemoryProxy;
-class ReadBufferOperation;
-class Device;
-
/**
- * @brief Class ExecutionGroup is a group of NodeOperations that are executed as one.
+ * @brief Class ExecutionGroup is a group of Operations that are executed as one.
* This grouping is used to combine Operations that can be executed as one whole when multi-processing.
* @ingroup Execution
*/
class ExecutionGroup {
+public:
+ typedef std::vector<NodeOperation*> Operations;
+
private:
// fields
/**
* @brief list of operations in this ExecutionGroup
*/
- vector<NodeOperation *> m_operations;
+ Operations m_operations;
/**
* @brief is this ExecutionGroup an input ExecutionGroup
@@ -130,7 +135,7 @@ private:
/**
* @brief a cached vector of all read operations in the execution group.
*/
- vector<NodeOperation *> m_cachedReadOperations;
+ Operations m_cachedReadOperations;
/**
* @brief reference to the original bNodeTree, this field is only set for the 'top' execution group.
@@ -152,8 +157,8 @@ private:
ChunkExecutionState *m_chunkExecutionStates;
/**
- * @brief indicator when this ExecutionGroup has valid NodeOperations in its vector for Execution
- * @note When building the ExecutionGroup NodeOperations are added via recursion. First a WriteBufferOperations is added, then the
+ * @brief indicator when this ExecutionGroup has valid Operations in its vector for Execution
+ * @note When building the ExecutionGroup Operations are added via recursion. First a WriteBufferOperations is added, then the
* @note Operation containing the settings that is important for the ExecutiongGroup is added,
* @note When this occurs, these settings are copied over from the node to the ExecutionGroup
* @note and the Initialized flag is set to true.
@@ -245,23 +250,17 @@ private:
public:
// constructors
ExecutionGroup();
-
- // methods
- /**
- * @brief check to see if a NodeOperation is already inside this execution group
- * @param operation the NodeOperation to check
- * @return [true,false]
- */
- bool containsOperation(NodeOperation *operation);
+ // methods
/**
* @brief add an operation to this ExecutionGroup
* @note this method will add input of the operations recursively
* @note this method can create multiple ExecutionGroup's
* @param system
* @param operation
+ * @return True if the operation was successfully added
*/
- void addOperation(ExecutionSystem *system, NodeOperation *operation);
+ bool addOperation(NodeOperation *operation);
/**
* @brief is this ExecutionGroup an output ExecutionGroup
@@ -292,24 +291,24 @@ public:
/**
* @brief get the width of this execution group
*/
- const unsigned int getWidth() { return this->m_width; }
+ unsigned int getWidth() const { return m_width; }
/**
* @brief get the height of this execution group
*/
- const unsigned int getHeight() { return this->m_height; }
+ unsigned int getHeight() const { return m_height; }
/**
* @brief does this ExecutionGroup contains a complex NodeOperation
*/
- const bool isComplex() const;
+ bool isComplex() const { return m_complex; }
/**
* @brief get the output operation of this ExecutionGroup
* @return NodeOperation *output operation
*/
- NodeOperation *getOutputNodeOperation() const;
+ NodeOperation *getOutputOperation() const;
/**
* @brief compose multiple chunks into a single chunk
@@ -419,12 +418,12 @@ public:
void setRenderBorder(float xmin, float xmax, float ymin, float ymax);
+ /* allow the DebugInfo class to look at internals */
+ friend class DebugInfo;
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:ExecutionGroup")
#endif
-
- /* allow the DebugInfo class to peek inside without having to add getters for everything */
- friend class DebugInfo;
};
#endif
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 088232481d0..7c08188db90 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -29,15 +29,11 @@ extern "C" {
}
#include "COM_Converter.h"
+#include "COM_NodeOperationBuilder.h"
#include "COM_NodeOperation.h"
#include "COM_ExecutionGroup.h"
-#include "COM_NodeBase.h"
#include "COM_WorkScheduler.h"
#include "COM_ReadBufferOperation.h"
-#include "COM_GroupNode.h"
-#include "COM_WriteBufferOperation.h"
-#include "COM_ReadBufferOperation.h"
-#include "COM_ExecutionSystemHelper.h"
#include "COM_Debug.h"
#include "BKE_global.h"
@@ -63,14 +59,15 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, Scene *scene, bNodeTree *editin
this->m_context.setRendering(rendering);
this->m_context.setHasActiveOpenCLDevices(WorkScheduler::hasGPUDevices() && (editingtree->flag & NTREE_COM_OPENCL));
- ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree, NODE_INSTANCE_KEY_BASE);
-
this->m_context.setRenderData(rd);
this->m_context.setViewSettings(viewSettings);
this->m_context.setDisplaySettings(displaySettings);
- this->convertToOperations();
- this->groupOperations(); /* group operations in ExecutionGroups */
+ {
+ NodeOperationBuilder builder(&m_context, editingtree);
+ builder.convertToOperations(this);
+ }
+
unsigned int index;
unsigned int resolution[2];
@@ -107,16 +104,6 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, Scene *scene, bNodeTree *editin
ExecutionSystem::~ExecutionSystem()
{
unsigned int index;
- for (index = 0; index < this->m_connections.size(); index++) {
- SocketConnection *connection = this->m_connections[index];
- delete connection;
- }
- this->m_connections.clear();
- for (index = 0; index < this->m_nodes.size(); index++) {
- Node *node = this->m_nodes[index];
- delete node;
- }
- this->m_nodes.clear();
for (index = 0; index < this->m_operations.size(); index++) {
NodeOperation *operation = this->m_operations[index];
delete operation;
@@ -129,14 +116,19 @@ ExecutionSystem::~ExecutionSystem()
this->m_groups.clear();
}
+void ExecutionSystem::set_operations(const Operations &operations, const Groups &groups)
+{
+ m_operations = operations;
+ m_groups = groups;
+}
+
void ExecutionSystem::execute()
{
DebugInfo::execute_started(this);
unsigned int order = 0;
for (vector<NodeOperation *>::iterator iter = this->m_operations.begin(); iter != this->m_operations.end(); ++iter) {
- NodeBase *node = *iter;
- NodeOperation *operation = (NodeOperation *) node;
+ NodeOperation *operation = *iter;
if (operation->isReadBufferOperation()) {
ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
readOperation->setOffset(order);
@@ -196,202 +188,6 @@ void ExecutionSystem::executeGroups(CompositorPriority priority)
}
}
-void ExecutionSystem::addOperation(NodeOperation *operation)
-{
- ExecutionSystemHelper::addOperation(this->m_operations, operation);
- DebugInfo::operation_added(operation);
-}
-
-void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
-{
- DebugInfo::operation_read_write_buffer(operation);
-
- // for every input add write and read operation if input is not a read operation
- // only add read operation to other links when they are attached to buffered operations.
- unsigned int index;
- for (index = 0; index < operation->getNumberOfInputSockets(); index++) {
- InputSocket *inputsocket = operation->getInputSocket(index);
- if (inputsocket->isConnected()) {
- SocketConnection *connection = inputsocket->getConnection();
- NodeOperation *otherEnd = (NodeOperation *)connection->getFromNode();
- if (!otherEnd->isReadBufferOperation()) {
- // check of other end already has write operation
- OutputSocket *fromsocket = connection->getFromSocket();
- WriteBufferOperation *writeoperation = fromsocket->findAttachedWriteBufferOperation();
- if (writeoperation == NULL) {
- writeoperation = new WriteBufferOperation();
- writeoperation->setbNodeTree(this->getContext().getbNodeTree());
- this->addOperation(writeoperation);
- ExecutionSystemHelper::addLink(this->getConnections(), fromsocket, writeoperation->getInputSocket(0));
- writeoperation->readResolutionFromInputSocket();
- }
- ReadBufferOperation *readoperation = new ReadBufferOperation();
- readoperation->setMemoryProxy(writeoperation->getMemoryProxy());
- connection->setFromSocket(readoperation->getOutputSocket());
- readoperation->getOutputSocket()->addConnection(connection);
- readoperation->readResolutionFromWriteBuffer();
- this->addOperation(readoperation);
- }
- }
- }
- /*
- * link the outputsocket to a write operation
- * link the writeoperation to a read operation
- * link the read operation to the next node.
- */
- OutputSocket *outputsocket = operation->getOutputSocket();
- if (outputsocket->isConnected()) {
- WriteBufferOperation *writeOperation = NULL;
- /* try to find existing write buffer operation first */
- for (index = 0; index < outputsocket->getNumberOfConnections(); index++) {
- SocketConnection *connection = outputsocket->getConnection(index);
- NodeBase *otherEnd = connection->getToNode();
- if (otherEnd->isOperation()) {
- NodeOperation *otherEndOp = (NodeOperation *)otherEnd;
- if (otherEndOp->isWriteBufferOperation()) {
- writeOperation = (WriteBufferOperation *)otherEndOp;
- break;
- }
- }
- }
- /* if no write buffer operation exists yet, create a new one */
- if (!writeOperation) {
- writeOperation = new WriteBufferOperation();
- writeOperation->setbNodeTree(this->getContext().getbNodeTree());
- this->addOperation(writeOperation);
- ExecutionSystemHelper::addLink(this->getConnections(), outputsocket, writeOperation->getInputSocket(0));
- }
- writeOperation->readResolutionFromInputSocket();
-
- for (index = 0; index < outputsocket->getNumberOfConnections(); index++) {
- SocketConnection *connection = outputsocket->getConnection(index);
- /* skip existing connections to write buffer operation */
- if (connection->getToNode() == writeOperation)
- continue;
-
- ReadBufferOperation *readoperation = new ReadBufferOperation();
- readoperation->setMemoryProxy(writeOperation->getMemoryProxy());
- connection->setFromSocket(readoperation->getOutputSocket());
- readoperation->getOutputSocket()->addConnection(connection);
- readoperation->readResolutionFromWriteBuffer();
- this->addOperation(readoperation);
- }
- }
-}
-
-#ifndef NDEBUG
-/* if this fails, there are still connection to/from this node,
- * which have not been properly relinked to operations!
- */
-static void debug_check_node_connections(Node *node)
-{
- /* note: connected inputs are not checked here,
- * it would break quite a lot and such inputs are ignored later anyway
- */
-#if 0
- for (int i = 0; i < node->getNumberOfInputSockets(); ++i) {
- BLI_assert(!node->getInputSocket(i)->isConnected());
- }
-#endif
- for (int i = 0; i < node->getNumberOfOutputSockets(); ++i) {
- BLI_assert(!node->getOutputSocket(i)->isConnected());
- }
-}
-#else
-/* stub */
-#define debug_check_node_connections(node)
-#endif
-
-void ExecutionSystem::convertToOperations()
-{
- unsigned int index;
-
- for (index = 0; index < this->m_nodes.size(); index++) {
- Node *node = (Node *)this->m_nodes[index];
- DebugInfo::node_to_operations(node);
- node->convertToOperations(this, &this->m_context);
-
- debug_check_node_connections(node);
- }
-
- for (index = 0; index < this->m_connections.size(); index++) {
- SocketConnection *connection = this->m_connections[index];
- if (connection->isValid()) {
- if (connection->getFromSocket()->getDataType() != connection->getToSocket()->getDataType()) {
- Converter::convertDataType(connection, this);
- }
- }
- }
-
- // determine all resolutions of the operations (Width/Height)
- for (index = 0; index < this->m_operations.size(); index++) {
- NodeOperation *operation = this->m_operations[index];
- if (operation->isOutputOperation(this->m_context.isRendering()) && !operation->isPreviewOperation()) {
- unsigned int resolution[2] = {0, 0};
- unsigned int preferredResolution[2] = {0, 0};
- operation->determineResolution(resolution, preferredResolution);
- operation->setResolution(resolution);
- }
- }
- for (index = 0; index < this->m_operations.size(); index++) {
- NodeOperation *operation = this->m_operations[index];
- if (operation->isOutputOperation(this->m_context.isRendering()) && operation->isPreviewOperation()) {
- unsigned int resolution[2] = {0, 0};
- unsigned int preferredResolution[2] = {0, 0};
- operation->determineResolution(resolution, preferredResolution);
- operation->setResolution(resolution);
- }
- }
-
- // add convert resolution operations when needed.
- for (index = 0; index < this->m_connections.size(); index++) {
- SocketConnection *connection = this->m_connections[index];
- if (connection->isValid()) {
- if (connection->needsResolutionConversion()) {
- Converter::convertResolution(connection, this);
- }
- }
- }
-}
-
-void ExecutionSystem::groupOperations()
-{
- vector<NodeOperation *> outputOperations;
- NodeOperation *operation;
- unsigned int index;
- // surround complex operations with ReadBufferOperation and WriteBufferOperation
- for (index = 0; index < this->m_operations.size(); index++) {
- operation = this->m_operations[index];
- if (operation->isComplex()) {
- this->addReadWriteBufferOperations(operation);
- }
- }
- ExecutionSystemHelper::findOutputNodeOperations(&outputOperations, this->getOperations(), this->m_context.isRendering());
- for (vector<NodeOperation *>::iterator iter = outputOperations.begin(); iter != outputOperations.end(); ++iter) {
- operation = *iter;
- ExecutionGroup *group = new ExecutionGroup();
- group->addOperation(this, operation);
- group->setOutputExecutionGroup(true);
- ExecutionSystemHelper::addExecutionGroup(this->getExecutionGroups(), group);
- }
-}
-
-void ExecutionSystem::addSocketConnection(SocketConnection *connection)
-{
- this->m_connections.push_back(connection);
-}
-
-void ExecutionSystem::removeSocketConnection(SocketConnection *connection)
-{
- for (vector<SocketConnection *>::iterator it = m_connections.begin(); it != m_connections.end(); ++it) {
- if (*it == connection) {
- this->m_connections.erase(it);
- return;
- }
- }
-}
-
-
void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup *> *result, CompositorPriority priority) const
{
unsigned int index;
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h
index 7402ff90fb5..ab903206f0a 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.h
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.h
@@ -29,7 +29,6 @@ class ExecutionGroup;
#include "DNA_node_types.h"
#include <vector>
#include "COM_Node.h"
-#include "COM_SocketConnection.h"
#include "BKE_text.h"
#include "COM_ExecutionGroup.h"
#include "COM_NodeOperation.h"
@@ -73,7 +72,7 @@ using namespace std;
* As values are ordered differently than colors a conversion happens.
*
* - Image size conversions: the system can automatically convert when resolutions do not match.
- * An InputSocket has a resize mode. This can be any of the following settings.
+ * An NodeInput has a resize mode. This can be any of the following settings.
* - [@ref InputSocketResizeMode.COM_SC_CENTER]: The center of both images are aligned
* - [@ref InputSocketResizeMode.COM_SC_FIT_WIDTH]: The width of both images are aligned
* - [@ref InputSocketResizeMode.COM_SC_FIT_HEIGHT]: the height of both images are aligned
@@ -115,6 +114,10 @@ using namespace std;
* @brief the ExecutionSystem contains the whole compositor tree.
*/
class ExecutionSystem {
+public:
+ typedef std::vector<NodeOperation*> Operations;
+ typedef std::vector<ExecutionGroup*> Groups;
+
private:
/**
* @brief the context used during execution
@@ -122,34 +125,17 @@ private:
CompositorContext m_context;
/**
- * @brief vector of nodes
- */
- vector<Node *> m_nodes;
-
- /**
* @brief vector of operations
*/
- vector<NodeOperation *> m_operations;
+ Operations m_operations;
/**
* @brief vector of groups
*/
- vector<ExecutionGroup *> m_groups;
-
- /**
- * @brief vector of connections
- */
- vector<SocketConnection *> m_connections;
+ Groups m_groups;
private: //methods
/**
- * @brief add ReadBufferOperation and WriteBufferOperation around an operation
- * @param operation the operation to add the bufferoperations around.
- */
- void addReadWriteBufferOperations(NodeOperation *operation);
-
-
- /**
* find all execution group with output nodes
*/
void findOutputExecutionGroup(vector<ExecutionGroup *> *result, CompositorPriority priority) const;
@@ -175,6 +161,7 @@ public:
*/
~ExecutionSystem();
+ void set_operations(const Operations &operations, const Groups &groups);
/**
* @brief execute this system
@@ -185,70 +172,16 @@ public:
void execute();
/**
- * @brief Add an operation to the operation list
- *
- * @param operation the operation to add
- */
- void addOperation(NodeOperation *operation);
-
- /**
- * Add an editor link to the system. convert it to an socketconnection (CPP-representative)
- * this converted socket is returned.
- */
- SocketConnection *addNodeLink(bNodeLink *bNodeLink);
- void addSocketConnection(SocketConnection *connection);
-
- /**
- * Remove a socket connection from the system.
- */
- void removeSocketConnection(SocketConnection *connection);
-
- /**
- * @brief Convert all nodes to operations
- */
- void convertToOperations();
-
- /**
- * @brief group operations in ExecutionGroup's
- * @see ExecutionGroup
- */
- void groupOperations();
-
- /**
* @brief get the reference to the compositor context
*/
- CompositorContext &getContext() { return this->m_context; }
-
- /**
- * @brief get the reference to the compositor nodes
- */
- vector<Node *> &getNodes() { return this->m_nodes; }
-
- /**
- * @brief get the reference to the compositor connections
- */
- vector<SocketConnection *>& getConnections() { return this->m_connections; }
-
- /**
- * @brief get the reference to the list of execution groups
- */
- vector<ExecutionGroup *>& getExecutionGroups() { return this->m_groups; }
-
- /**
- * @brief get the reference to the list of operations
- */
- vector<NodeOperation *>& getOperations() { return this->m_operations; }
+ const CompositorContext &getContext() const { return this->m_context; }
private:
-
- /**
- * @brief determine the actual data types of all sockets
- * @param nodes list of nodes or operations to do the data type determination
- */
- void determineActualSocketDataTypes(vector<NodeBase *> &nodes);
-
void executeGroups(CompositorPriority priority);
+ /* allow the DebugInfo class to look at internals */
+ friend class DebugInfo;
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:ExecutionSystem")
#endif
diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
deleted file mode 100644
index 7def96d426e..00000000000
--- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
+++ /dev/null
@@ -1,171 +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_ExecutionSystemHelper.h"
-
-#include "PIL_time.h"
-
-#include "COM_Converter.h"
-#include "COM_NodeOperation.h"
-#include "COM_ExecutionGroup.h"
-#include "COM_NodeBase.h"
-#include "COM_WorkScheduler.h"
-#include "COM_ReadBufferOperation.h"
-#include "COM_GroupNode.h"
-#include "COM_WriteBufferOperation.h"
-#include "COM_ReadBufferOperation.h"
-#include "COM_ViewerOperation.h"
-#include "COM_Debug.h"
-
-extern "C" {
-#include "BKE_node.h"
-}
-
-void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key)
-{
- vector<Node *>& nodes = system.getNodes();
- vector<SocketConnection *>& links = system.getConnections();
-
- const bNodeTree *basetree = system.getContext().getbNodeTree();
- /* update viewers in the active edittree as well the base tree (for backdrop) */
- bool is_active_group = ((parent_key.value == basetree->active_viewer_key.value) ||
- (tree == basetree));
-
- /* add all nodes of the tree to the node list */
- bNode *node = (bNode *)tree->nodes.first;
- while (node != NULL) {
- Node *nnode = addNode(nodes, node, is_active_group, system.getContext().isFastCalculation());
- if (nnode) {
- nnode->setbNodeTree(tree);
- nnode->setInstanceKey(BKE_node_instance_key(parent_key, tree, node));
- }
- node = node->next;
- }
-
- NodeRange node_range(nodes.begin() + nodes_start, nodes.end());
-
- /* add all nodelinks of the tree to the link list */
- bNodeLink *nodelink = (bNodeLink *)tree->links.first;
- while (nodelink != NULL) {
- addNodeLink(node_range, links, nodelink);
- nodelink = nodelink->next;
- }
-
- /* Expand group nodes
- * Only go up to nodes_end, to avoid ungrouping nested node groups repeatedly.
- */
- int nodes_end = nodes.size();
- for (unsigned int i = nodes_start; i < nodes_end; ++i) {
- Node *execnode = nodes[i];
- if (execnode->isGroupNode()) {
- GroupNode *groupNode = (GroupNode *)execnode;
- groupNode->ungroup(system);
- }
- }
-}
-
-void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node)
-{
- nodes.push_back(node);
-}
-
-Node *ExecutionSystemHelper::addNode(vector<Node *>& nodes, bNode *b_node, bool inActiveGroup, bool fast)
-{
- Node *node = Converter::convert(b_node, fast);
- if (node) {
- node->setIsInActiveGroup(inActiveGroup);
- addNode(nodes, node);
-
- DebugInfo::node_added(node);
- }
- return node;
-}
-void ExecutionSystemHelper::addOperation(vector<NodeOperation *>& operations, NodeOperation *operation)
-{
- operations.push_back(operation);
-}
-
-void ExecutionSystemHelper::addExecutionGroup(vector<ExecutionGroup *>& executionGroups, ExecutionGroup *executionGroup)
-{
- executionGroups.push_back(executionGroup);
-}
-
-void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation *> *result, vector<NodeOperation *>& operations, bool rendering)
-{
- unsigned int index;
-
- for (index = 0; index < operations.size(); index++) {
- NodeOperation *operation = operations[index];
- if (operation->isOutputOperation(rendering)) {
- result->push_back(operation);
- }
- }
-}
-
-static InputSocket *find_input(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
-{
- for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
- Node *node = *it;
- InputSocket *input = node->findInputSocketBybNodeSocket(bsocket);
- if (input)
- return input;
- }
- return NULL;
-}
-static OutputSocket *find_output(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
-{
- for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
- Node *node = *it;
- OutputSocket *output = node->findOutputSocketBybNodeSocket(bsocket);
- if (output)
- return output;
- }
- return NULL;
-}
-SocketConnection *ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vector<SocketConnection *>& links, bNodeLink *b_nodelink)
-{
- /// @note: ignore invalid links
- if (!(b_nodelink->flag & NODE_LINK_VALID))
- return NULL;
-
- InputSocket *inputSocket = find_input(node_range, b_nodelink->tonode, b_nodelink->tosock);
- OutputSocket *outputSocket = find_output(node_range, b_nodelink->fromnode, b_nodelink->fromsock);
- if (inputSocket == NULL || outputSocket == NULL) {
- return NULL;
- }
- if (inputSocket->isConnected()) {
- return NULL;
- }
- SocketConnection *connection = addLink(links, outputSocket, inputSocket);
- return connection;
-}
-
-SocketConnection *ExecutionSystemHelper::addLink(vector<SocketConnection *>& links, OutputSocket *fromSocket, InputSocket *toSocket)
-{
- SocketConnection *newconnection = new SocketConnection();
- newconnection->setFromSocket(fromSocket);
- newconnection->setToSocket(toSocket);
- fromSocket->addConnection(newconnection);
- toSocket->setConnection(newconnection);
- links.push_back(newconnection);
- return newconnection;
-}
diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.h b/source/blender/compositor/intern/COM_ExecutionSystemHelper.h
deleted file mode 100644
index ae9e75e0408..00000000000
--- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.h
+++ /dev/null
@@ -1,126 +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
- */
-
-class ExecutionGroup;
-
-#ifndef _COM_ExecutionSystemHelper_h
-#define _COM_ExecutionSystemHelper_h
-
-#include "DNA_node_types.h"
-#include <vector>
-#include "COM_Node.h"
-#include "COM_SocketConnection.h"
-#include "BKE_text.h"
-#include "COM_ExecutionGroup.h"
-
-using namespace std;
-
-/**
- *
- */
-class ExecutionSystemHelper {
-
-public:
-
- /**
- * @brief add an bNodeTree to the nodes list and connections
- * @param system Execution system
- * @param nodes_start Starting index in the system's nodes list for nodes in this tree.
- * @param tree bNodeTree to add
- * @return Node representing the "Compositor node" of the maintree. or NULL when a subtree is added
- */
- static void addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key);
-
- /**
- * @brief add an editor node to the system.
- * this node is converted to a Node instance.
- * and the converted node is returned
- *
- * @param b_node node to add
- * @return Node that represents the bNode or null when not able to convert.
- */
- static Node *addNode(vector<Node *>& nodes, bNode *b_node, bool isInActiveGroup, bool fast);
-
- /**
- * @brief Add a Node to a list
- *
- * @param nodes the list where the node needs to be added to
- * @param node the node to be added
- */
- static void addNode(vector<Node *>& nodes, Node *node);
-
- /**
- * @brief Add an operation to the operation list
- *
- * The id of the operation is updated.
- *
- * @param operations the list where the operation need to be added to
- * @param operation the operation to add
- */
- static void addOperation(vector<NodeOperation *> &operations, NodeOperation *operation);
-
- /**
- * @brief Add an ExecutionGroup to a list
- *
- * The id of the ExecutionGroup is updated.
- *
- * @param executionGroups the list where the executionGroup need to be added to
- * @param executionGroup the ExecutionGroup to add
- */
- static void addExecutionGroup(vector<ExecutionGroup *>& executionGroups, ExecutionGroup *executionGroup);
-
- /**
- * Find all Node Operations that needs to be executed.
- * @param rendering
- * the rendering parameter will tell what type of execution we are doing
- * false is editing, true is rendering
- */
- static void findOutputNodeOperations(vector<NodeOperation *> *result, vector<NodeOperation *>& operations, bool rendering);
-
- /**
- * @brief add a bNodeLink to the list of links
- * the bNodeLink will be wrapped in a SocketConnection
- *
- * @note Cyclic links will be ignored
- *
- * @param node_range list of possible nodes for lookup.
- * @param links list of links to add the bNodeLink to
- * @param bNodeLink the link to be added
- * @return the created SocketConnection or NULL
- */
- static SocketConnection *addNodeLink(NodeRange &node_range, vector<SocketConnection *>& links, bNodeLink *bNodeLink);
-
- /**
- * @brief create a new SocketConnection and add to a vector of links
- * @param links the vector of links
- * @param fromSocket the startpoint of the connection
- * @param toSocket the endpoint of the connection
- * @return the new created SocketConnection
- */
- static SocketConnection *addLink(vector<SocketConnection *>& links, OutputSocket *fromSocket, InputSocket *toSocket);
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("COM:ExecutionSystemHelper")
-#endif
-};
-
-#endif /* _COM_ExecutionSystemHelper_h */
diff --git a/source/blender/compositor/intern/COM_InputSocket.cpp b/source/blender/compositor/intern/COM_InputSocket.cpp
deleted file mode 100644
index 6868745d631..00000000000
--- a/source/blender/compositor/intern/COM_InputSocket.cpp
+++ /dev/null
@@ -1,159 +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_Socket.h"
-#include "COM_Node.h"
-#include "COM_SocketConnection.h"
-#include "COM_ExecutionSystem.h"
-
-InputSocket::InputSocket(DataType datatype) : Socket(datatype)
-{
- this->m_connection = NULL;
- this->m_resizeMode = COM_SC_CENTER;
-}
-InputSocket::InputSocket(DataType datatype, InputSocketResizeMode resizeMode) : Socket(datatype)
-{
- this->m_connection = NULL;
- this->m_resizeMode = resizeMode;
-}
-
-InputSocket::InputSocket(InputSocket *from) : Socket(from->getDataType())
-{
- this->m_connection = NULL;
- this->m_resizeMode = from->getResizeMode();
-}
-
-int InputSocket::isInputSocket() const { return true; }
-const int InputSocket::isConnected() const { return this->m_connection != NULL; }
-
-void InputSocket::setConnection(SocketConnection *connection)
-{
- this->m_connection = connection;
-}
-SocketConnection *InputSocket::getConnection()
-{
- return this->m_connection;
-}
-
-void InputSocket::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
-{
- if (this->isConnected()) {
- this->m_connection->getFromSocket()->determineResolution(resolution, preferredResolution);
- }
- else {
- return;
- }
-}
-
-void InputSocket::relinkConnections(InputSocket *relinkToSocket)
-{
- if (!isConnected()) {
- return;
- }
- SocketConnection *connection = this->getConnection();
- connection->setToSocket(relinkToSocket);
- relinkToSocket->setConnection(connection);
- this->setConnection(NULL);
-}
-
-void InputSocket::relinkConnectionsDuplicate(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *graph)
-{
- if (!this->isConnected()) {
- Node *node = (Node *)this->getNode();
- switch (this->getDataType()) {
- case COM_DT_COLOR:
- node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VECTOR:
- node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VALUE:
- node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- }
- return;
- }
- SocketConnection *newConnection = new SocketConnection();
- OutputSocket *fromSocket = this->getConnection()->getFromSocket();
- newConnection->setToSocket(relinkToSocket);
- newConnection->setFromSocket(fromSocket);
- relinkToSocket->setConnection(newConnection);
- fromSocket->addConnection(newConnection);
- graph->addSocketConnection(newConnection);
-}
-
-void InputSocket::relinkConnections(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *graph)
-{
- if (isConnected()) {
- relinkConnections(relinkToSocket);
- }
- else {
- Node *node = (Node *)this->getNode();
- switch (this->getDataType()) {
- case COM_DT_COLOR:
- node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VECTOR:
- node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VALUE:
- node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- }
- }
-}
-
-void InputSocket::unlinkConnections(ExecutionSystem *system)
-{
- SocketConnection *connection = getConnection();
- if (connection) {
- system->removeSocketConnection(connection);
- connection->getFromSocket()->removeConnection(connection);
- setConnection(NULL);
- delete connection;
- }
-}
-
-bool InputSocket::isStatic()
-{
- if (isConnected()) {
- NodeBase *node = this->getConnection()->getFromNode();
- if (node) {
- return node->isStatic();
- }
- }
- return true;
-}
-SocketReader *InputSocket::getReader()
-{
- return this->getOperation();
-}
-
-NodeOperation *InputSocket::getOperation() const
-{
- if (isConnected()) {
- return (NodeOperation *)this->m_connection->getFromSocket()->getNode();
- }
- else {
- return NULL;
- }
-}
diff --git a/source/blender/compositor/intern/COM_InputSocket.h b/source/blender/compositor/intern/COM_InputSocket.h
deleted file mode 100644
index 23490b66bba..00000000000
--- a/source/blender/compositor/intern/COM_InputSocket.h
+++ /dev/null
@@ -1,149 +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_InputSocket_h
-#define _COM_InputSocket_h
-
-#include <vector>
-#include "COM_Socket.h"
-#include "COM_SocketReader.h"
-
-using namespace std;
-class SocketConnection;
-class Node;
-class ExecutionSystem;
-class OutputSocket;
-class ChannelInfo;
-class NodeOperation;
-
-/**
- * @brief Resize modes of inputsockets
- * How are the input and working resolutions matched
- * @ingroup Model
- */
-typedef enum InputSocketResizeMode {
- /** @brief Center the input image to the center of the working area of the node, no resizing occurs */
- COM_SC_CENTER = NS_CR_CENTER,
- /** @brief The bottom left of the input image is the bottom left of the working area of the node, no resizing occurs */
- COM_SC_NO_RESIZE = NS_CR_NONE,
- /** @brief Fit the width of the input image to the width of the working area of the node */
- COM_SC_FIT_WIDTH = NS_CR_FIT_WIDTH,
- /** @brief Fit the height of the input image to the height of the working area of the node */
- COM_SC_FIT_HEIGHT = NS_CR_FIT_HEIGHT,
- /** @brief Fit the width or the height of the input image to the width or height of the working area of the node, image will be larger than the working area */
- COM_SC_FIT = NS_CR_FIT,
- /** @brief Fit the width and the height of the input image to the width and height of the working area of the node, image will be equally larger than the working area */
- COM_SC_STRETCH = NS_CR_STRETCH
-} InputSocketResizeMode;
-
-/**
- * @brief InputSocket are sockets that can receive data/input
- * @ingroup Model
- */
-class InputSocket : public Socket {
-private:
- /**
- * @brief connection connected to this InputSocket.
- * An input socket can only have a single connection
- */
- SocketConnection *m_connection;
-
- /**
- * @brief resize mode of this socket
- */
- InputSocketResizeMode m_resizeMode;
-
-
-public:
- InputSocket(DataType datatype);
- InputSocket(DataType datatype, InputSocketResizeMode resizeMode);
- InputSocket(InputSocket *from);
-
- void setConnection(SocketConnection *connection);
- SocketConnection *getConnection();
-
- const int isConnected() const;
- int isInputSocket() const;
-
- /**
- * @brief determine the resolution of this data going through this socket
- * @param resolution the result of this operation
- * @param preferredResolution the preferable resolution as no resolution could be determined
- */
- void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
-
- /**
- * @brief move all connections of this input socket to another socket
- * only use this method when already checked the availability of a SocketConnection
- * @param relinkToSocket the socket to move to connections to
- */
- void relinkConnections(InputSocket *relinkToSocket);
-
- /**
- * @brief move all connections of this input socket to another socket
- * @param relinkToSocket the socket to move to connections to
- * @param editorNodeInputSocketIndex index of the socket number of the bNode (used to retrieve the value for autoconnection)
- * @param system ExecutionSystem to update to
- */
- void relinkConnections(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *system);
-
- /**
- * @brief add a connection of this input socket to another socket
- * @warning make sure to remove the original connection with \a unlinkConnections afterward.
- * @param relinkToSocket the socket to move to connections to
- * @param editorNodeInputSocketIndex index of the socket number of the bNode (used to retrieve the value for autoconnection)
- * @param system ExecutionSystem to update to
- */
- void relinkConnectionsDuplicate(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *system);
-
- /**
- * @brief remove all connections of this input socket.
- * @warning \a relinkConnectionsDuplicate should be used to ensure this socket is still connected.
- * @param system ExecutionSystem to update to
- */
- void unlinkConnections(ExecutionSystem *system);
-
- /**
- * @brief set the resize mode
- * @param resizeMode the new resize mode.
- */
- void setResizeMode(InputSocketResizeMode resizeMode) {
- this->m_resizeMode = resizeMode;
- }
-
- /**
- * @brief get the resize mode of this socket
- * @return InputSocketResizeMode
- */
- InputSocketResizeMode getResizeMode() const {
- return this->m_resizeMode;
- }
-
- const ChannelInfo *getChannelInfo(const int channelnumber);
-
- bool isStatic();
-
- SocketReader *getReader();
- NodeOperation *getOperation() const;
-};
-
-#endif
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index aa2a5475d38..04828bfe3f8 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -21,8 +21,11 @@
*/
#include "COM_MemoryBuffer.h"
+
#include "MEM_guardedalloc.h"
-//#include "BKE_global.h"
+
+using std::min;
+using std::max;
unsigned int MemoryBuffer::determineBufferSize()
{
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h
index 521e3c6231e..d6ef9cd673e 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.h
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.h
@@ -27,6 +27,7 @@ class MemoryBuffer;
#include "COM_ExecutionGroup.h"
#include "COM_MemoryProxy.h"
+#include "COM_SocketReader.h"
extern "C" {
# include "BLI_math.h"
diff --git a/source/blender/compositor/intern/COM_MemoryProxy.h b/source/blender/compositor/intern/COM_MemoryProxy.h
index 696c843e7c4..233b035a2d7 100644
--- a/source/blender/compositor/intern/COM_MemoryProxy.h
+++ b/source/blender/compositor/intern/COM_MemoryProxy.h
@@ -28,6 +28,7 @@ class MemoryProxy;
#include "COM_ExecutionGroup.h"
class ExecutionGroup;
+class WriteBufferOperation;
/**
* @brief A MemoryProxy is a unique identifier for a memory buffer.
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index b62e2d08d9a..67f4d2523f3 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -22,27 +22,32 @@
#include <string.h>
+extern "C" {
#include "BKE_node.h"
-#include "COM_Node.h"
-#include "COM_NodeOperation.h"
-#include "COM_SetValueOperation.h"
-#include "COM_SetVectorOperation.h"
-#include "COM_SetColorOperation.h"
-#include "COM_SocketConnection.h"
+#include "RNA_access.h"
+}
+
#include "COM_ExecutionSystem.h"
-#include "COM_PreviewOperation.h"
+#include "COM_NodeOperation.h"
#include "COM_TranslateOperation.h"
#include "COM_SocketProxyNode.h"
-//#include <stdio.h>
#include "COM_defines.h"
-Node::Node(bNode *editorNode, bool create_sockets) : NodeBase()
+#include "COM_Node.h" /* own include */
+
+/**************
+ **** Node ****
+ **************/
+
+Node::Node(bNode *editorNode, bool create_sockets) :
+ m_editorNodeTree(NULL),
+ m_editorNode(editorNode),
+ m_inActiveGroup(false),
+ m_instanceKey(NODE_INSTANCE_KEY_NONE)
{
- setbNode(editorNode);
-
if (create_sockets) {
bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first;
while (input != NULL) {
@@ -50,7 +55,7 @@ Node::Node(bNode *editorNode, bool create_sockets) : NodeBase()
if (input->type == SOCK_RGBA) dt = COM_DT_COLOR;
if (input->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
- this->addInputSocket(dt, (InputSocketResizeMode)input->resizemode, input);
+ this->addInputSocket(dt, input);
input = input->next;
}
bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first;
@@ -65,102 +70,50 @@ Node::Node(bNode *editorNode, bool create_sockets) : NodeBase()
}
}
-void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
+Node::~Node()
{
- InputSocket *input = getInputSocket(editorNodeInputSocketIndex);
- SetValueOperation *operation = new SetValueOperation();
- operation->setValue(input->getEditorValueFloat());
- this->addLink(graph, operation->getOutputSocket(), inputsocket);
- graph->addOperation(operation);
+ while (!this->m_outputsockets.empty()) {
+ delete (this->m_outputsockets.back());
+ this->m_outputsockets.pop_back();
+ }
+ while (!this->m_inputsockets.empty()) {
+ delete (this->m_inputsockets.back());
+ this->m_inputsockets.pop_back();
+ }
}
-void Node::addPreviewOperation(ExecutionSystem *system, CompositorContext *context, OutputSocket *outputSocket)
+void Node::addInputSocket(DataType datatype)
{
- if (this->isInActiveGroup()) {
- if (!(this->getbNode()->flag & NODE_HIDDEN)) { // do not calculate previews of hidden nodes.
- bNodeInstanceHash *previews = context->getPreviewHash();
- if (previews && (this->getbNode()->flag & NODE_PREVIEW)) {
- PreviewOperation *operation = new PreviewOperation(context->getViewSettings(), context->getDisplaySettings());
- system->addOperation(operation);
- operation->setbNode(this->getbNode());
- operation->setbNodeTree(system->getContext().getbNodeTree());
- operation->verifyPreview(previews, this->getInstanceKey());
- this->addLink(system, outputSocket, operation->getInputSocket(0));
- }
- }
- }
+ this->addInputSocket(datatype, NULL);
}
-void Node::addPreviewOperation(ExecutionSystem *system, CompositorContext *context, InputSocket *inputSocket)
+void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket)
{
- if (inputSocket->isConnected() && this->isInActiveGroup()) {
- OutputSocket *outputsocket = inputSocket->getConnection()->getFromSocket();
- this->addPreviewOperation(system, context, outputsocket);
- }
+ NodeInput *socket = new NodeInput(this, bSocket, datatype);
+ this->m_inputsockets.push_back(socket);
}
-SocketConnection *Node::addLink(ExecutionSystem *graph, OutputSocket *outputSocket, InputSocket *inputsocket)
+void Node::addOutputSocket(DataType datatype)
{
- if (inputsocket->isConnected()) {
- return NULL;
- }
- SocketConnection *connection = new SocketConnection();
- connection->setFromSocket(outputSocket);
- outputSocket->addConnection(connection);
- connection->setToSocket(inputsocket);
- inputsocket->setConnection(connection);
- graph->addSocketConnection(connection);
- return connection;
-}
-
-void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
-{
- InputSocket *input = getInputSocket(editorNodeInputSocketIndex);
- SetColorOperation *operation = new SetColorOperation();
- float col[4];
- input->getEditorValueColor(col);
- operation->setChannel1(col[0]);
- operation->setChannel2(col[1]);
- operation->setChannel3(col[2]);
- operation->setChannel4(col[3]);
- this->addLink(graph, operation->getOutputSocket(), inputsocket);
- graph->addOperation(operation);
-}
-
-void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
-{
- InputSocket *input = getInputSocket(editorNodeInputSocketIndex);
- SetVectorOperation *operation = new SetVectorOperation();
- float vec[3];
- input->getEditorValueVector(vec);
- operation->setX(vec[0]);
- operation->setY(vec[1]);
- operation->setZ(vec[2]);
- this->addLink(graph, operation->getOutputSocket(), inputsocket);
- graph->addOperation(operation);
-}
-
-NodeOperation *Node::convertToOperations_invalid_index(ExecutionSystem *graph, int index)
-{
- const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
- SetColorOperation *operation = new SetColorOperation();
- operation->setChannels(warning_color);
-
- /* link the operation */
- this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
- graph->addOperation(operation);
- return operation;
-}
-
-/* when a node has no valid data (missing image / group pointer, or missing renderlayer from EXR) */
-void Node::convertToOperations_invalid(ExecutionSystem *graph, CompositorContext *context)
-{
- /* this is a really bad situation - bring on the pink! - so artists know this is bad */
- int index;
- vector<OutputSocket *> &outputsockets = this->getOutputSockets();
- for (index = 0; index < outputsockets.size(); index++) {
- convertToOperations_invalid_index(graph, index);
- }
+ this->addOutputSocket(datatype, NULL);
+
+}
+void Node::addOutputSocket(DataType datatype, bNodeSocket *bSocket)
+{
+ NodeOutput *socket = new NodeOutput(this, bSocket, datatype);
+ this->m_outputsockets.push_back(socket);
+}
+
+NodeOutput *Node::getOutputSocket(unsigned int index) const
+{
+ BLI_assert(index < this->m_outputsockets.size());
+ return this->m_outputsockets[index];
+}
+
+NodeInput *Node::getInputSocket(unsigned int index) const
+{
+ BLI_assert(index < this->m_inputsockets.size());
+ return this->m_inputsockets[index];
}
bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
@@ -190,28 +143,74 @@ bNodeSocket *Node::getEditorOutputSocket(int editorNodeInputSocketIndex)
return NULL;
}
-InputSocket *Node::findInputSocketBybNodeSocket(bNodeSocket *socket)
+
+/*******************
+ **** NodeInput ****
+ *******************/
+
+NodeInput::NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype) :
+ m_node(node),
+ m_editorSocket(b_socket),
+ m_datatype(datatype),
+ m_link(NULL)
{
- vector<InputSocket *> &inputsockets = this->getInputSockets();
- unsigned int index;
- for (index = 0; index < inputsockets.size(); index++) {
- InputSocket *input = inputsockets[index];
- if (input->getbNodeSocket() == socket) {
- return input;
- }
- }
- return NULL;
}
-OutputSocket *Node::findOutputSocketBybNodeSocket(bNodeSocket *socket)
+void NodeInput::setLink(NodeOutput *link)
{
- vector<OutputSocket *> &outputsockets = this->getOutputSockets();
- unsigned int index;
- for (index = 0; index < outputsockets.size(); index++) {
- OutputSocket *output = outputsockets[index];
- if (output->getbNodeSocket() == socket) {
- return output;
- }
- }
- return NULL;
+ m_link = link;
+}
+
+float NodeInput::getEditorValueFloat()
+{
+ PointerRNA ptr;
+ RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
+ return RNA_float_get(&ptr, "default_value");
+}
+
+void NodeInput::getEditorValueColor(float *value)
+{
+ PointerRNA ptr;
+ RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
+ return RNA_float_get_array(&ptr, "default_value", value);
+}
+
+void NodeInput::getEditorValueVector(float *value)
+{
+ PointerRNA ptr;
+ RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
+ return RNA_float_get_array(&ptr, "default_value", value);
+}
+
+
+/********************
+ **** NodeOutput ****
+ ********************/
+
+NodeOutput::NodeOutput(Node *node, bNodeSocket *b_socket, DataType datatype) :
+ m_node(node),
+ m_editorSocket(b_socket),
+ m_datatype(datatype)
+{
+}
+
+float NodeOutput::getEditorValueFloat()
+{
+ PointerRNA ptr;
+ RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
+ return RNA_float_get(&ptr, "default_value");
+}
+
+void NodeOutput::getEditorValueColor(float *value)
+{
+ PointerRNA ptr;
+ RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
+ return RNA_float_get_array(&ptr, "default_value", value);
+}
+
+void NodeOutput::getEditorValueVector(float *value)
+{
+ PointerRNA ptr;
+ RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
+ return RNA_float_get_array(&ptr, "default_value", value);
}
diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h
index c14a1973da5..6046af24c55 100644
--- a/source/blender/compositor/intern/COM_Node.h
+++ b/source/blender/compositor/intern/COM_Node.h
@@ -23,32 +23,50 @@
#ifndef __COM_NODE_H__
#define __COM_NODE_H__
-#include "COM_NodeBase.h"
-#include "COM_InputSocket.h"
-#include "COM_OutputSocket.h"
-#include "COM_CompositorContext.h"
#include "DNA_node_types.h"
#include "BKE_text.h"
-#include "COM_ExecutionSystem.h"
#include <vector>
#include <string>
#include <algorithm>
-using namespace std;
+/* common node includes
+ * added here so node files don't have to include themselves
+ */
+#include "COM_CompositorContext.h"
+#include "COM_NodeConverter.h"
class Node;
class NodeOperation;
-class ExecutionSystem;
-
-typedef vector<Node *> NodeList;
-typedef NodeList::iterator NodeIterator;
-typedef pair<NodeIterator, NodeIterator> NodeRange;
+class NodeConverter;
/**
* My node documentation.
*/
-class Node : public NodeBase {
+class Node {
+public:
+ typedef std::vector<NodeInput *> Inputs;
+ typedef std::vector<NodeOutput *> Outputs;
+
private:
+ /**
+ * @brief stores the reference to the SDNA bNode struct
+ */
+ bNodeTree *m_editorNodeTree;
+
+ /**
+ * @brief stores the reference to the SDNA bNode struct
+ */
+ bNode *m_editorNode;
+
+ /**
+ * @brief the list of actual inputsockets @see NodeInput
+ */
+ Inputs m_inputsockets;
+
+ /**
+ * @brief the list of actual outputsockets @see NodeOutput
+ */
+ Outputs m_outputsockets;
/**
* @brief Is this node part of the active group
@@ -60,10 +78,81 @@ private:
*/
bNodeInstanceKey m_instanceKey;
+protected:
+ /**
+ * @brief get access to the vector of input sockets
+ */
+ const Inputs &getInputSockets() const { return this->m_inputsockets; }
+
+ /**
+ * @brief get access to the vector of input sockets
+ */
+ const Outputs &getOutputSockets() const { return this->m_outputsockets; }
+
public:
Node(bNode *editorNode, bool create_sockets = true);
+ virtual ~Node();
+
+ /**
+ * @brief get the reference to the SDNA bNode struct
+ */
+ bNode *getbNode() const {return m_editorNode;}
/**
+ * @brief get the reference to the SDNA bNodeTree struct
+ */
+ bNodeTree *getbNodeTree() const {return m_editorNodeTree;}
+
+ /**
+ * @brief set the reference to the bNode
+ * @note used in Node instances to receive the storage/settings and complex node for highlight during execution
+ * @param bNode
+ */
+ void setbNode(bNode *node) {this->m_editorNode = node;}
+
+ /**
+ * @brief set the reference to the bNodeTree
+ * @param bNodeTree
+ */
+ void setbNodeTree(bNodeTree *nodetree) {this->m_editorNodeTree = nodetree;}
+
+ /**
+ * @brief Return the number of input sockets of this node.
+ */
+ const unsigned int getNumberOfInputSockets() const { return this->m_inputsockets.size(); }
+
+ /**
+ * @brief Return the number of output sockets of this node.
+ */
+ const unsigned int getNumberOfOutputSockets() const { return this->m_outputsockets.size(); }
+
+ /**
+ * get the reference to a certain outputsocket
+ * @param index
+ * the index of the needed outputsocket
+ */
+ NodeOutput *getOutputSocket(const unsigned int index) const;
+
+ /**
+ * get the reference to the first outputsocket
+ * @param index
+ * the index of the needed outputsocket
+ */
+ inline NodeOutput *getOutputSocket() const { return getOutputSocket(0); }
+
+ /**
+ * get the reference to a certain inputsocket
+ * @param index
+ * the index of the needed inputsocket
+ */
+ NodeInput *getInputSocket(const unsigned int index) const;
+
+ /** Check if this is an input node
+ * An input node is a node that only has output sockets and no input sockets
+ */
+ bool isInputNode() const { return m_inputsockets.empty(); }
+
+ /**
* @brief Is this node in the active group (the group that is being edited)
* @param isInActiveGroup
*/
@@ -75,7 +164,7 @@ public:
* the active group will be the main tree (all nodes that are not part of a group will be active)
* @return bool [false:true]
*/
- inline bool isInActiveGroup() { return this->m_inActiveGroup; }
+ inline bool isInActiveGroup() const { return this->m_inActiveGroup; }
/**
* @brief convert node to operation
@@ -85,76 +174,99 @@ public:
* @param system the ExecutionSystem where the operations need to be added
* @param context reference to the CompositorContext
*/
- virtual void convertToOperations(ExecutionSystem *system, CompositorContext *context) = 0;
-
- /**
- * this method adds a SetValueOperation as input of the input socket.
- * This can only be used from the convertToOperation method. all other usages are not allowed
- */
- void addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
-
- /**
- * this method adds a SetColorOperation as input of the input socket.
- * This can only be used from the convertToOperation method. all other usages are not allowed
- */
- void addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
-
- /**
- * this method adds a SetVectorOperation as input of the input socket.
- * This can only be used from the convertToOperation method. all other usages are not allowed
- */
- void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
+ virtual void convertToOperations(NodeConverter &converter, const CompositorContext &context) const = 0;
/**
* Create dummy warning operation, use when we can't get the source data.
*/
- NodeOperation *convertToOperations_invalid_index(ExecutionSystem *graph, int index);
+ NodeOperation *convertToOperations_invalid_index(NodeConverter *compiler, int index) const;
/**
* when a node has no valid data (missing image or a group nodes ID pointer is NULL)
* call this function from #convertToOperations, this way the node sockets are converted
* into valid outputs, without this the compositor system gets confused and crashes, see [#32490]
*/
- void convertToOperations_invalid(ExecutionSystem *graph, CompositorContext *context);
-
- /**
- * Creates a new link between an outputSocket and inputSocket and registrates the link to the graph
- * @return the new created link
- */
- SocketConnection *addLink(ExecutionSystem *graph, OutputSocket *outputSocket, InputSocket *inputsocket);
+ void convertToOperations_invalid(NodeConverter *compiler) const;
+ void setInstanceKey(bNodeInstanceKey instance_key) { m_instanceKey = instance_key; }
+ bNodeInstanceKey getInstanceKey() const { return m_instanceKey; }
+
+protected:
/**
- * is this node a group node.
- */
- virtual bool isGroupNode() const { return false; }
- /**
- * is this node a proxy node.
+ * @brief add an NodeInput to the collection of inputsockets
+ * @note may only be called in an constructor
+ * @param socket the NodeInput to add
*/
- virtual bool isProxyNode() const { return false; }
+ void addInputSocket(DataType datatype);
+ void addInputSocket(DataType datatype, bNodeSocket *socket);
/**
- * @brief find the InputSocket by bNodeSocket
- *
- * @param socket
+ * @brief add an NodeOutput to the collection of outputsockets
+ * @note may only be called in an constructor
+ * @param socket the NodeOutput to add
*/
- InputSocket *findInputSocketBybNodeSocket(bNodeSocket *socket);
+ void addOutputSocket(DataType datatype);
+ void addOutputSocket(DataType datatype, bNodeSocket *socket);
+
+ bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex);
+ bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex);
+};
+
+
+/**
+ * @brief NodeInput are sockets that can receive data/input
+ * @ingroup Model
+ */
+class NodeInput {
+private:
+ Node *m_node;
+ bNodeSocket *m_editorSocket;
+
+ DataType m_datatype;
/**
- * @brief find the OutputSocket by bNodeSocket
- *
- * @param socket
+ * @brief link connected to this NodeInput.
+ * An input socket can only have a single link
*/
- OutputSocket *findOutputSocketBybNodeSocket(bNodeSocket *socket);
+ NodeOutput *m_link;
- void setInstanceKey(bNodeInstanceKey instance_key) { m_instanceKey = instance_key; }
- bNodeInstanceKey getInstanceKey() const { return m_instanceKey; }
+public:
+ NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype);
-protected:
- void addPreviewOperation(ExecutionSystem *system, CompositorContext *context, InputSocket *inputSocket);
- void addPreviewOperation(ExecutionSystem *system, CompositorContext *context, OutputSocket *outputSocket);
+ Node *getNode() const { return this->m_node; }
+ DataType getDataType() const { return m_datatype; }
+ bNodeSocket *getbNodeSocket() const { return this->m_editorSocket; }
- bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex);
- bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex);
+ void setLink(NodeOutput *link);
+ bool isLinked() const { return m_link; }
+ NodeOutput *getLink() { return m_link; }
+
+ float getEditorValueFloat();
+ void getEditorValueColor(float *value);
+ void getEditorValueVector(float *value);
+};
+
+
+/**
+ * @brief NodeOutput are sockets that can send data/input
+ * @ingroup Model
+ */
+class NodeOutput {
private:
+ Node *m_node;
+ bNodeSocket *m_editorSocket;
+
+ DataType m_datatype;
+
+public:
+ NodeOutput(Node *node, bNodeSocket *b_socket, DataType datatype);
+
+ Node *getNode() const { return this->m_node; }
+ DataType getDataType() const { return m_datatype; }
+ bNodeSocket *getbNodeSocket() const { return this->m_editorSocket; }
+
+ float getEditorValueFloat();
+ void getEditorValueColor(float *value);
+ void getEditorValueVector(float *value);
};
#endif /* __COM_NODE_H__ */
diff --git a/source/blender/compositor/intern/COM_NodeBase.cpp b/source/blender/compositor/intern/COM_NodeBase.cpp
deleted file mode 100644
index 5c2ce37bdea..00000000000
--- a/source/blender/compositor/intern/COM_NodeBase.cpp
+++ /dev/null
@@ -1,96 +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 <string.h>
-
-#include "BKE_node.h"
-
-#include "COM_NodeBase.h"
-#include "COM_NodeOperation.h"
-#include "COM_SetValueOperation.h"
-#include "COM_SetColorOperation.h"
-#include "COM_SocketConnection.h"
-#include "COM_ExecutionSystem.h"
-
-NodeBase::NodeBase()
-{
- this->m_editorNode = NULL;
-}
-
-
-NodeBase::~NodeBase()
-{
- while (!this->m_outputsockets.empty()) {
- delete (this->m_outputsockets.back());
- this->m_outputsockets.pop_back();
- }
- while (!this->m_inputsockets.empty()) {
- delete (this->m_inputsockets.back());
- this->m_inputsockets.pop_back();
- }
-}
-
-void NodeBase::addInputSocket(DataType datatype)
-{
- this->addInputSocket(datatype, COM_SC_CENTER, NULL);
-}
-
-void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode)
-{
- this->addInputSocket(datatype, resizeMode, NULL);
-}
-void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket *bSocket)
-{
- InputSocket *socket = new InputSocket(datatype, resizeMode);
- socket->setEditorSocket(bSocket);
- socket->setNode(this);
- this->m_inputsockets.push_back(socket);
-}
-
-void NodeBase::addOutputSocket(DataType datatype)
-{
- this->addOutputSocket(datatype, NULL);
-
-}
-void NodeBase::addOutputSocket(DataType datatype, bNodeSocket *bSocket)
-{
- OutputSocket *socket = new OutputSocket(datatype);
- socket->setEditorSocket(bSocket);
- socket->setNode(this);
- this->m_outputsockets.push_back(socket);
-}
-const bool NodeBase::isInputNode() const
-{
- return this->m_inputsockets.size() == 0;
-}
-
-OutputSocket *NodeBase::getOutputSocket(unsigned int index)
-{
- BLI_assert(index < this->m_outputsockets.size());
- return this->m_outputsockets[index];
-}
-
-InputSocket *NodeBase::getInputSocket(unsigned int index)
-{
- BLI_assert(index < this->m_inputsockets.size());
- return this->m_inputsockets[index];
-}
diff --git a/source/blender/compositor/intern/COM_NodeBase.h b/source/blender/compositor/intern/COM_NodeBase.h
deleted file mode 100644
index e2072575509..00000000000
--- a/source/blender/compositor/intern/COM_NodeBase.h
+++ /dev/null
@@ -1,185 +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_NODEBASE_H__
-#define __COM_NODEBASE_H__
-
-#include "COM_InputSocket.h"
-#include "COM_OutputSocket.h"
-#include "DNA_node_types.h"
-#include "BKE_text.h"
-#include <vector>
-#include <string>
-
-using namespace std;
-
-
-class NodeOperation;
-class ExecutionSystem;
-
-/**
- * @brief The NodeBase class is the super-class of all node related objects like @see Node @see NodeOperation
- * the reason for the existence of this class is to support graph-nodes when using ExecutionSystem
- * the NodeBase also contains the reference to InputSocket and OutputSocket.
- * @ingroup Model
- */
-class NodeBase {
-private:
- /**
- * @brief the list of actual inputsockets @see InputSocket
- */
- vector<InputSocket *> m_inputsockets;
-
- /**
- * @brief the list of actual outputsockets @see OutputSocket
- */
- vector<OutputSocket *> m_outputsockets;
-
- /**
- * @brief stores the reference to the SDNA bNode struct
- */
- bNode *m_editorNode;
-
- /**
- * @brief stores the reference to the SDNA bNode struct
- */
- bNodeTree *m_editorNodeTree;
-
-protected:
- /**
- * @brief get access to the vector of input sockets
- */
- inline vector<InputSocket *>& getInputSockets() { return this->m_inputsockets; }
-
- /**
- * @brief get access to the vector of input sockets
- */
- inline vector<OutputSocket *>& getOutputSockets() { return this->m_outputsockets; }
-
-
-protected:
- /**
- * @brief destructor
- * clean up memory related to this NodeBase.
- */
- virtual ~NodeBase();
-
-public:
- /**
- * @brief get the reference to the SDNA bNode struct
- */
- bNode *getbNode() const {return m_editorNode;}
-
- /**
- * @brief get the reference to the SDNA bNodeTree struct
- */
- bNodeTree *getbNodeTree() const {return m_editorNodeTree;}
-
- /**
- * @brief set the reference to the bNode
- * @note used in Node instances to receive the storage/settings and complex node for highlight during execution
- * @param bNode
- */
- void setbNode(bNode *node) {this->m_editorNode = node;}
-
- /**
- * @brief set the reference to the bNodeTree
- * @param bNodeTree
- */
- void setbNodeTree(bNodeTree *nodetree) {this->m_editorNodeTree = nodetree;}
-
- /**
- * @brief is this node an operation?
- * This is true when the instance is of the subclass NodeOperation.
- * @return [true:false]
- * @see NodeOperation
- */
- virtual const bool isOperation() const { return false; }
-
- /**
- * @brief check if this is an input node
- * An input node is a node that only has output sockets and no input sockets
- * @return [false..true]
- */
- const bool isInputNode() const;
-
- /**
- * @brief Return the number of input sockets of this node.
- */
- const unsigned int getNumberOfInputSockets() const { return this->m_inputsockets.size(); }
-
- /**
- * @brief Return the number of output sockets of this node.
- */
- const unsigned int getNumberOfOutputSockets() const { return this->m_outputsockets.size(); }
-
- /**
- * get the reference to a certain outputsocket
- * @param index
- * the index of the needed outputsocket
- */
- OutputSocket *getOutputSocket(const unsigned int index);
-
- /**
- * get the reference to the first outputsocket
- * @param index
- * the index of the needed outputsocket
- */
- inline OutputSocket *getOutputSocket() { return getOutputSocket(0); }
-
- /**
- * get the reference to a certain inputsocket
- * @param index
- * the index of the needed inputsocket
- */
- InputSocket *getInputSocket(const unsigned int index);
-
- virtual bool isStatic() const { return false; }
- void getStaticValues(float *result) const { }
-
-protected:
- NodeBase();
-
- /**
- * @brief add an InputSocket to the collection of inputsockets
- * @note may only be called in an constructor
- * @param socket the InputSocket to add
- */
- void addInputSocket(DataType datatype);
- void addInputSocket(DataType datatype, InputSocketResizeMode resizeMode);
- void addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket *socket);
-
- /**
- * @brief add an OutputSocket to the collection of outputsockets
- * @note may only be called in an constructor
- * @param socket the OutputSocket to add
- */
- void addOutputSocket(DataType datatype);
- void addOutputSocket(DataType datatype, bNodeSocket *socket);
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeBase")
-#endif
-};
-
-#endif /* __COM_NODEBASE_H__ */
diff --git a/source/blender/compositor/intern/COM_NodeConverter.cpp b/source/blender/compositor/intern/COM_NodeConverter.cpp
new file mode 100644
index 00000000000..833fcedbc53
--- /dev/null
+++ b/source/blender/compositor/intern/COM_NodeConverter.cpp
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2013, 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:
+ * Lukas Toenne
+ */
+
+extern "C" {
+#include "BLI_utildefines.h"
+}
+
+#include "COM_Debug.h"
+
+#include "COM_NodeOperationBuilder.h"
+#include "COM_NodeOperation.h"
+#include "COM_SetValueOperation.h"
+#include "COM_SetVectorOperation.h"
+#include "COM_SetColorOperation.h"
+#include "COM_SocketProxyOperation.h"
+
+#include "COM_NodeConverter.h" /* own include */
+
+NodeConverter::NodeConverter(NodeOperationBuilder *builder) :
+ m_builder(builder)
+{
+}
+
+void NodeConverter::addOperation(NodeOperation *operation)
+{
+ m_builder->addOperation(operation);
+}
+
+void NodeConverter::mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket)
+{
+ m_builder->mapInputSocket(node_socket, operation_socket);
+}
+
+void NodeConverter::mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
+{
+ m_builder->mapOutputSocket(node_socket, operation_socket);
+}
+
+void NodeConverter::addLink(NodeOperationOutput *from, NodeOperationInput *to)
+{
+ m_builder->addLink(from, to);
+}
+
+void NodeConverter::addPreview(NodeOperationOutput *output)
+{
+ m_builder->addPreview(output);
+}
+
+void NodeConverter::addNodeInputPreview(NodeInput *input)
+{
+ m_builder->addNodeInputPreview(input);
+}
+
+NodeOperation *NodeConverter::setInvalidOutput(NodeOutput *output)
+{
+ /* this is a really bad situation - bring on the pink! - so artists know this is bad */
+ const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
+
+ SetColorOperation *operation = new SetColorOperation();
+ operation->setChannels(warning_color);
+
+ m_builder->addOperation(operation);
+ m_builder->mapOutputSocket(output, operation->getOutputSocket());
+
+ return operation;
+}
+
+NodeOperationOutput *NodeConverter::addInputProxy(NodeInput *input)
+{
+ SocketProxyOperation *proxy = new SocketProxyOperation(input->getDataType());
+ m_builder->addOperation(proxy);
+
+ m_builder->mapInputSocket(input, proxy->getInputSocket(0));
+
+ return proxy->getOutputSocket();
+}
+
+NodeOperationInput *NodeConverter::addOutputProxy(NodeOutput *output)
+{
+ SocketProxyOperation *proxy = new SocketProxyOperation(output->getDataType());
+ m_builder->addOperation(proxy);
+
+ m_builder->mapOutputSocket(output, proxy->getOutputSocket());
+
+ return proxy->getInputSocket(0);
+}
+
+void NodeConverter::addOutputValue(NodeOutput *output, float value)
+{
+ SetValueOperation *operation = new SetValueOperation();
+ operation->setValue(value);
+
+ m_builder->addOperation(operation);
+ m_builder->mapOutputSocket(output, operation->getOutputSocket());
+}
+
+void NodeConverter::addOutputColor(NodeOutput *output, const float value[4])
+{
+ SetColorOperation *operation = new SetColorOperation();
+ operation->setChannels(value);
+
+ m_builder->addOperation(operation);
+ m_builder->mapOutputSocket(output, operation->getOutputSocket());
+}
+
+void NodeConverter::addOutputVector(NodeOutput *output, const float value[3])
+{
+ SetVectorOperation *operation = new SetVectorOperation();
+ operation->setVector(value);
+
+ m_builder->addOperation(operation);
+ m_builder->mapOutputSocket(output, operation->getOutputSocket());
+}
diff --git a/source/blender/compositor/intern/COM_NodeConverter.h b/source/blender/compositor/intern/COM_NodeConverter.h
new file mode 100644
index 00000000000..51a1a44cade
--- /dev/null
+++ b/source/blender/compositor/intern/COM_NodeConverter.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2013, 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:
+ * Lukas Toenne
+ */
+
+#ifndef _COM_NodeCompiler_h
+#define _COM_NodeCompiler_h
+
+class NodeInput;
+class NodeOutput;
+
+class NodeOperation;
+class NodeOperationInput;
+class NodeOperationOutput;
+class NodeOperationBuilder;
+
+/** Interface type for converting a \a Node into \a NodeOperation.
+ * This is passed to \a Node::convertToOperation methods and allows them
+ * to register any number of operations, create links between them,
+ * and map original node sockets to their inputs or outputs.
+ */
+class NodeConverter {
+public:
+ NodeConverter(NodeOperationBuilder *builder);
+
+ /** Insert a new operation into the operations graph.
+ * The operation must be created by the node.
+ */
+ void addOperation(NodeOperation *operation);
+
+ /** Map input socket of the node to an operation socket.
+ * Links between nodes will then generate equivalent links between
+ * the mapped operation sockets.
+ *
+ * \note A \a Node input can be mapped to multiple \a NodeOperation inputs.
+ */
+ void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket);
+ /** Map output socket of the node to an operation socket.
+ * Links between nodes will then generate equivalent links between
+ * the mapped operation sockets.
+ *
+ * \note A \a Node output can only be mapped to one \a NodeOperation output.
+ * Any existing operation output mapping will be replaced.
+ */
+ void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
+
+ /** Create a proxy operation for a node input.
+ * This operation will be removed later and replaced
+ * by direct links between the connected operations.
+ */
+ NodeOperationOutput *addInputProxy(NodeInput *input);
+ /** Create a proxy operation for a node output.
+ * This operation will be removed later and replaced
+ * by direct links between the connected operations.
+ */
+ NodeOperationInput *addOutputProxy(NodeOutput *output);
+
+ /** Define a constant output value. */
+ void addOutputValue(NodeOutput *output, float value);
+ /** Define a constant output color. */
+ void addOutputColor(NodeOutput *output, const float value[4]);
+ /** Define a constant output vector. */
+ void addOutputVector(NodeOutput *output, const float value[3]);
+
+ /** Add an explicit link between two operations. */
+ void addLink(NodeOperationOutput *from, NodeOperationInput *to);
+
+ /** Add a preview operation for a operation output. */
+ void addPreview(NodeOperationOutput *output);
+ /** Add a preview operation for a node input. */
+ void addNodeInputPreview(NodeInput *input);
+
+ /** When a node has no valid data
+ * @note missing image / group pointer, or missing renderlayer from EXR
+ */
+ NodeOperation *setInvalidOutput(NodeOutput *output);
+
+private:
+ /** The internal builder for storing the results of the graph construction. */
+ NodeOperationBuilder *m_builder;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeCompiler")
+#endif
+};
+
+#endif /* _COM_NodeCompiler_h */
diff --git a/source/blender/compositor/intern/COM_NodeGraph.cpp b/source/blender/compositor/intern/COM_NodeGraph.cpp
new file mode 100644
index 00000000000..d942d43befc
--- /dev/null
+++ b/source/blender/compositor/intern/COM_NodeGraph.cpp
@@ -0,0 +1,280 @@
+/*
+ * Copyright 2013, 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:
+ * Lukas Toenne
+ */
+
+#include <cstring>
+
+extern "C" {
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_node_types.h"
+
+#include "BKE_node.h"
+}
+
+#include "COM_CompositorContext.h"
+#include "COM_Converter.h"
+#include "COM_Debug.h"
+#include "COM_Node.h"
+#include "COM_SocketProxyNode.h"
+
+#include "COM_NodeGraph.h" /* own include */
+
+/*******************
+ **** NodeGraph ****
+ *******************/
+
+NodeGraph::NodeGraph()
+{
+}
+
+NodeGraph::~NodeGraph()
+{
+ for (int index = 0; index < this->m_nodes.size(); index++) {
+ Node *node = this->m_nodes[index];
+ delete node;
+ }
+}
+
+void NodeGraph::from_bNodeTree(const CompositorContext &context, bNodeTree *tree)
+{
+ add_bNodeTree(context, 0, tree, NODE_INSTANCE_KEY_BASE);
+}
+
+bNodeSocket *NodeGraph::find_b_node_input(bNode *b_group_node, const char *identifier)
+{
+ for (bNodeSocket *b_sock = (bNodeSocket *)b_group_node->inputs.first; b_sock; b_sock = b_sock->next) {
+ if (STREQ(b_sock->identifier, identifier))
+ return b_sock;
+ }
+ return NULL;
+}
+
+bNodeSocket *NodeGraph::find_b_node_output(bNode *b_group_node, const char *identifier)
+{
+ for (bNodeSocket *b_sock = (bNodeSocket *)b_group_node->outputs.first; b_sock; b_sock = b_sock->next) {
+ if (STREQ(b_sock->identifier, identifier))
+ return b_sock;
+ }
+ return NULL;
+}
+
+void NodeGraph::add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, bool is_active_group)
+{
+ node->setbNodeTree(b_ntree);
+ node->setInstanceKey(key);
+ node->setIsInActiveGroup(is_active_group);
+
+ m_nodes.push_back(node);
+
+ DebugInfo::node_added(node);
+}
+
+void NodeGraph::add_link(NodeOutput *fromSocket, NodeInput *toSocket)
+{
+ m_links.push_back(Link(fromSocket, toSocket));
+
+ /* register with the input */
+ toSocket->setLink(fromSocket);
+}
+
+void NodeGraph::add_bNodeTree(const CompositorContext &context, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key)
+{
+ const bNodeTree *basetree = context.getbNodeTree();
+
+ /* update viewers in the active edittree as well the base tree (for backdrop) */
+ bool is_active_group = ((parent_key.value == basetree->active_viewer_key.value) ||
+ (tree == basetree));
+
+ /* add all nodes of the tree to the node list */
+ for (bNode *node = (bNode *)tree->nodes.first; node; node = node->next) {
+ bNodeInstanceKey key = BKE_node_instance_key(parent_key, tree, node);
+ add_bNode(context, tree, node, key, is_active_group);
+ }
+
+ NodeRange node_range(m_nodes.begin() + nodes_start, m_nodes.end());
+ /* add all nodelinks of the tree to the link list */
+ for (bNodeLink *nodelink = (bNodeLink *)tree->links.first; nodelink; nodelink = nodelink->next) {
+ add_bNodeLink(node_range, nodelink);
+ }
+}
+
+void NodeGraph::add_bNode(const CompositorContext &context, bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group)
+{
+ /* replace muted nodes by proxies for internal links */
+ if (b_node->flag & NODE_MUTED) {
+ add_proxies_mute(b_ntree, b_node, key, is_active_group);
+ return;
+ }
+
+ /* replace slow nodes with proxies for fast execution */
+ if (context.isFastCalculation() && !Converter::is_fast_node(b_node)) {
+ add_proxies_skip(b_ntree, b_node, key, is_active_group);
+ return;
+ }
+
+ /* special node types */
+ if (b_node->type == NODE_GROUP) {
+ add_proxies_group(context, b_node, key);
+ return;
+ }
+
+ Node *node = Converter::convert(b_node);
+ if (node)
+ add_node(node, b_ntree, key, is_active_group);
+}
+
+NodeInput *NodeGraph::find_input(const NodeRange &node_range, bNodeSocket *b_socket)
+{
+ for (NodeGraph::NodeIterator it = node_range.first; it != node_range.second; ++it) {
+ Node *node = *it;
+ for (int index = 0; index < node->getNumberOfInputSockets(); index++) {
+ NodeInput *input = node->getInputSocket(index);
+ if (input->getbNodeSocket() == b_socket)
+ return input;
+ }
+ }
+ return NULL;
+}
+
+NodeOutput *NodeGraph::find_output(const NodeRange &node_range, bNodeSocket *b_socket)
+{
+ for (NodeGraph::NodeIterator it = node_range.first; it != node_range.second; ++it) {
+ Node *node = *it;
+ for (int index = 0; index < node->getNumberOfOutputSockets(); index++) {
+ NodeOutput *output = node->getOutputSocket(index);
+ if (output->getbNodeSocket() == b_socket)
+ return output;
+ }
+ }
+ return NULL;
+}
+
+void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink)
+{
+ /// @note: ignore invalid links
+ if (!(b_nodelink->flag & NODE_LINK_VALID))
+ return;
+
+ NodeInput *input = find_input(node_range, b_nodelink->tosock);
+ NodeOutput *output = find_output(node_range, b_nodelink->fromsock);
+ if (!input || !output)
+ return;
+ if (input->isLinked())
+ return;
+
+ add_link(output, input);
+}
+
+/* **** Special proxy node type conversions **** */
+
+void NodeGraph::add_proxies_mute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group)
+{
+ for (bNodeLink *b_link = (bNodeLink *)b_node->internal_links.first; b_link; b_link = b_link->next) {
+ SocketProxyNode *proxy = new SocketProxyNode(b_node, b_link->fromsock, b_link->tosock);
+ add_node(proxy, b_ntree, key, is_active_group);
+ }
+}
+
+void NodeGraph::add_proxies_skip(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group)
+{
+ for (bNodeSocket *output = (bNodeSocket *)b_node->outputs.first; output; output = output->next) {
+ bNodeSocket *input;
+
+ /* look for first input with matching datatype for each output */
+ for (input = (bNodeSocket *)b_node->inputs.first; input; input = input->next) {
+ if (input->type == output->type)
+ break;
+ }
+
+ if (input) {
+ SocketProxyNode *proxy = new SocketProxyNode(b_node, input, output);
+ add_node(proxy, b_ntree, key, is_active_group);
+ }
+ }
+}
+
+void NodeGraph::add_proxies_group_inputs(bNode *b_node, bNode *b_node_io)
+{
+ bNodeTree *b_group_tree = (bNodeTree *)b_node->id;
+ BLI_assert(b_group_tree); /* should have been checked in advance */
+
+ /* not important for proxies */
+ bNodeInstanceKey key = NODE_INSTANCE_KEY_BASE;
+ bool is_active_group = false;
+
+ for (bNodeSocket *b_sock_io = (bNodeSocket *)b_node_io->outputs.first; b_sock_io; b_sock_io = b_sock_io->next) {
+ bNodeSocket *b_sock_group = find_b_node_input(b_node, b_sock_io->identifier);
+ if (b_sock_group) {
+ SocketProxyNode *proxy = new SocketProxyNode(b_node_io, b_sock_group, b_sock_io);
+ add_node(proxy, b_group_tree, key, is_active_group);
+ }
+ }
+}
+
+void NodeGraph::add_proxies_group_outputs(bNode *b_node, bNode *b_node_io, bool use_buffer)
+{
+ bNodeTree *b_group_tree = (bNodeTree *)b_node->id;
+ BLI_assert(b_group_tree); /* should have been checked in advance */
+
+ /* not important for proxies */
+ bNodeInstanceKey key = NODE_INSTANCE_KEY_BASE;
+ bool is_active_group = false;
+
+ for (bNodeSocket *b_sock_io = (bNodeSocket *)b_node_io->inputs.first; b_sock_io; b_sock_io = b_sock_io->next) {
+ bNodeSocket *b_sock_group = find_b_node_output(b_node, b_sock_io->identifier);
+ if (b_sock_group) {
+ if (use_buffer) {
+ SocketBufferNode *buffer = new SocketBufferNode(b_node_io, b_sock_io, b_sock_group);
+ add_node(buffer, b_group_tree, key, is_active_group);
+ }
+ else {
+ SocketProxyNode *proxy = new SocketProxyNode(b_node_io, b_sock_io, b_sock_group);
+ add_node(proxy, b_group_tree, key, is_active_group);
+ }
+ }
+ }
+}
+
+void NodeGraph::add_proxies_group(const CompositorContext &context, bNode *b_node, bNodeInstanceKey key)
+{
+ bNodeTree *b_group_tree = (bNodeTree *)b_node->id;
+
+ /* missing node group datablock can happen with library linking */
+ if (!b_group_tree) {
+ /* this error case its handled in convertToOperations() so we don't get un-convertred sockets */
+ return;
+ }
+
+ /* use node list size before adding proxies, so they can be connected in add_bNodeTree */
+ int nodes_start = m_nodes.size();
+
+ /* create proxy nodes for group input/output nodes */
+ for (bNode *b_node_io = (bNode *)b_group_tree->nodes.first; b_node_io; b_node_io = b_node_io->next) {
+ if (b_node_io->type == NODE_GROUP_INPUT)
+ add_proxies_group_inputs(b_node, b_node_io);
+
+ if (b_node_io->type == NODE_GROUP_OUTPUT && (b_node_io->flag & NODE_DO_OUTPUT))
+ add_proxies_group_outputs(b_node, b_node_io, context.isGroupnodeBufferEnabled());
+ }
+
+ add_bNodeTree(context, nodes_start, b_group_tree, key);
+}
diff --git a/source/blender/compositor/intern/COM_NodeGraph.h b/source/blender/compositor/intern/COM_NodeGraph.h
new file mode 100644
index 00000000000..6e2a46e3622
--- /dev/null
+++ b/source/blender/compositor/intern/COM_NodeGraph.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2013, 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:
+ * Lukas Toenne
+ */
+
+#ifndef _COM_NodeGraph_h
+#define _COM_NodeGraph_h
+
+#include <map>
+#include <set>
+#include <vector>
+
+extern "C" {
+#include "DNA_node_types.h"
+}
+
+class CompositorContext;
+class Node;
+class NodeInput;
+class NodeOutput;
+
+/** Internal representation of DNA node data.
+ * This structure is converted into operations by \a NodeCompiler.
+ */
+class NodeGraph {
+public:
+ class Link {
+ private:
+ NodeOutput *m_from;
+ NodeInput *m_to;
+
+ public:
+ Link(NodeOutput *from, NodeInput *to) :
+ m_from(from),
+ m_to(to)
+ {}
+
+ NodeOutput *getFromSocket() const { return m_from; }
+ NodeInput *getToSocket() const { return m_to; }
+ };
+
+ typedef std::vector<Node *> Nodes;
+ typedef Nodes::iterator NodeIterator;
+ typedef std::vector<Link> Links;
+
+private:
+ Nodes m_nodes;
+ Links m_links;
+
+public:
+ NodeGraph();
+ ~NodeGraph();
+
+ const Nodes &nodes() const { return m_nodes; }
+ const Links &links() const { return m_links; }
+
+ void from_bNodeTree(const CompositorContext &context, bNodeTree *tree);
+
+protected:
+ typedef std::pair<NodeIterator, NodeIterator> NodeRange;
+
+ static bNodeSocket *find_b_node_input(bNode *b_node, const char *identifier);
+ static bNodeSocket *find_b_node_output(bNode *b_node, const char *identifier);
+
+ void add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, bool is_active_group);
+ void add_link(NodeOutput *fromSocket, NodeInput *toSocket);
+
+ void add_bNodeTree(const CompositorContext &context, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key);
+
+ void add_bNode(const CompositorContext &context, bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group);
+
+ NodeInput *find_input(const NodeRange &node_range, bNodeSocket *b_socket);
+ NodeOutput *find_output(const NodeRange &node_range, bNodeSocket *b_socket);
+ void add_bNodeLink(const NodeRange &node_range, bNodeLink *bNodeLink);
+
+ /* **** Special proxy node type conversions **** */
+ /* These nodes are not represented in the node graph themselves,
+ * but converted into a number of proxy links
+ */
+
+ void add_proxies_mute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group);
+ void add_proxies_skip(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group);
+
+ void add_proxies_group_inputs(bNode *b_node, bNode *b_node_io);
+ void add_proxies_group_outputs(bNode *b_node, bNode *b_node_io, bool use_buffer);
+ void add_proxies_group(const CompositorContext &context, bNode *b_node, bNodeInstanceKey key);
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeGraph")
+#endif
+};
+
+#endif /* _COM_NodeGraph_h */
diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp
index d33b8085022..f780c609dce 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperation.cpp
@@ -23,12 +23,16 @@
#include <typeinfo>
#include <stdio.h>
-#include "COM_NodeOperation.h"
-#include "COM_InputSocket.h"
-#include "COM_SocketConnection.h"
#include "COM_defines.h"
+#include "COM_ExecutionSystem.h"
-NodeOperation::NodeOperation() : NodeBase()
+#include "COM_NodeOperation.h" /* own include */
+
+/*******************
+ **** NodeOperation ****
+ *******************/
+
+NodeOperation::NodeOperation()
{
this->m_resolutionInputSocketIndex = 0;
this->m_complex = false;
@@ -39,28 +43,63 @@ NodeOperation::NodeOperation() : NodeBase()
this->m_btree = NULL;
}
+NodeOperation::~NodeOperation()
+{
+ while (!this->m_outputs.empty()) {
+ delete (this->m_outputs.back());
+ this->m_outputs.pop_back();
+ }
+ while (!this->m_inputs.empty()) {
+ delete (this->m_inputs.back());
+ this->m_inputs.pop_back();
+ }
+}
+
+NodeOperationOutput *NodeOperation::getOutputSocket(unsigned int index) const
+{
+ BLI_assert(index < m_outputs.size());
+ return m_outputs[index];
+}
+
+NodeOperationInput *NodeOperation::getInputSocket(unsigned int index) const
+{
+ BLI_assert(index < m_inputs.size());
+ return m_inputs[index];
+}
+
+void NodeOperation::addInputSocket(DataType datatype, InputResizeMode resize_mode)
+{
+ NodeOperationInput *socket = new NodeOperationInput(this, datatype, resize_mode);
+ m_inputs.push_back(socket);
+}
+
+void NodeOperation::addOutputSocket(DataType datatype)
+{
+ NodeOperationOutput *socket = new NodeOperationOutput(this, datatype);
+ m_outputs.push_back(socket);
+}
+
void NodeOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
unsigned int temp[2];
unsigned int temp2[2];
- vector<InputSocket *> &inputsockets = this->getInputSockets();
- for (unsigned int index = 0; index < inputsockets.size(); index++) {
- InputSocket *inputSocket = inputsockets[index];
- if (inputSocket->isConnected()) {
+ for (unsigned int index = 0; index < m_inputs.size(); index++) {
+ NodeOperationInput *input = m_inputs[index];
+ if (input->isConnected()) {
if (index == this->m_resolutionInputSocketIndex) {
- inputSocket->determineResolution(resolution, preferredResolution);
+ input->determineResolution(resolution, preferredResolution);
temp2[0] = resolution[0];
temp2[1] = resolution[1];
break;
}
}
}
- for (unsigned int index = 0; index < inputsockets.size(); index++) {
- InputSocket *inputSocket = inputsockets[index];
- if (inputSocket->isConnected()) {
+ for (unsigned int index = 0; index < m_inputs.size(); index++) {
+ NodeOperationInput *input = m_inputs[index];
+ if (input->isConnected()) {
if (index != this->m_resolutionInputSocketIndex) {
- inputSocket->determineResolution(temp, temp2);
+ input->determineResolution(temp, temp2);
}
}
}
@@ -102,25 +141,29 @@ SocketReader *NodeOperation::getInputSocketReader(unsigned int inputSocketIndex)
{
return this->getInputSocket(inputSocketIndex)->getReader();
}
+
NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex)
{
- return this->getInputSocket(inputSocketIndex)->getOperation();
+ NodeOperationInput *input = getInputSocket(inputSocketIndex);
+ if (input && input->isConnected())
+ return &input->getLink()->getOperation();
+ else
+ return NULL;
}
-void NodeOperation::getConnectedInputSockets(vector<InputSocket *> *sockets)
+void NodeOperation::getConnectedInputSockets(Inputs *sockets)
{
- vector<InputSocket *> &inputsockets = this->getInputSockets();
- for (vector<InputSocket *>::iterator iterator = inputsockets.begin(); iterator != inputsockets.end(); iterator++) {
- InputSocket *socket = *iterator;
- if (socket->isConnected()) {
- sockets->push_back(socket);
+ for (Inputs::const_iterator it = m_inputs.begin(); it != m_inputs.end(); ++it) {
+ NodeOperationInput *input = *it;
+ if (input->isConnected()) {
+ sockets->push_back(input);
}
}
}
bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
- if (this->isInputNode()) {
+ if (isInputOperation()) {
BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
return false;
}
@@ -148,3 +191,56 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper
return !first;
}
}
+
+
+/*****************
+ **** OpInput ****
+ *****************/
+
+NodeOperationInput::NodeOperationInput(NodeOperation *op, DataType datatype, InputResizeMode resizeMode) :
+ m_operation(op),
+ m_datatype(datatype),
+ m_resizeMode(resizeMode),
+ m_link(NULL)
+{
+}
+
+SocketReader *NodeOperationInput::getReader()
+{
+ if (isConnected()) {
+ return &m_link->getOperation();
+ }
+ else {
+ return NULL;
+ }
+}
+
+void NodeOperationInput::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
+{
+ if (m_link)
+ m_link->determineResolution(resolution, preferredResolution);
+}
+
+
+/******************
+ **** OpOutput ****
+ ******************/
+
+NodeOperationOutput::NodeOperationOutput(NodeOperation *op, DataType datatype) :
+ m_operation(op),
+ m_datatype(datatype)
+{
+}
+
+void NodeOperationOutput::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
+{
+ NodeOperation &operation = getOperation();
+ if (operation.isResolutionSet()) {
+ resolution[0] = operation.getWidth();
+ resolution[1] = operation.getHeight();
+ }
+ else {
+ operation.determineResolution(resolution, preferredResolution);
+ operation.setResolution(resolution);
+ }
+}
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index 160e493073e..3f636dff63c 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -20,32 +20,72 @@
* Monique Dewanchand
*/
-#ifndef _COM_NodeOperation_h
-#define _COM_NodeOperation_h
-class OpenCLDevice;
-#include "COM_Node.h"
+#ifndef _COM_Operation_h
+#define _COM_Operation_h
+
+#include <list>
#include <string>
#include <sstream>
+
+extern "C" {
+#include "BLI_math_color.h"
+#include "BLI_math_vector.h"
+#include "BLI_threads.h"
+}
+
+#include "COM_Node.h"
#include "COM_MemoryBuffer.h"
#include "COM_MemoryProxy.h"
#include "COM_SocketReader.h"
+
#include "OCL_opencl.h"
-#include "list"
-#include "BLI_threads.h"
-#include "BLI_math_color.h"
-#include "BLI_math_vector.h"
+using std::list;
+using std::min;
+using std::max;
+class OpenCLDevice;
class ReadBufferOperation;
+class WriteBufferOperation;
+
+class NodeOperationInput;
+class NodeOperationOutput;
+
+/**
+ * @brief Resize modes of inputsockets
+ * How are the input and working resolutions matched
+ * @ingroup Model
+ */
+typedef enum InputResizeMode {
+ /** @brief Center the input image to the center of the working area of the node, no resizing occurs */
+ COM_SC_CENTER = NS_CR_CENTER,
+ /** @brief The bottom left of the input image is the bottom left of the working area of the node, no resizing occurs */
+ COM_SC_NO_RESIZE = NS_CR_NONE,
+ /** @brief Fit the width of the input image to the width of the working area of the node */
+ COM_SC_FIT_WIDTH = NS_CR_FIT_WIDTH,
+ /** @brief Fit the height of the input image to the height of the working area of the node */
+ COM_SC_FIT_HEIGHT = NS_CR_FIT_HEIGHT,
+ /** @brief Fit the width or the height of the input image to the width or height of the working area of the node, image will be larger than the working area */
+ COM_SC_FIT = NS_CR_FIT,
+ /** @brief Fit the width and the height of the input image to the width and height of the working area of the node, image will be equally larger than the working area */
+ COM_SC_STRETCH = NS_CR_STRETCH
+} InputResizeMode;
/**
- * @brief NodeOperation are contains calculation logic
+ * @brief NodeOperation contains calculation logic
*
* Subclasses needs to implement the execution method (defined in SocketReader) to implement logic.
* @ingroup Model
*/
-class NodeOperation : public NodeBase, public SocketReader {
+class NodeOperation : public SocketReader {
+public:
+ typedef std::vector<NodeOperationInput*> Inputs;
+ typedef std::vector<NodeOperationOutput*> Outputs;
+
private:
+ Inputs m_inputs;
+ Outputs m_outputs;
+
/**
* @brief the index of the input socket that will be used to determine the resolution
*/
@@ -85,15 +125,21 @@ private:
* @brief set to truth when resolution for this operation is set
*/
bool m_isResolutionSet;
+
public:
- /**
- * @brief is this node an operation?
- * This is true when the instance is of the subclass NodeOperation.
- * @return [true:false]
- * @see NodeBase
+ virtual ~NodeOperation();
+
+ unsigned int getNumberOfInputSockets() const { return m_inputs.size(); }
+ unsigned int getNumberOfOutputSockets() const { return m_outputs.size(); }
+ NodeOperationOutput *getOutputSocket(unsigned int index) const;
+ NodeOperationOutput *getOutputSocket() const { return getOutputSocket(0); }
+ NodeOperationInput *getInputSocket(unsigned int index) const;
+
+ /** Check if this is an input operation
+ * An input operation is an operation that only has output sockets and no input sockets
*/
- const bool isOperation() const { return true; }
-
+ bool isInputOperation() const { return m_inputs.empty(); }
+
/**
* @brief determine the resolution of this node
* @note this method will not set the resolution, this is the responsibility of the caller
@@ -117,15 +163,6 @@ public:
*/
virtual bool isOutputOperation(bool rendering) const { return false; }
- /**
- * isBufferOperation returns if this is an operation that work directly on buffers.
- *
- * there are only 2 implementation where this is true:
- * @see ReadBufferOperation
- * @see WriteBufferOperation
- * for all other operations this will result in false.
- */
- virtual int isBufferOperation() { return false; }
virtual int isSingleThreaded() { return false; }
void setbNodeTree(const bNodeTree *tree) { this->m_btree = tree; }
@@ -190,7 +227,7 @@ public:
}
- void getConnectedInputSockets(vector<InputSocket *> *sockets);
+ void getConnectedInputSockets(Inputs *sockets);
/**
* @brief is this operation complex
@@ -244,13 +281,14 @@ public:
* @see WorkScheduler.schedule
* @see ExecutionGroup.addOperation
*/
- bool isOpenCL() { return this->m_openCL; }
+ bool isOpenCL() const { return this->m_openCL; }
- virtual bool isViewerOperation() { return false; }
- virtual bool isPreviewOperation() { return false; }
- virtual bool isFileOutputOperation() { return false; }
+ virtual bool isViewerOperation() const { return false; }
+ virtual bool isPreviewOperation() const { return false; }
+ virtual bool isFileOutputOperation() const { return false; }
+ virtual bool isProxyOperation() const { return false; }
- inline bool isBreaked() {
+ inline bool isBreaked() const {
return this->m_btree->test_break(this->m_btree->tbh);
}
@@ -261,6 +299,9 @@ public:
protected:
NodeOperation();
+ void addInputSocket(DataType datatype, InputResizeMode resize_mode = COM_SC_CENTER);
+ void addOutputSocket(DataType datatype);
+
void setWidth(unsigned int width) { this->m_width = width; this->m_isResolutionSet = true; }
void setHeight(unsigned int height) { this->m_height = height; this->m_isResolutionSet = true; }
SocketReader *getInputSocketReader(unsigned int inputSocketindex);
@@ -271,7 +312,6 @@ protected:
void lockMutex();
void unlockMutex();
-
/**
* @brief set whether this operation is complex
*
@@ -285,6 +325,75 @@ protected:
*/
void setOpenCL(bool openCL) { this->m_openCL = openCL; }
+ /* allow the DebugInfo class to look at internals */
+ friend class DebugInfo;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation")
+#endif
+};
+
+
+class NodeOperationInput {
+private:
+ NodeOperation *m_operation;
+
+ /** Datatype of this socket. Is used for automatically data transformation.
+ * @section data-conversion
+ */
+ DataType m_datatype;
+
+ /** Resize mode of this socket */
+ InputResizeMode m_resizeMode;
+
+ /** Connected output */
+ NodeOperationOutput *m_link;
+
+public:
+ NodeOperationInput(NodeOperation *op, DataType datatype, InputResizeMode resizeMode = COM_SC_CENTER);
+
+ NodeOperation &getOperation() const { return *m_operation; }
+ DataType getDataType() const { return m_datatype; }
+
+ void setLink(NodeOperationOutput *link) { m_link = link; }
+ NodeOperationOutput *getLink() const { return m_link; }
+ bool isConnected() const { return m_link; }
+
+ void setResizeMode(InputResizeMode resizeMode) { this->m_resizeMode = resizeMode; }
+ InputResizeMode getResizeMode() const { return this->m_resizeMode; }
+
+ SocketReader *getReader();
+
+ void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation")
+#endif
+};
+
+
+class NodeOperationOutput {
+private:
+ NodeOperation *m_operation;
+
+ /** Datatype of this socket. Is used for automatically data transformation.
+ * @section data-conversion
+ */
+ DataType m_datatype;
+
+public:
+ NodeOperationOutput(NodeOperation *op, DataType datatype);
+
+ NodeOperation &getOperation() const { return *m_operation; }
+ DataType getDataType() const { return m_datatype; }
+
+ /**
+ * @brief determine the resolution of this data going through this socket
+ * @param resolution the result of this operation
+ * @param preferredResolution the preferable resolution as no resolution could be determined
+ */
+ void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation")
#endif
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
new file mode 100644
index 00000000000..2807c25d7f5
--- /dev/null
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
@@ -0,0 +1,661 @@
+/*
+ * Copyright 2013, 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:
+ * Lukas Toenne
+ */
+
+extern "C" {
+#include "BLI_utildefines.h"
+}
+
+#include "COM_NodeConverter.h"
+#include "COM_Converter.h"
+#include "COM_Debug.h"
+#include "COM_ExecutionSystem.h"
+#include "COM_Node.h"
+#include "COM_SocketProxyNode.h"
+
+#include "COM_NodeOperation.h"
+#include "COM_PreviewOperation.h"
+#include "COM_SetValueOperation.h"
+#include "COM_SetVectorOperation.h"
+#include "COM_SetColorOperation.h"
+#include "COM_SocketProxyOperation.h"
+#include "COM_ReadBufferOperation.h"
+#include "COM_WriteBufferOperation.h"
+
+#include "COM_NodeOperationBuilder.h" /* own include */
+
+NodeOperationBuilder::NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree) :
+ m_context(context),
+ m_current_node(NULL)
+{
+ m_graph.from_bNodeTree(*context, b_nodetree);
+}
+
+NodeOperationBuilder::~NodeOperationBuilder()
+{
+}
+
+void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
+{
+ /* interface handle for nodes */
+ NodeConverter converter(this);
+
+ for (int index = 0; index < m_graph.nodes().size(); index++) {
+ Node *node = (Node *)m_graph.nodes()[index];
+
+ m_current_node = node;
+
+ DebugInfo::node_to_operations(node);
+ node->convertToOperations(converter, *m_context);
+ }
+
+ m_current_node = NULL;
+
+ /* The input map constructed by nodes maps operation inputs to node inputs.
+ * Inverting yields a map of node inputs to all connected operation inputs,
+ * so multiple operations can use the same node input.
+ */
+ OpInputInverseMap inverse_input_map;
+ for (InputSocketMap::const_iterator it = m_input_map.begin(); it != m_input_map.end(); ++it)
+ inverse_input_map[it->second].push_back(it->first);
+
+ for (NodeGraph::Links::const_iterator it = m_graph.links().begin(); it != m_graph.links().end(); ++it) {
+ const NodeGraph::Link &link = *it;
+ NodeOutput *from = link.getFromSocket();
+ NodeInput *to = link.getToSocket();
+
+ NodeOperationOutput *op_from = find_operation_output(m_output_map, from);
+ const OpInputs &op_to_list = find_operation_inputs(inverse_input_map, to);
+ if (!op_from || op_to_list.empty()) {
+ /* XXX allow this? error/debug message? */
+ BLI_assert(false);
+ continue;
+ }
+
+ for (OpInputs::const_iterator it = op_to_list.begin(); it != op_to_list.end(); ++it) {
+ NodeOperationInput *op_to = *it;
+ addLink(op_from, op_to);
+ }
+ }
+
+ add_datatype_conversions();
+
+ add_operation_input_constants();
+
+ resolve_proxies();
+
+ determineResolutions();
+
+ /* surround complex ops with read/write buffer */
+ add_complex_operation_buffers();
+
+ /* links not available from here on */
+ /* XXX make m_links a local variable to avoid confusion! */
+ m_links.clear();
+
+ prune_operations();
+
+ /* ensure topological (link-based) order of nodes */
+ /*sort_operations();*/ /* not needed yet */
+
+ /* create execution groups */
+ group_operations();
+
+ /* transfer resulting operations to the system */
+ system->set_operations(m_operations, m_groups);
+}
+
+void NodeOperationBuilder::addOperation(NodeOperation *operation)
+{
+ m_operations.push_back(operation);
+}
+
+void NodeOperationBuilder::mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket)
+{
+ BLI_assert(m_current_node);
+ BLI_assert(node_socket->getNode() == m_current_node);
+
+ /* note: this maps operation sockets to node sockets.
+ * for resolving links the map will be inverted first in convertToOperations,
+ * to get a list of links for each node input socket.
+ */
+ m_input_map[operation_socket] = node_socket;
+}
+
+void NodeOperationBuilder::mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
+{
+ BLI_assert(m_current_node);
+ BLI_assert(node_socket->getNode() == m_current_node);
+
+ m_output_map[node_socket] = operation_socket;
+}
+
+void NodeOperationBuilder::addLink(NodeOperationOutput *from, NodeOperationInput *to)
+{
+ if (to->isConnected())
+ return;
+
+ m_links.push_back(Link(from, to));
+
+ /* register with the input */
+ to->setLink(from);
+}
+
+void NodeOperationBuilder::removeInputLink(NodeOperationInput *to)
+{
+ for (Links::iterator it = m_links.begin(); it != m_links.end(); ++it) {
+ Link &link = *it;
+ if (link.to() == to) {
+ /* unregister with the input */
+ to->setLink(NULL);
+
+ m_links.erase(it);
+ return;
+ }
+ }
+}
+
+NodeInput *NodeOperationBuilder::find_node_input(const InputSocketMap &map, NodeOperationInput *op_input)
+{
+ InputSocketMap::const_iterator it = map.find(op_input);
+ return (it != map.end() ? it->second : NULL);
+}
+
+const NodeOperationBuilder::OpInputs &NodeOperationBuilder::find_operation_inputs(const OpInputInverseMap &map, NodeInput *node_input)
+{
+ static const OpInputs empty_list;
+ OpInputInverseMap::const_iterator it = map.find(node_input);
+ return (it != map.end() ? it->second : empty_list);
+}
+
+NodeOperationOutput *NodeOperationBuilder::find_operation_output(const OutputSocketMap &map, NodeOutput *node_output)
+{
+ OutputSocketMap::const_iterator it = map.find(node_output);
+ return (it != map.end() ? it->second : NULL);
+}
+
+PreviewOperation *NodeOperationBuilder::make_preview_operation() const
+{
+ BLI_assert(m_current_node);
+
+ if (!(m_current_node->getbNode()->flag & NODE_PREVIEW))
+ return NULL;
+ /* previews only in the active group */
+ if (!m_current_node->isInActiveGroup())
+ return NULL;
+ /* do not calculate previews of hidden nodes */
+ if (m_current_node->getbNode()->flag & NODE_HIDDEN)
+ return NULL;
+
+ bNodeInstanceHash *previews = m_context->getPreviewHash();
+ if (previews) {
+ PreviewOperation *operation = new PreviewOperation(m_context->getViewSettings(), m_context->getDisplaySettings());
+ operation->setbNodeTree(m_context->getbNodeTree());
+ operation->verifyPreview(previews, m_current_node->getInstanceKey());
+ return operation;
+ }
+
+ return NULL;
+}
+
+void NodeOperationBuilder::addPreview(NodeOperationOutput *output)
+{
+ PreviewOperation *operation = make_preview_operation();
+ if (operation) {
+ addOperation(operation);
+
+ addLink(output, operation->getInputSocket(0));
+ }
+}
+
+void NodeOperationBuilder::addNodeInputPreview(NodeInput *input)
+{
+ PreviewOperation *operation = make_preview_operation();
+ if (operation) {
+ addOperation(operation);
+
+ mapInputSocket(input, operation->getInputSocket(0));
+ }
+}
+
+/****************************
+ **** Optimization Steps ****
+ ****************************/
+
+void NodeOperationBuilder::add_datatype_conversions()
+{
+ Links convert_links;
+ for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) {
+ const Link &link = *it;
+ if (link.from()->getDataType() != link.to()->getDataType())
+ convert_links.push_back(link);
+ }
+ for (Links::const_iterator it = convert_links.begin(); it != convert_links.end(); ++it) {
+ const Link &link = *it;
+ NodeOperation *converter = Converter::convertDataType(link.from(), link.to());
+ if (converter) {
+ addOperation(converter);
+
+ removeInputLink(link.to());
+ addLink(link.from(), converter->getInputSocket(0));
+ addLink(converter->getOutputSocket(0), link.to());
+ }
+ }
+}
+
+void NodeOperationBuilder::add_operation_input_constants()
+{
+ /* Note: unconnected inputs cached first to avoid modifying
+ * m_operations while iterating over it
+ */
+ typedef std::vector<NodeOperationInput*> Inputs;
+ Inputs pending_inputs;
+ for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
+ NodeOperation *op = *it;
+ for (int k = 0; k < op->getNumberOfInputSockets(); ++k) {
+ NodeOperationInput *input = op->getInputSocket(k);
+ if (!input->isConnected())
+ pending_inputs.push_back(input);
+ }
+ }
+ for (Inputs::const_iterator it = pending_inputs.begin(); it != pending_inputs.end(); ++it) {
+ NodeOperationInput *input = *it;
+ add_input_constant_value(input, find_node_input(m_input_map, input));
+ }
+}
+
+void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input, NodeInput *node_input)
+{
+ switch (input->getDataType()) {
+ case COM_DT_VALUE: {
+ float value;
+ if (node_input && node_input->getbNodeSocket())
+ value = node_input->getEditorValueFloat();
+ else
+ value = 0.0f;
+
+ SetValueOperation *op = new SetValueOperation();
+ op->setValue(value);
+ addOperation(op);
+ addLink(op->getOutputSocket(), input);
+ break;
+ }
+ case COM_DT_COLOR: {
+ float value[4];
+ if (node_input && node_input->getbNodeSocket())
+ node_input->getEditorValueColor(value);
+ else
+ zero_v4(value);
+
+ SetColorOperation *op = new SetColorOperation();
+ op->setChannels(value);
+ addOperation(op);
+ addLink(op->getOutputSocket(), input);
+ break;
+ }
+ case COM_DT_VECTOR: {
+ float value[3];
+ if (node_input && node_input->getbNodeSocket())
+ node_input->getEditorValueVector(value);
+ else
+ zero_v3(value);
+
+ SetVectorOperation *op = new SetVectorOperation();
+ op->setVector(value);
+ addOperation(op);
+ addLink(op->getOutputSocket(), input);
+ break;
+ }
+ }
+}
+
+void NodeOperationBuilder::resolve_proxies()
+{
+ Links proxy_links;
+ for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) {
+ const Link &link = *it;
+ /* don't replace links from proxy to proxy, since we may need them for replacing others! */
+ if (link.from()->getOperation().isProxyOperation() &&
+ !link.to()->getOperation().isProxyOperation()) {
+ proxy_links.push_back(link);
+ }
+ }
+
+ for (Links::const_iterator it = proxy_links.begin(); it != proxy_links.end(); ++it) {
+ const Link &link = *it;
+
+ NodeOperationInput *to = link.to();
+ NodeOperationOutput *from = link.from();
+ do {
+ /* walk upstream bypassing the proxy operation */
+ from = from->getOperation().getInputSocket(0)->getLink();
+ } while (from && from->getOperation().isProxyOperation());
+
+ removeInputLink(to);
+ /* we may not have a final proxy input link,
+ * in that case it just gets dropped
+ */
+ if (from)
+ addLink(from, to);
+ }
+}
+
+void NodeOperationBuilder::determineResolutions()
+{
+ /* determine all resolutions of the operations (Width/Height) */
+ for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
+ NodeOperation *op = *it;
+
+ if (op->isOutputOperation(m_context->isRendering()) && !op->isPreviewOperation()) {
+ unsigned int resolution[2] = {0, 0};
+ unsigned int preferredResolution[2] = {0, 0};
+ op->determineResolution(resolution, preferredResolution);
+ op->setResolution(resolution);
+ }
+ }
+
+ for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
+ NodeOperation *op = *it;
+
+ if (op->isOutputOperation(m_context->isRendering()) && op->isPreviewOperation()) {
+ unsigned int resolution[2] = {0, 0};
+ unsigned int preferredResolution[2] = {0, 0};
+ op->determineResolution(resolution, preferredResolution);
+ op->setResolution(resolution);
+ }
+ }
+
+ /* add convert resolution operations when needed */
+ {
+ Links convert_links;
+ for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) {
+ const Link &link = *it;
+
+ if (link.to()->getResizeMode() != COM_SC_NO_RESIZE) {
+ NodeOperation &from_op = link.from()->getOperation();
+ NodeOperation &to_op = link.to()->getOperation();
+ if (from_op.getWidth() != to_op.getWidth() || from_op.getHeight() != to_op.getHeight())
+ convert_links.push_back(link);
+ }
+ }
+ for (Links::const_iterator it = convert_links.begin(); it != convert_links.end(); ++it) {
+ const Link &link = *it;
+ Converter::convertResolution(*this, link.from(), link.to());
+ }
+ }
+}
+
+NodeOperationBuilder::OpInputs NodeOperationBuilder::cache_output_links(NodeOperationOutput *output) const
+{
+ OpInputs inputs;
+ for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) {
+ const Link &link = *it;
+ if (link.from() == output)
+ inputs.push_back(link.to());
+ }
+ return inputs;
+}
+
+WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation(NodeOperationOutput *output) const
+{
+ for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) {
+ const Link &link = *it;
+ if (link.from() == output) {
+ NodeOperation &op = link.to()->getOperation();
+ if (op.isWriteBufferOperation())
+ return (WriteBufferOperation *)(&op);
+ }
+ }
+ return NULL;
+}
+
+void NodeOperationBuilder::add_input_buffers(NodeOperation *operation, NodeOperationInput *input)
+{
+ if (!input->isConnected())
+ return;
+
+ NodeOperationOutput *output = input->getLink();
+ if (output->getOperation().isReadBufferOperation()) {
+ /* input is already buffered, no need to add another */
+ return;
+ }
+
+ /* this link will be replaced below */
+ removeInputLink(input);
+
+ /* check of other end already has write operation, otherwise add a new one */
+ WriteBufferOperation *writeoperation = find_attached_write_buffer_operation(output);
+ if (!writeoperation) {
+ writeoperation = new WriteBufferOperation();
+ writeoperation->setbNodeTree(m_context->getbNodeTree());
+ addOperation(writeoperation);
+
+ addLink(output, writeoperation->getInputSocket(0));
+
+ writeoperation->readResolutionFromInputSocket();
+ }
+
+ /* add readbuffer op for the input */
+ ReadBufferOperation *readoperation = new ReadBufferOperation();
+ readoperation->setMemoryProxy(writeoperation->getMemoryProxy());
+ this->addOperation(readoperation);
+
+ addLink(readoperation->getOutputSocket(), input);
+
+ readoperation->readResolutionFromWriteBuffer();
+}
+
+void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, NodeOperationOutput *output)
+{
+ /* cache connected sockets, so we can safely remove links first before replacing them */
+ OpInputs targets = cache_output_links(output);
+ if (targets.empty())
+ return;
+
+ WriteBufferOperation *writeOperation = NULL;
+ for (OpInputs::const_iterator it = targets.begin(); it != targets.end(); ++it) {
+ NodeOperationInput *target = *it;
+
+ /* try to find existing write buffer operation */
+ if (target->getOperation().isWriteBufferOperation()) {
+ BLI_assert(writeOperation == NULL); /* there should only be one write op connected */
+ writeOperation = (WriteBufferOperation *)(&target->getOperation());
+ }
+ else {
+ /* remove all links to other nodes */
+ removeInputLink(target);
+ }
+ }
+
+ /* if no write buffer operation exists yet, create a new one */
+ if (!writeOperation) {
+ writeOperation = new WriteBufferOperation();
+ writeOperation->setbNodeTree(m_context->getbNodeTree());
+ addOperation(writeOperation);
+
+ addLink(output, writeOperation->getInputSocket(0));
+ }
+
+ writeOperation->readResolutionFromInputSocket();
+
+ /* add readbuffer op for every former connected input */
+ for (OpInputs::const_iterator it = targets.begin(); it != targets.end(); ++it) {
+ NodeOperationInput *target = *it;
+ if (&target->getOperation() == writeOperation)
+ continue; /* skip existing write op links */
+
+ ReadBufferOperation *readoperation = new ReadBufferOperation();
+ readoperation->setMemoryProxy(writeOperation->getMemoryProxy());
+ addOperation(readoperation);
+
+ addLink(readoperation->getOutputSocket(), target);
+
+ readoperation->readResolutionFromWriteBuffer();
+ }
+}
+
+void NodeOperationBuilder::add_complex_operation_buffers()
+{
+ /* note: complex ops and get cached here first, since adding operations
+ * will invalidate iterators over the main m_operations
+ */
+ Operations complex_ops;
+ for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it)
+ if ((*it)->isComplex())
+ complex_ops.push_back(*it);
+
+ for (Operations::const_iterator it = complex_ops.begin(); it != complex_ops.end(); ++it) {
+ NodeOperation *op = *it;
+
+ DebugInfo::operation_read_write_buffer(op);
+
+ for (int index = 0; index < op->getNumberOfInputSockets(); index++)
+ add_input_buffers(op, op->getInputSocket(index));
+
+ for (int index = 0; index < op->getNumberOfOutputSockets(); index++)
+ add_output_buffers(op, op->getOutputSocket(index));
+ }
+}
+
+typedef std::set<NodeOperation*> Tags;
+
+static void find_reachable_operations_recursive(Tags &reachable, NodeOperation *op)
+{
+ if (reachable.find(op) != reachable.end())
+ return;
+ reachable.insert(op);
+
+ for (int i = 0; i < op->getNumberOfInputSockets(); ++i) {
+ NodeOperationInput *input = op->getInputSocket(i);
+ if (input->isConnected())
+ find_reachable_operations_recursive(reachable, &input->getLink()->getOperation());
+ }
+
+ /* associated write-buffer operations are executed as well */
+ if (op->isReadBufferOperation()) {
+ ReadBufferOperation *read_op = (ReadBufferOperation *)op;
+ MemoryProxy *memproxy = read_op->getMemoryProxy();
+ find_reachable_operations_recursive(reachable, memproxy->getWriteBufferOperation());
+ }
+}
+
+void NodeOperationBuilder::prune_operations()
+{
+ Tags reachable;
+ for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
+ NodeOperation *op = *it;
+
+ /* output operations are primary executed operations */
+ if (op->isOutputOperation(m_context->isRendering()))
+ find_reachable_operations_recursive(reachable, op);
+ }
+
+ /* delete unreachable operations */
+ Operations reachable_ops;
+ for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
+ NodeOperation *op = *it;
+
+ if (reachable.find(op) != reachable.end())
+ reachable_ops.push_back(op);
+ else
+ delete op;
+ }
+ /* finally replace the operations list with the pruned list */
+ m_operations = reachable_ops;
+}
+
+/* topological (depth-first) sorting of operations */
+static void sort_operations_recursive(NodeOperationBuilder::Operations &sorted, Tags &visited, NodeOperation *op)
+{
+ if (visited.find(op) != visited.end())
+ return;
+ visited.insert(op);
+
+ for (int i = 0; i < op->getNumberOfInputSockets(); ++i) {
+ NodeOperationInput *input = op->getInputSocket(i);
+ if (input->isConnected())
+ sort_operations_recursive(sorted, visited, &input->getLink()->getOperation());
+ }
+
+ sorted.push_back(op);
+}
+
+void NodeOperationBuilder::sort_operations()
+{
+ Operations sorted;
+ sorted.reserve(m_operations.size());
+ Tags visited;
+
+ for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it)
+ sort_operations_recursive(sorted, visited, *it);
+
+ m_operations = sorted;
+}
+
+static void add_group_operations_recursive(Tags &visited, NodeOperation *op, ExecutionGroup *group)
+{
+ if (visited.find(op) != visited.end())
+ return;
+ visited.insert(op);
+
+ if (!group->addOperation(op))
+ return;
+
+ /* add all eligible input ops to the group */
+ for (int i = 0; i < op->getNumberOfInputSockets(); ++i) {
+ NodeOperationInput *input = op->getInputSocket(i);
+ if (input->isConnected())
+ add_group_operations_recursive(visited, &input->getLink()->getOperation(), group);
+ }
+}
+
+ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op)
+{
+ ExecutionGroup *group = new ExecutionGroup();
+ m_groups.push_back(group);
+
+ Tags visited;
+ add_group_operations_recursive(visited, op, group);
+
+ return group;
+}
+
+void NodeOperationBuilder::group_operations()
+{
+ for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
+ NodeOperation *op = *it;
+
+ if (op->isOutputOperation(m_context->isRendering())) {
+ ExecutionGroup *group = make_group(op);
+ group->setOutputExecutionGroup(true);
+ }
+
+ /* add new groups for associated memory proxies where needed */
+ if (op->isReadBufferOperation()) {
+ ReadBufferOperation *read_op = (ReadBufferOperation *)op;
+ MemoryProxy *memproxy = read_op->getMemoryProxy();
+
+ if (memproxy->getExecutor() == NULL) {
+ ExecutionGroup *group = make_group(memproxy->getWriteBufferOperation());
+ memproxy->setExecutor(group);
+ }
+ }
+ }
+}
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.h b/source/blender/compositor/intern/COM_NodeOperationBuilder.h
new file mode 100644
index 00000000000..ab890282bab
--- /dev/null
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.h
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2013, 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:
+ * Lukas Toenne
+ */
+
+#ifndef _COM_NodeCompilerImpl_h
+#define _COM_NodeCompilerImpl_h
+
+#include <map>
+#include <set>
+#include <vector>
+
+#include "COM_NodeGraph.h"
+
+using std::vector;
+
+class CompositorContext;
+
+class Node;
+class NodeInput;
+class NodeOutput;
+
+class ExecutionSystem;
+class ExecutionGroup;
+class NodeOperation;
+class NodeOperationInput;
+class NodeOperationOutput;
+
+class PreviewOperation;
+class WriteBufferOperation;
+
+class NodeOperationBuilder {
+public:
+ class Link {
+ private:
+ NodeOperationOutput *m_from;
+ NodeOperationInput *m_to;
+
+ public:
+ Link(NodeOperationOutput *from, NodeOperationInput *to) :
+ m_from(from),
+ m_to(to)
+ {}
+
+ NodeOperationOutput *from() const { return m_from; }
+ NodeOperationInput *to() const { return m_to; }
+ };
+
+ typedef std::vector<NodeOperation *> Operations;
+ typedef std::vector<Link> Links;
+ typedef std::vector<ExecutionGroup *> Groups;
+
+ typedef std::map<NodeOperationInput *, NodeInput *> InputSocketMap;
+ typedef std::map<NodeOutput *, NodeOperationOutput *> OutputSocketMap;
+
+ typedef std::vector<NodeOperationInput *> OpInputs;
+ typedef std::map<NodeInput *, OpInputs> OpInputInverseMap;
+
+private:
+ const CompositorContext *m_context;
+ NodeGraph m_graph;
+
+ Operations m_operations;
+ Links m_links;
+ Groups m_groups;
+
+ /** Maps operation inputs to node inputs */
+ InputSocketMap m_input_map;
+ /** Maps node outputs to operation outputs */
+ OutputSocketMap m_output_map;
+
+ Node *m_current_node;
+
+public:
+ NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree);
+ ~NodeOperationBuilder();
+
+ const CompositorContext &context() const { return *m_context; }
+
+ void convertToOperations(ExecutionSystem *system);
+
+ void addOperation(NodeOperation *operation);
+
+ /** Map input socket of the current node to an operation socket */
+ void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket);
+ /** Map output socket of the current node to an operation socket */
+ void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
+
+ void addLink(NodeOperationOutput *from, NodeOperationInput *to);
+ void removeInputLink(NodeOperationInput *to);
+
+ /** Add a preview operation for a operation output */
+ void addPreview(NodeOperationOutput *output);
+ /** Add a preview operation for a node input */
+ void addNodeInputPreview(NodeInput *input);
+
+protected:
+ static NodeInput *find_node_input(const InputSocketMap &map, NodeOperationInput *op_input);
+ static const OpInputs &find_operation_inputs(const OpInputInverseMap &map, NodeInput *node_input);
+ static NodeOperationOutput *find_operation_output(const OutputSocketMap &map, NodeOutput *node_output);
+
+ /** Add datatype conversion where needed */
+ void add_datatype_conversions();
+
+ /** Construct a constant value operation for every unconnected input */
+ void add_operation_input_constants();
+ void add_input_constant_value(NodeOperationInput *input, NodeInput *node_input);
+
+ /** Replace proxy operations with direct links */
+ void resolve_proxies();
+
+ /** Calculate resolution for each operation */
+ void determineResolutions();
+
+ /** Helper function to store connected inputs for replacement */
+ OpInputs cache_output_links(NodeOperationOutput *output) const;
+ /** Find a connected write buffer operation to an OpOutput */
+ WriteBufferOperation *find_attached_write_buffer_operation(NodeOperationOutput *output) const;
+ /** Add read/write buffer operations around complex operations */
+ void add_complex_operation_buffers();
+ void add_input_buffers(NodeOperation *operation, NodeOperationInput *input);
+ void add_output_buffers(NodeOperation *operation, NodeOperationOutput *output);
+
+ /** Remove unreachable operations */
+ void prune_operations();
+
+ /** Sort operations by link dependencies */
+ void sort_operations();
+
+ /** Create execution groups */
+ void group_operations();
+ ExecutionGroup *make_group(NodeOperation *op);
+
+private:
+ PreviewOperation *make_preview_operation() const;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeCompilerImpl")
+#endif
+};
+
+#endif /* _COM_NodeCompilerImpl_h */
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
index 30c1fb43999..2cfc10cff29 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
@@ -58,7 +58,7 @@ void OpenCLDevice::execute(WorkPackage *work)
MemoryBuffer **inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber);
MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(chunkNumber, &rect);
- executionGroup->getOutputNodeOperation()->executeOpenCLRegion(this, &rect,
+ executionGroup->getOutputOperation()->executeOpenCLRegion(this, &rect,
chunkNumber, inputBuffers, outputBuffer);
delete outputBuffer;
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h
index 2021cacabcc..50cc6f25f70 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.h
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.h
@@ -30,6 +30,8 @@ class OpenCLDevice;
#include "COM_WorkScheduler.h"
#include "COM_ReadBufferOperation.h"
+using std::list;
+
/**
* @brief device representing an GPU OpenCL device.
* an instance of this class represents a single cl_device
diff --git a/source/blender/compositor/intern/COM_OutputSocket.cpp b/source/blender/compositor/intern/COM_OutputSocket.cpp
deleted file mode 100644
index 50e9b75b072..00000000000
--- a/source/blender/compositor/intern/COM_OutputSocket.cpp
+++ /dev/null
@@ -1,119 +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_Socket.h"
-#include "COM_Node.h"
-#include "COM_SocketConnection.h"
-#include "COM_NodeOperation.h"
-
-OutputSocket::OutputSocket(DataType datatype) : Socket(datatype)
-{
- /* pass */
-}
-
-int OutputSocket::isOutputSocket() const { return true; }
-const int OutputSocket::isConnected() const { return this->m_connections.size() != 0; }
-
-void OutputSocket::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
-{
- NodeBase *node = this->getNode();
- if (node->isOperation()) {
- NodeOperation *operation = (NodeOperation *)node;
- if (operation->isResolutionSet()) {
- resolution[0] = operation->getWidth();
- resolution[1] = operation->getHeight();
- }
- else {
- operation->determineResolution(resolution, preferredResolution);
- operation->setResolution(resolution);
- }
- }
-}
-
-void OutputSocket::addConnection(SocketConnection *connection)
-{
- this->m_connections.push_back(connection);
-}
-
-void OutputSocket::removeConnection(SocketConnection *connection)
-{
- for (vector<SocketConnection *>::iterator it = m_connections.begin(); it != m_connections.end(); ++it) {
- if (*it == connection) {
- m_connections.erase(it);
- return;
- }
- }
-}
-
-void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single)
-{
- if (isConnected()) {
- if (single) {
- SocketConnection *connection = this->m_connections[0];
- connection->setFromSocket(relinkToSocket);
- relinkToSocket->addConnection(connection);
- this->m_connections.erase(this->m_connections.begin());
- }
- else {
- unsigned int index;
- for (index = 0; index < this->m_connections.size(); index++) {
- SocketConnection *connection = this->m_connections[index];
- connection->setFromSocket(relinkToSocket);
- relinkToSocket->addConnection(connection);
- }
- this->m_connections.clear();
- }
- }
-}
-void OutputSocket::removeFirstConnection()
-{
- SocketConnection *connection = this->m_connections[0];
- InputSocket *inputSocket = connection->getToSocket();
- if (inputSocket != NULL) {
- inputSocket->setConnection(NULL);
- }
- this->m_connections.erase(this->m_connections.begin());
-}
-
-void OutputSocket::clearConnections()
-{
- while (this->isConnected()) {
- removeFirstConnection();
- }
-}
-
-WriteBufferOperation *OutputSocket::findAttachedWriteBufferOperation() const
-{
- unsigned int index;
- for (index = 0; index < this->m_connections.size(); index++) {
- SocketConnection *connection = this->m_connections[index];
- NodeBase *node = connection->getToNode();
- if (node->isOperation()) {
- NodeOperation *operation = (NodeOperation *)node;
- if (operation->isWriteBufferOperation()) {
- return (WriteBufferOperation *)operation;
- }
- }
- }
- return NULL;
-}
-
diff --git a/source/blender/compositor/intern/COM_OutputSocket.h b/source/blender/compositor/intern/COM_OutputSocket.h
deleted file mode 100644
index 709005a6de0..00000000000
--- a/source/blender/compositor/intern/COM_OutputSocket.h
+++ /dev/null
@@ -1,84 +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_OutputSocket_h
-#define _COM_OutputSocket_h
-
-#include <vector>
-#include "COM_Socket.h"
-#include "COM_ChannelInfo.h"
-
-using namespace std;
-class SocketConnection;
-class Node;
-class InputSocket;
-class WriteBufferOperation;
-
-//#define COM_ST_INPUT 0
-//#define COM_ST_OUTPUT 1
-
-/**
- * @brief OutputSocket are sockets that can send data/input
- * @ingroup Model
- */
-class OutputSocket : public Socket {
-private:
- vector<SocketConnection *> m_connections;
-
- void removeFirstConnection();
-public:
- OutputSocket(DataType datatype);
- OutputSocket(DataType datatype, int inputSocketDataTypeDeterminatorIndex);
- OutputSocket(OutputSocket *from);
- void addConnection(SocketConnection *connection);
- void removeConnection(SocketConnection *connection);
- SocketConnection *getConnection(unsigned int index) { return this->m_connections[index]; }
- const int isConnected() const;
- int isOutputSocket() const;
-
- /**
- * @brief determine the resolution of this socket
- * @param resolution the result of this operation
- * @param preferredResolution the preferable resolution as no resolution could be determined
- */
- void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
-
- /**
- * @brief determine the actual data type and channel info.
- */
- void relinkConnections(OutputSocket *relinkToSocket) { this->relinkConnections(relinkToSocket, false); }
- void relinkConnections(OutputSocket *relinkToSocket, bool single);
- const int getNumberOfConnections() { return this->m_connections.size(); }
-
- void clearConnections();
-
- /**
- * @brief find a connected write buffer operation to this OutputSocket
- * @return WriteBufferOperation or NULL
- */
- WriteBufferOperation *findAttachedWriteBufferOperation() const;
- ChannelInfo *getChannelInfo(const int channelnumber);
-
-private:
-
-};
-#endif
diff --git a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp
index 7d1184cb356..c300a85bfa3 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp
@@ -20,25 +20,25 @@
* Monique Dewanchand
*/
-#include "COM_SingleThreadedNodeOperation.h"
+#include "COM_SingleThreadedOperation.h"
-SingleThreadedNodeOperation::SingleThreadedNodeOperation() : NodeOperation()
+SingleThreadedOperation::SingleThreadedOperation() : NodeOperation()
{
this->m_cachedInstance = NULL;
setComplex(true);
}
-void SingleThreadedNodeOperation::initExecution()
+void SingleThreadedOperation::initExecution()
{
initMutex();
}
-void SingleThreadedNodeOperation::executePixel(float output[4], int x, int y, void *data)
+void SingleThreadedOperation::executePixel(float output[4], int x, int y, void *data)
{
this->m_cachedInstance->readNoCheck(output, x, y);
}
-void SingleThreadedNodeOperation::deinitExecution()
+void SingleThreadedOperation::deinitExecution()
{
deinitMutex();
if (this->m_cachedInstance) {
@@ -46,7 +46,7 @@ void SingleThreadedNodeOperation::deinitExecution()
this->m_cachedInstance = NULL;
}
}
-void *SingleThreadedNodeOperation::initializeTileData(rcti *rect)
+void *SingleThreadedOperation::initializeTileData(rcti *rect)
{
if (this->m_cachedInstance) return this->m_cachedInstance;
diff --git a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.h b/source/blender/compositor/intern/COM_SingleThreadedOperation.h
index 45325be18a9..a6b2f777cb5 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.h
+++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.h
@@ -20,11 +20,11 @@
* Monique Dewanchand
*/
-#ifndef _COM_SingleThreadedNodeOperation_h
-#define _COM_SingleThreadedNodeOperation_h
+#ifndef _COM_SingleThreadedOperation_h
+#define _COM_SingleThreadedOperation_h
#include "COM_NodeOperation.h"
-class SingleThreadedNodeOperation : public NodeOperation {
+class SingleThreadedOperation : public NodeOperation {
private:
MemoryBuffer *m_cachedInstance;
@@ -34,7 +34,7 @@ protected:
}
public:
- SingleThreadedNodeOperation();
+ SingleThreadedOperation();
/**
* the inner loop of this program
diff --git a/source/blender/compositor/intern/COM_Socket.cpp b/source/blender/compositor/intern/COM_Socket.cpp
deleted file mode 100644
index 3465fa6f56d..00000000000
--- a/source/blender/compositor/intern/COM_Socket.cpp
+++ /dev/null
@@ -1,68 +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_Socket.h"
-#include "COM_Node.h"
-#include "COM_SocketConnection.h"
-
-extern "C" {
-#include "RNA_access.h"
-}
-
-Socket::Socket(DataType datatype)
-{
- this->m_datatype = datatype;
- this->m_editorSocket = NULL;
- this->m_node = NULL;
-}
-
-DataType Socket::getDataType() const
-{
- return this->m_datatype;
-}
-
-int Socket::isInputSocket() const { return false; }
-int Socket::isOutputSocket() const { return false; }
-const int Socket::isConnected() const { return false; }
-void Socket::setNode(NodeBase *node) { this->m_node = node; }
-NodeBase *Socket::getNode() const { return this->m_node; }
-
-float Socket::getEditorValueFloat()
-{
- PointerRNA ptr;
- RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
- return RNA_float_get(&ptr, "default_value");
-}
-
-void Socket::getEditorValueColor(float *value)
-{
- PointerRNA ptr;
- RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
- return RNA_float_get_array(&ptr, "default_value", value);
-}
-
-void Socket::getEditorValueVector(float *value)
-{
- PointerRNA ptr;
- RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr);
- return RNA_float_get_array(&ptr, "default_value", value);
-}
diff --git a/source/blender/compositor/intern/COM_Socket.h b/source/blender/compositor/intern/COM_Socket.h
deleted file mode 100644
index 6532864a4d9..00000000000
--- a/source/blender/compositor/intern/COM_Socket.h
+++ /dev/null
@@ -1,100 +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_Socket_h
-#define _COM_Socket_h
-
-#include <vector>
-#include "BKE_text.h"
-#include <string>
-#include "DNA_node_types.h"
-#include "COM_defines.h"
-
-#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
-#endif
-
-using namespace std;
-class SocketConnection;
-class NodeBase;
-struct PointerRNA;
-
-/**
- * @brief Base class for InputSocket and OutputSocket.
- *
- * A socket are the points on an node where the user can make a connection between.
- * Sockets are always part of a node or an operation.
- *
- * @see InputSocket
- * @see OutputSocket
- * @see SocketConnection - a connection between an InputSocket and an OutputSocket
- * @ingroup Model
- */
-class Socket {
-private:
- /**
- * Reference to the node where this Socket belongs to
- */
- NodeBase *m_node;
-
- /**
- * the datatype of this socket. Is used for automatically data transformation.
- * @section data-conversion
- */
- DataType m_datatype;
-
- bNodeSocket *m_editorSocket;
-
-protected:
- /**
- * @brief Declaration of the virtual destructor
- * @note resolve warning gcc 4.7
- */
- virtual ~Socket() {}
-
-public:
- Socket(DataType datatype);
-
- DataType getDataType() const;
- void setNode(NodeBase *node);
- NodeBase *getNode() const;
-
-
- const virtual int isConnected() const;
- int isInputSocket() const;
- int isOutputSocket() const;
- virtual void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) {}
-
- void setEditorSocket(bNodeSocket *editorSocket) { this->m_editorSocket = editorSocket; }
- bNodeSocket *getbNodeSocket() const { return this->m_editorSocket; }
-
- float getEditorValueFloat();
- void getEditorValueColor(float *value);
- void getEditorValueVector(float *value);
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("COM:Socket")
-#endif
-};
-
-
-#endif
diff --git a/source/blender/compositor/intern/COM_SocketConnection.cpp b/source/blender/compositor/intern/COM_SocketConnection.cpp
deleted file mode 100644
index 1f2cba72dc0..00000000000
--- a/source/blender/compositor/intern/COM_SocketConnection.cpp
+++ /dev/null
@@ -1,95 +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_SocketConnection.h"
-#include "COM_NodeOperation.h"
-
-SocketConnection::SocketConnection()
-{
- this->m_fromSocket = NULL;
- this->m_toSocket = NULL;
- this->setIgnoreResizeCheck(false);
-}
-
-void SocketConnection::setFromSocket(OutputSocket *fromsocket)
-{
- if (fromsocket == NULL) {
- throw "ERROR";
- }
- this->m_fromSocket = fromsocket;
-}
-
-OutputSocket *SocketConnection::getFromSocket() const { return this->m_fromSocket; }
-void SocketConnection::setToSocket(InputSocket *tosocket)
-{
- if (tosocket == NULL) {
- throw "ERROR";
- }
- this->m_toSocket = tosocket;
-}
-
-InputSocket *SocketConnection::getToSocket() const { return this->m_toSocket; }
-
-NodeBase *SocketConnection::getFromNode() const
-{
- if (this->getFromSocket() == NULL) {
- return NULL;
- }
- else {
- return this->getFromSocket()->getNode();
- }
-}
-NodeBase *SocketConnection::getToNode() const
-{
- if (this->getToSocket() == NULL) {
- return NULL;
- }
- else {
- return this->getToSocket()->getNode();
- }
-}
-bool SocketConnection::isValid() const
-{
- if ((this->getToSocket() != NULL && this->getFromSocket() != NULL)) {
- if (this->getFromNode()->isOperation() && this->getToNode()->isOperation()) {
- return true;
- }
- }
- return false;
-}
-
-bool SocketConnection::needsResolutionConversion() const
-{
- if (this->m_ignoreResizeCheck) { return false; }
- NodeOperation *fromOperation = (NodeOperation *)this->getFromNode();
- NodeOperation *toOperation = (NodeOperation *)this->getToNode();
- if (this->m_toSocket->getResizeMode() == COM_SC_NO_RESIZE) { return false; }
- const unsigned int fromWidth = fromOperation->getWidth();
- const unsigned int fromHeight = fromOperation->getHeight();
- const unsigned int toWidth = toOperation->getWidth();
- const unsigned int toHeight = toOperation->getHeight();
-
- if (fromWidth == toWidth && fromHeight == toHeight) {
- return false;
- }
- return true;
-}
diff --git a/source/blender/compositor/intern/COM_SocketConnection.h b/source/blender/compositor/intern/COM_SocketConnection.h
deleted file mode 100644
index 9777bd45be2..00000000000
--- a/source/blender/compositor/intern/COM_SocketConnection.h
+++ /dev/null
@@ -1,127 +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_SocketConnection_h
-#define _COM_SocketConnection_h
-
-#include "DNA_node_types.h"
-#include "COM_Node.h"
-#include "COM_Socket.h"
-#include "COM_ChannelInfo.h"
-
-/**
- * @brief An SocketConnection is an connection between an InputSocket and an OutputSocket.
- *
- * <pre>
- * +----------+ To InputSocket +----------+
- * | From | SocketConnection \| To Node |
- * | Node *====================* |
- * | |\ | |
- * | | From OutputSocket +----------+
- * +----------+
- * </pre>
- * @ingroup Model
- * @see InputSocket
- * @see OutputSocket
- */
-class SocketConnection {
-private:
- /**
- * @brief Startpoint of the connection
- */
- OutputSocket *m_fromSocket;
-
- /**
- * @brief Endpoint of the connection
- */
- InputSocket *m_toSocket;
-
- /**
- * @brief has the resize already been done for this connection
- */
- bool m_ignoreResizeCheck;
-public:
- SocketConnection();
-
- /**
- * @brief set the startpoint of the connection
- * @param fromsocket
- */
- void setFromSocket(OutputSocket *fromsocket);
-
- /**
- * @brief get the startpoint of the connection
- * @return from OutputSocket
- */
- OutputSocket *getFromSocket() const;
-
- /**
- * @brief set the endpoint of the connection
- * @param tosocket
- */
- void setToSocket(InputSocket *tosocket);
-
- /**
- * @brief get the endpoint of the connection
- * @return to InputSocket
- */
- InputSocket *getToSocket() const;
-
- /**
- * @brief check if this connection is valid
- */
- bool isValid() const;
-
- /**
- * @brief return the Node where this connection is connected from
- */
- NodeBase *getFromNode() const;
-
- /**
- * @brief return the Node where this connection is connected to
- */
- NodeBase *getToNode() const;
-
- /**
- * @brief set, whether the resize has already been done for this SocketConnection
- */
- void setIgnoreResizeCheck(bool check) { this->m_ignoreResizeCheck = check; }
-
- /**
- * @brief has the resize already been done for this SocketConnection
- */
- bool isIgnoreResizeCheck() const { return this->m_ignoreResizeCheck; }
-
- /**
- * @brief does this SocketConnection need resolution conversion
- * @note PreviewOperation's will be ignored
- * @note Already converted SocketConnection's will be ignored
- * @return needs conversion [true:false]
- */
- bool needsResolutionConversion() const;
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("COM:SocketConnection")
-#endif
-};
-
-#endif
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index 76a3d92eb6c..4bdc9b731b1 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -81,12 +81,17 @@ static int g_highlightIndex;
static void **g_highlightedNodes;
static void **g_highlightedNodesRead;
+/* XXX highlighting disabled for now
+ * This requires pointers back to DNA data (bNodeTree/bNode) in operations, which is bad!
+ * Instead IF we want to keep this feature it should use a weak reference such as bNodeInstanceKey
+ */
+#if 0
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
#define HIGHLIGHT(wp) \
{ \
ExecutionGroup *group = wp->getExecutionGroup(); \
if (group->isComplex()) { \
- NodeOperation *operation = group->getOutputNodeOperation(); \
+ NodeOperation *operation = group->getOutputOperation(); \
if (operation->isWriteBufferOperation()) { \
WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation; \
NodeOperation *complexOperation = writeOperation->getInput(); \
@@ -105,6 +110,9 @@ static void **g_highlightedNodesRead;
} \
}
#endif /* COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE */
+#else
+#define HIGHLIGHT(wp) {}
+#endif
void COM_startReadHighlights()
{
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
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
index 0f7afe484b1..e7af9319f88 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
@@ -36,30 +36,29 @@ BlurBaseOperation::BlurBaseOperation(DataType data_type) : NodeOperation()
this->addOutputSocket(data_type);
this->setComplex(true);
this->m_inputProgram = NULL;
- this->m_data = NULL;
+ memset(&m_data, 0, sizeof(NodeBlurData));
this->m_size = 1.0f;
- this->m_deleteData = false;
this->m_sizeavailable = false;
}
void BlurBaseOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
this->m_inputSize = this->getInputSocketReader(1);
- this->m_data->image_in_width = this->getWidth();
- this->m_data->image_in_height = this->getHeight();
- if (this->m_data->relative) {
- switch (this->m_data->aspect) {
+ this->m_data.image_in_width = this->getWidth();
+ this->m_data.image_in_height = this->getHeight();
+ if (this->m_data.relative) {
+ switch (this->m_data.aspect) {
case CMP_NODE_BLUR_ASPECT_NONE:
- this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width);
- this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height);
+ this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width);
+ this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height);
break;
case CMP_NODE_BLUR_ASPECT_Y:
- this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width);
- this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_width);
+ this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width);
+ this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_width);
break;
case CMP_NODE_BLUR_ASPECT_X:
- this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_height);
- this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height);
+ this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_height);
+ this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height);
break;
}
}
@@ -80,7 +79,7 @@ float *BlurBaseOperation::make_gausstab(float rad, int size)
sum = 0.0f;
float fac = (rad > 0.0f ? 1.0f / rad : 0.0f);
for (i = -size; i <= size; i++) {
- val = RE_filter_value(this->m_data->filtertype, (float)i * fac);
+ val = RE_filter_value(this->m_data.filtertype, (float)i * fac);
sum += val;
gausstab[i + size] = val;
}
@@ -144,10 +143,11 @@ void BlurBaseOperation::deinitExecution()
{
this->m_inputProgram = NULL;
this->m_inputSize = NULL;
- if (this->m_deleteData) {
- delete this->m_data;
- }
- this->m_data = NULL;
+}
+
+void BlurBaseOperation::setData(const NodeBlurData *data)
+{
+ memcpy(&m_data, data, sizeof(NodeBlurData));
}
void BlurBaseOperation::updateSize()
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h
index c5d89b1bc91..052a525ef2c 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.h
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h
@@ -43,10 +43,9 @@ protected:
*/
SocketReader *m_inputProgram;
SocketReader *m_inputSize;
- NodeBlurData *m_data;
+ NodeBlurData m_data;
float m_size;
- bool m_deleteData;
bool m_sizeavailable;
public:
@@ -60,9 +59,7 @@ public:
*/
void deinitExecution();
- void setData(NodeBlurData *data) { this->m_data = data; }
-
- void deleteDataWhenFinished() { this->m_deleteData = true; }
+ void setData(const NodeBlurData *data);
void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; }
};
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index d4629a8d527..14aba267a23 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -21,7 +21,6 @@
*/
#include "COM_CompositorOperation.h"
-#include "COM_SocketConnection.h"
#include "BLI_listbase.h"
#include "BKE_image.h"
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index ff53ef22e29..9d96ebbb33f 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -45,13 +45,13 @@ void FastGaussianBlurOperation::executePixel(float output[4], int x, int y, void
// the whole image.
bool FastGaussianBlurOperation::getDAI(rcti *rect, rcti *output)
{
- // m_data->sizex * m_size should be enough? For some reason there
+ // m_data.sizex * m_size should be enough? For some reason there
// seem to be errors in the boundary between tiles.
float size = this->m_size * COM_FAST_GAUSSIAN_MULTIPLIER;
- int sx = this->m_data->sizex * size;
+ int sx = this->m_data.sizex * size;
if (sx < 1)
sx = 1;
- int sy = this->m_data->sizey * size;
+ int sy = this->m_data.sizey * size;
if (sy < 1)
sy = 1;
@@ -125,8 +125,8 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect)
updateSize();
int c;
- this->m_sx = this->m_data->sizex * this->m_size / 2.0f;
- this->m_sy = this->m_data->sizey * this->m_size / 2.0f;
+ this->m_sx = this->m_data.sizex * this->m_size / 2.0f;
+ this->m_sy = this->m_data.sizey * this->m_size / 2.0f;
if ((this->m_sx == this->m_sy) && (this->m_sx > 0.f)) {
for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c)
@@ -174,8 +174,8 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect)
tile->copyContentFrom(buffer);
int c;
- float sx = this->m_data->sizex * this->m_size / 2.0f;
- float sy = this->m_data->sizey * this->m_size / 2.0f;
+ float sx = this->m_data.sizex * this->m_size / 2.0f;
+ float sy = this->m_data.sizey * this->m_size / 2.0f;
if ((sx == sy) && (sx > 0.f)) {
for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c)
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
index 4ae0b4e78b2..69aa7d0fee5 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
@@ -54,7 +54,7 @@ void GaussianAlphaXBlurOperation::initExecution()
initMutex();
if (this->m_sizeavailable) {
- float rad = max_ff(m_size * m_data->sizex, 0.0f);
+ float rad = max_ff(m_size * m_data.sizex, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
@@ -66,7 +66,7 @@ void GaussianAlphaXBlurOperation::updateGauss()
{
if (this->m_gausstab == NULL) {
updateSize();
- float rad = max_ff(m_size * m_data->sizex, 0.0f);
+ float rad = max_ff(m_size * m_data.sizex, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
@@ -74,7 +74,7 @@ void GaussianAlphaXBlurOperation::updateGauss()
if (this->m_distbuf_inv == NULL) {
updateSize();
- float rad = max_ff(m_size * m_data->sizex, 0.0f);
+ float rad = max_ff(m_size * m_data.sizex, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff);
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
index fb407bf9ee4..ae1f309c54f 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
@@ -54,7 +54,7 @@ void GaussianAlphaYBlurOperation::initExecution()
initMutex();
if (this->m_sizeavailable) {
- float rad = max_ff(m_size * m_data->sizey, 0.0f);
+ float rad = max_ff(m_size * m_data.sizey, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
@@ -66,7 +66,7 @@ void GaussianAlphaYBlurOperation::updateGauss()
{
if (this->m_gausstab == NULL) {
updateSize();
- float rad = max_ff(m_size * m_data->sizey, 0.0f);
+ float rad = max_ff(m_size * m_data.sizey, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
@@ -74,7 +74,7 @@ void GaussianAlphaYBlurOperation::updateGauss()
if (this->m_distbuf_inv == NULL) {
updateSize();
- float rad = max_ff(m_size * m_data->sizey, 0.0f);
+ float rad = max_ff(m_size * m_data.sizey, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff);
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
index 1d02f5389b1..d5743c41c94 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
@@ -68,11 +68,11 @@ void GaussianBokehBlurOperation::updateGauss()
if (!this->m_sizeavailable) {
updateSize();
}
- radxf = this->m_size * (float)this->m_data->sizex;
+ radxf = this->m_size * (float)this->m_data.sizex;
CLAMP(radxf, 0.0f, width / 2.0f);
/* vertical */
- radyf = this->m_size * (float)this->m_data->sizey;
+ radyf = this->m_size * (float)this->m_data.sizey;
CLAMP(radyf, 0.0f, height / 2.0f);
this->m_radx = ceil(radxf);
@@ -93,7 +93,7 @@ void GaussianBokehBlurOperation::updateGauss()
float fj = (float)j * facy;
float fi = (float)i * facx;
float dist = sqrt(fj * fj + fi * fi);
- *dgauss = RE_filter_value(this->m_data->filtertype, dist);
+ *dgauss = RE_filter_value(this->m_data.filtertype, dist);
sum += *dgauss;
}
@@ -212,28 +212,28 @@ void GaussianBlurReferenceOperation::initExecution()
{
BlurBaseOperation::initExecution();
// setup gaustab
- this->m_data->image_in_width = this->getWidth();
- this->m_data->image_in_height = this->getHeight();
- if (this->m_data->relative) {
- switch (this->m_data->aspect) {
+ this->m_data.image_in_width = this->getWidth();
+ this->m_data.image_in_height = this->getHeight();
+ if (this->m_data.relative) {
+ switch (this->m_data.aspect) {
case CMP_NODE_BLUR_ASPECT_NONE:
- this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width);
- this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height);
+ this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width);
+ this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height);
break;
case CMP_NODE_BLUR_ASPECT_Y:
- this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width);
- this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_width);
+ this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width);
+ this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_width);
break;
case CMP_NODE_BLUR_ASPECT_X:
- this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_height);
- this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height);
+ this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_height);
+ this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height);
break;
}
}
/* horizontal */
- m_filtersizex = (float)this->m_data->sizex;
+ m_filtersizex = (float)this->m_data.sizex;
int imgx = getWidth() / 2;
if (m_filtersizex > imgx)
m_filtersizex = imgx;
@@ -242,7 +242,7 @@ void GaussianBlurReferenceOperation::initExecution()
m_radx = (float)m_filtersizex;
/* vertical */
- m_filtersizey = (float)this->m_data->sizey;
+ m_filtersizey = (float)this->m_data.sizey;
int imgy = getHeight() / 2;
if (m_filtersizey > imgy)
m_filtersizey = imgy;
@@ -342,8 +342,8 @@ bool GaussianBlurReferenceOperation::determineDependingAreaOfInterest(rcti *inpu
return true;
}
else {
- int addx = this->m_data->sizex + 2;
- int addy = this->m_data->sizey + 2;
+ int addx = this->m_data.sizex + 2;
+ int addy = this->m_data.sizey + 2;
newInput.xmax = input->xmax + addx;
newInput.xmin = input->xmin - addx;
newInput.ymax = input->ymax + addy;
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index 127417bf701..815b89ae8d9 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -52,7 +52,7 @@ void GaussianXBlurOperation::initExecution()
initMutex();
if (this->m_sizeavailable) {
- float rad = max_ff(m_size * m_data->sizex, 0.0f);
+ float rad = max_ff(m_size * m_data.sizex, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
@@ -63,7 +63,7 @@ void GaussianXBlurOperation::updateGauss()
{
if (this->m_gausstab == NULL) {
updateSize();
- float rad = max_ff(m_size * m_data->sizex, 0.0f);
+ float rad = max_ff(m_size * m_data.sizex, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index 583305a0fc4..47c031757fb 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -52,7 +52,7 @@ void GaussianYBlurOperation::initExecution()
initMutex();
if (this->m_sizeavailable) {
- float rad = max_ff(m_size * m_data->sizey, 0.0f);
+ float rad = max_ff(m_size * m_data.sizey, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
@@ -63,7 +63,7 @@ void GaussianYBlurOperation::updateGauss()
{
if (this->m_gausstab == NULL) {
updateSize();
- float rad = max_ff(m_size * m_data->sizey, 0.0f);
+ float rad = max_ff(m_size * m_data.sizey, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
index 8bfc3e436df..99c745d7fb0 100644
--- a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_GlareBaseOperation.h"
#include "BLI_math.h"
-GlareBaseOperation::GlareBaseOperation() : SingleThreadedNodeOperation()
+GlareBaseOperation::GlareBaseOperation() : SingleThreadedOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
@@ -31,14 +31,14 @@ GlareBaseOperation::GlareBaseOperation() : SingleThreadedNodeOperation()
}
void GlareBaseOperation::initExecution()
{
- SingleThreadedNodeOperation::initExecution();
+ SingleThreadedOperation::initExecution();
this->m_inputProgram = getInputSocketReader(0);
}
void GlareBaseOperation::deinitExecution()
{
this->m_inputProgram = NULL;
- SingleThreadedNodeOperation::deinitExecution();
+ SingleThreadedOperation::deinitExecution();
}
MemoryBuffer *GlareBaseOperation::createMemoryBuffer(rcti *rect2)
diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h
index f6a8f6879da..3f0893d895f 100644
--- a/source/blender/compositor/operations/COM_GlareBaseOperation.h
+++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h
@@ -23,7 +23,7 @@
#ifndef _COM_GlareBaseOperation_h
#define _COM_GlareBaseOperation_h
-#include "COM_SingleThreadedNodeOperation.h"
+#include "COM_SingleThreadedOperation.h"
#include "DNA_node_types.h"
@@ -36,7 +36,7 @@ typedef float fRGB[4];
#define fRGB_rgbmult(c, r, g, b) { c[0] *= (r); c[1] *= (g); c[2] *= (b); } (void)0
-class GlareBaseOperation : public SingleThreadedNodeOperation {
+class GlareBaseOperation : public SingleThreadedOperation {
private:
/**
* @brief Cached reference to the inputProgram
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index cc7511bb9fc..9da55df476d 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -50,7 +50,7 @@ void MathBaseOperation::deinitExecution()
void MathBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
- InputSocket *socket;
+ NodeOperationInput *socket;
unsigned int tempPreferredResolution[2] = {0, 0};
unsigned int tempResolution[2];
diff --git a/source/blender/compositor/operations/COM_MixOperation.cpp b/source/blender/compositor/operations/COM_MixOperation.cpp
index 125de842892..247880c84e3 100644
--- a/source/blender/compositor/operations/COM_MixOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixOperation.cpp
@@ -71,7 +71,7 @@ void MixBaseOperation::executePixelSampled(float output[4], float x, float y, Pi
void MixBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
- InputSocket *socket;
+ NodeOperationInput *socket;
unsigned int tempPreferredResolution[2] = {0, 0};
unsigned int tempResolution[2];
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
index 75b36d7672a..db2f8445db7 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
@@ -22,7 +22,6 @@
*/
#include "COM_OutputFileOperation.h"
-#include "COM_SocketConnection.h"
#include <string.h>
#include "BLI_listbase.h"
#include "BLI_path_util.h"
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h
index ada40bba014..6bb2e7d7320 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.h
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.h
@@ -57,7 +57,7 @@ public:
void deinitExecution();
const CompositorPriority getRenderPriority() const { return COM_PRIORITY_LOW; }
- bool isFileOutputOperation() { return true; }
+ bool isFileOutputOperation() const { return true; }
};
/* extra info for OpenEXR layers */
@@ -93,7 +93,7 @@ public:
void deinitExecution();
const CompositorPriority getRenderPriority() const { return COM_PRIORITY_LOW; }
- bool isFileOutputOperation() { return true; }
+ bool isFileOutputOperation() const { return true; }
};
#endif
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp
index 85c7f449fd5..69290cd7c3c 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.cpp
+++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp
@@ -21,7 +21,6 @@
*/
#include "COM_PreviewOperation.h"
-#include "COM_SocketConnection.h"
#include "BLI_listbase.h"
#include "BKE_image.h"
#include "WM_api.h"
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h
index bb60dfa0420..3e97acec7bb 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.h
+++ b/source/blender/compositor/operations/COM_PreviewOperation.h
@@ -53,7 +53,7 @@ public:
void executeRegion(rcti *rect, unsigned int tileNumber);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- bool isPreviewOperation() { return true; }
+ bool isPreviewOperation() const { return true; }
};
#endif
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h
index cce519c6eb3..569920d51ef 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.h
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h
@@ -34,7 +34,6 @@ private:
MemoryBuffer *m_buffer;
public:
ReadBufferOperation();
- int isBufferOperation() { return true; }
void setMemoryProxy(MemoryProxy *memoryProxy) { this->m_memoryProxy = memoryProxy; }
MemoryProxy *getMemoryProxy() { return this->m_memoryProxy; }
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h
index 6fd1b9768fc..d29ca726056 100644
--- a/source/blender/compositor/operations/COM_SetVectorOperation.h
+++ b/source/blender/compositor/operations/COM_SetVectorOperation.h
@@ -59,7 +59,7 @@ public:
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
bool isSetOperation() const { return true; }
- void setVector(float vector[3]) {
+ void setVector(const float vector[3]) {
setX(vector[0]);
setY(vector[1]);
setZ(vector[2]);
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
index d047198ac93..da345b282fd 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
@@ -26,22 +26,4 @@ SocketProxyOperation::SocketProxyOperation(DataType type) : NodeOperation()
{
this->addInputSocket(type);
this->addOutputSocket(type);
- this->m_inputOperation = NULL;
-}
-
-void SocketProxyOperation::initExecution()
-{
- this->m_inputOperation = this->getInputSocketReader(0);
-}
-
-void SocketProxyOperation::deinitExecution()
-{
- this->m_inputOperation = NULL;
-}
-
-void SocketProxyOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
-{
- if (this->m_inputOperation) {
- this->m_inputOperation->readSampled(output, x, y, sampler);
- }
}
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h b/source/blender/compositor/operations/COM_SocketProxyOperation.h
index 6a6a0b351b0..9733a1fbeec 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.h
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h
@@ -26,14 +26,10 @@
#include "COM_NodeOperation.h"
class SocketProxyOperation : public NodeOperation {
-private:
- SocketReader *m_inputOperation;
public:
SocketProxyOperation(DataType type);
- void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
- void initExecution();
- void deinitExecution();
+ bool isProxyOperation() const { return true; }
};
#endif
diff --git a/source/blender/compositor/operations/COM_SplitOperation.cpp b/source/blender/compositor/operations/COM_SplitOperation.cpp
index 9278f1c3ec4..367c7eefa25 100644
--- a/source/blender/compositor/operations/COM_SplitOperation.cpp
+++ b/source/blender/compositor/operations/COM_SplitOperation.cpp
@@ -21,7 +21,6 @@
*/
#include "COM_SplitOperation.h"
-#include "COM_SocketConnection.h"
#include "BLI_listbase.h"
#include "BKE_image.h"
#include "BLI_utildefines.h"
diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp
index 96aea56050f..ede767cbff7 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.cpp
+++ b/source/blender/compositor/operations/COM_TextureOperation.cpp
@@ -25,7 +25,7 @@
#include "BLI_listbase.h"
#include "BKE_image.h"
-TextureBaseOperation::TextureBaseOperation() : SingleThreadedNodeOperation()
+TextureBaseOperation::TextureBaseOperation() : SingleThreadedOperation()
{
this->addInputSocket(COM_DT_VECTOR); //offset
this->addInputSocket(COM_DT_VECTOR); //size
@@ -50,7 +50,7 @@ void TextureBaseOperation::initExecution()
this->m_inputOffset = getInputSocketReader(0);
this->m_inputSize = getInputSocketReader(1);
this->m_pool = BKE_image_pool_new();
- SingleThreadedNodeOperation::initExecution();
+ SingleThreadedOperation::initExecution();
}
void TextureBaseOperation::deinitExecution()
{
@@ -58,7 +58,7 @@ void TextureBaseOperation::deinitExecution()
this->m_inputOffset = NULL;
BKE_image_pool_free(this->m_pool);
this->m_pool = NULL;
- SingleThreadedNodeOperation::deinitExecution();
+ SingleThreadedOperation::deinitExecution();
}
void TextureBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h
index 114cee00530..47ef40882c5 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.h
+++ b/source/blender/compositor/operations/COM_TextureOperation.h
@@ -24,7 +24,7 @@
#ifndef _COM_TextureOperation_h
#define _COM_TextureOperation_h
-#include "COM_SingleThreadedNodeOperation.h"
+#include "COM_SingleThreadedOperation.h"
#include "DNA_texture_types.h"
#include "BLI_listbase.h"
extern "C" {
@@ -39,7 +39,7 @@ extern "C" {
*
* @todo: rename to operation.
*/
-class TextureBaseOperation : public SingleThreadedNodeOperation {
+class TextureBaseOperation : public SingleThreadedOperation {
private:
Tex *m_texture;
const RenderData *m_rd;
diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cpp b/source/blender/compositor/operations/COM_TonemapOperation.cpp
index 2d944b70f75..e8a578fa131 100644
--- a/source/blender/compositor/operations/COM_TonemapOperation.cpp
+++ b/source/blender/compositor/operations/COM_TonemapOperation.cpp
@@ -24,8 +24,6 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-
-
TonemapOperation::TonemapOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index c54a4971e54..6579eb268a6 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -21,7 +21,6 @@
*/
#include "COM_ViewerOperation.h"
-#include "COM_SocketConnection.h"
#include "BLI_listbase.h"
#include "BKE_image.h"
#include "WM_api.h"
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h
index 0b8d08d3974..34954382b82 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerOperation.h
@@ -65,7 +65,7 @@ public:
float getCenterY() const { return this->m_centerY; }
OrderOfChunks getChunkOrder() const { return this->m_chunkOrder; }
const CompositorPriority getRenderPriority() const;
- bool isViewerOperation() { return true; }
+ bool isViewerOperation() const { return true; }
void setIgnoreAlpha(bool value) { this->m_ignoreAlpha = value; }
void setViewSettings(const ColorManagedViewSettings *viewSettings) { this->m_viewSettings = viewSettings; }
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h
index 1f1f58b18f1..96466df979c 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.h
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h
@@ -27,7 +27,7 @@
#include "COM_MemoryProxy.h"
#include "COM_SocketReader.h"
/**
- * @brief Operation to write to a tile
+ * @brief NodeOperation to write to a tile
* @ingroup Operation
*/
class WriteBufferOperation : public NodeOperation {
@@ -37,7 +37,6 @@ class WriteBufferOperation : public NodeOperation {
public:
WriteBufferOperation();
~WriteBufferOperation();
- int isBufferOperation() { return true; }
MemoryProxy *getMemoryProxy() { return this->m_memoryProxy; }
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
const bool isWriteBufferOperation() const { return true; }
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 967ec8d8d06..e13d53934cb 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -112,7 +112,8 @@ typedef struct bNodeSocket {
short stack_index; /* local stack index */
/* XXX deprecated, kept for forward compatibility */
short stack_type DNA_DEPRECATED;
- int resizemode; /* compositor resize mode of the socket */
+ int pad;
+
void *cache; /* cached data from execution */
/* internal data to retrieve relations and groups