diff options
-rw-r--r-- | source/blender/compositor/nodes/COM_GroupNode.cpp | 4 | ||||
-rw-r--r-- | source/blender/compositor/nodes/COM_SocketProxyNode.cpp | 22 | ||||
-rw-r--r-- | source/blender/compositor/nodes/COM_SocketProxyNode.h | 4 |
3 files changed, 23 insertions, 7 deletions
diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp index e10d7dbad2e..32190010aa6 100644 --- a/source/blender/compositor/nodes/COM_GroupNode.cpp +++ b/source/blender/compositor/nodes/COM_GroupNode.cpp @@ -58,7 +58,7 @@ void GroupNode::ungroup(ExecutionSystem &system) InputSocket *inputSocket = inputsockets[index]; bNodeSocket *editorInput = inputSocket->getbNodeSocket(); if (editorInput->groupsock) { - SocketProxyNode *proxy = new SocketProxyNode(bnode, editorInput, editorInput->groupsock); + SocketProxyNode *proxy = new SocketProxyNode(bnode, editorInput, editorInput->groupsock, false); inputSocket->relinkConnections(proxy->getInputSocket(0), index, &system); ExecutionSystemHelper::addNode(system.getNodes(), proxy); } @@ -68,7 +68,7 @@ void GroupNode::ungroup(ExecutionSystem &system) OutputSocket *outputSocket = outputsockets[index]; bNodeSocket *editorOutput = outputSocket->getbNodeSocket(); if (editorOutput->groupsock) { - SocketProxyNode *proxy = new SocketProxyNode(bnode, editorOutput->groupsock, editorOutput); + SocketProxyNode *proxy = new SocketProxyNode(bnode, editorOutput->groupsock, editorOutput, true); outputSocket->relinkConnections(proxy->getOutputSocket(0)); ExecutionSystemHelper::addNode(system.getNodes(), proxy); } diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp index bfb32a96156..e6026675d20 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp @@ -27,11 +27,14 @@ #include "COM_SetValueOperation.h" #include "COM_SetVectorOperation.h" #include "COM_SetColorOperation.h" +#include "COM_WriteBufferOperation.h" +#include "COM_ReadBufferOperation.h" -SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput) : Node(editorNode, false) +SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool buffer) : 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; @@ -49,11 +52,22 @@ void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorCont InputSocket *inputsocket = this->getInputSocket(0); if (outputsocket->isConnected()) { if (inputsocket->isConnected()) { - SocketProxyOperation *operation = new SocketProxyOperation(this->getOutputSocket()->getDataType()); + 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 input is not connected, add a constant value operation instead */ switch (outputsocket->getDataType()) { diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.h b/source/blender/compositor/nodes/COM_SocketProxyNode.h index ea50be418e2..a83ac094b2b 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.h +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h @@ -30,8 +30,10 @@ * @ingroup Node */ class SocketProxyNode : public Node { +private: + bool m_buffer; public: - SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput); + SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool buffer); void convertToOperations(ExecutionSystem *graph, CompositorContext *context); virtual bool isProxyNode() const { return true; } |