diff options
author | Monique Dewanchand <m.dewanchand@atmind.nl> | 2013-02-03 21:22:26 +0400 |
---|---|---|
committer | Monique Dewanchand <m.dewanchand@atmind.nl> | 2013-02-03 21:22:26 +0400 |
commit | 2950214527812503b009995c638d2be37efaa22f (patch) | |
tree | fb56d981200952a73f1ffa24e8ad09380e84d398 /source/blender/compositor | |
parent | b58b107db409c877b523f90ff8feb5c4db7688a8 (diff) |
One fix for bug [#33785] compositor is (unnecessarily?) slow
Added additional buffers - new subtree - for groupnodes.
One needs to be aware of how groupnodes should be created.
Having translate & scale nodes, with the translate inside the groupnode and the scale node outside, causes artefacts.
Both should be inside or outside the groupnode. Same holds for other distort nodes.
Diffstat (limited to 'source/blender/compositor')
-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; } |