[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54281] trunk/blender/source/blender/ compositor/nodes: One fix for bug [#33785] compositor is (unnecessarily?) slow

Monique Dewanchand m.dewanchand at atmind.nl
Sun Feb 3 18:22:26 CET 2013


Revision: 54281
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54281
Author:   mdewanchand
Date:     2013-02-03 17:22:26 +0000 (Sun, 03 Feb 2013)
Log Message:
-----------
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. 
  

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.h

Modified: trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp	2013-02-03 17:01:21 UTC (rev 54280)
+++ trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp	2013-02-03 17:22:26 UTC (rev 54281)
@@ -58,7 +58,7 @@
 		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 @@
 		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);
 		}

Modified: trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.cpp	2013-02-03 17:01:21 UTC (rev 54280)
+++ trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.cpp	2013-02-03 17:22:26 UTC (rev 54281)
@@ -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 @@
 	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()) {

Modified: trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.h
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.h	2013-02-03 17:01:21 UTC (rev 54280)
+++ trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.h	2013-02-03 17:22:26 UTC (rev 54281)
@@ -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; }




More information about the Bf-blender-cvs mailing list