[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47662] trunk/blender/source/blender/ compositor/nodes: Fix for Tile group nodes with internally unconnected outputs, this was crashing due to missing constant value operations for such outputs .

Lukas Toenne lukas.toenne at googlemail.com
Sun Jun 10 11:30:41 CEST 2012


Revision: 47662
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47662
Author:   lukastoenne
Date:     2012-06-10 09:30:31 +0000 (Sun, 10 Jun 2012)
Log Message:
-----------
Fix for Tile group nodes with internally unconnected outputs, this was crashing due to missing constant value operations for such outputs. The SocketProxyNode now checks connection of the input socket on conversion, so this also simplifies usage of proxy nodes quite a bit.

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	2012-06-10 09:10:56 UTC (rev 47661)
+++ trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp	2012-06-10 09:30:31 UTC (rev 47662)
@@ -45,23 +45,16 @@
 		InputSocket * inputSocket = inputsockets[index];
 		bNodeSocket *editorInput = inputSocket->getbNodeSocket();
 		if (editorInput->groupsock) {
-			if (inputSocket->isConnected()) {
-				SocketProxyNode * proxy = new SocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock);
-				inputSocket->relinkConnections(proxy->getInputSocket(0), index, &system);
-				ExecutionSystemHelper::addNode(system.getNodes(), proxy);
-			}
-			else {
-				OutputSocketProxyNode * proxy = new OutputSocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock);
-				inputSocket->relinkConnections(proxy->getInputSocket(0), index, &system);
-				ExecutionSystemHelper::addNode(system.getNodes(), proxy);
-			}
+			SocketProxyNode * proxy = new SocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock);
+			inputSocket->relinkConnections(proxy->getInputSocket(0), index, &system);
+			ExecutionSystemHelper::addNode(system.getNodes(), proxy);
 		}
 	}
 
 	for (index = 0 ; index < outputsockets.size();index ++) {
 		OutputSocket * outputSocket = outputsockets[index];
 		bNodeSocket *editorOutput = outputSocket->getbNodeSocket();
-		if (outputSocket->isConnected() && editorOutput->groupsock) {
+		if (editorOutput->groupsock) {
 			SocketProxyNode * proxy = new SocketProxyNode(this->getbNode(), editorOutput->groupsock, editorOutput);
 			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	2012-06-10 09:10:56 UTC (rev 47661)
+++ trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.cpp	2012-06-10 09:30:31 UTC (rev 47662)
@@ -46,50 +46,48 @@
 void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
 {
 	OutputSocket * outputsocket = this->getOutputSocket(0);
-	if (outputsocket->isConnected()) {
-		SocketProxyOperation *operation = new SocketProxyOperation();
-		this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0));
-		this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
-		graph->addOperation(operation);
-	}
-}
-
-void OutputSocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
-{
-	OutputSocket * outputsocket = this->getOutputSocket(0);
 	InputSocket * inputsocket = this->getInputSocket(0);
 	if (outputsocket->isConnected()) {
-		switch (outputsocket->getActualDataType()) {
-		case COM_DT_VALUE:
-		{
-			SetValueOperation *operation = new SetValueOperation();
-			bNodeSocketValueFloat *dval = (bNodeSocketValueFloat*)inputsocket->getbNodeSocket()->default_value;
-			operation->setValue(dval->value);
-			this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
+		if (inputsocket->isConnected()) {
+			SocketProxyOperation *operation = new SocketProxyOperation();
+			inputsocket->relinkConnections(operation->getInputSocket(0));
+			outputsocket->relinkConnections(operation->getOutputSocket(0));
 			graph->addOperation(operation);
-			break;
 		}
-		case COM_DT_COLOR:
-		{
-			SetColorOperation *operation = new SetColorOperation();
-			bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA*)inputsocket->getbNodeSocket()->default_value;
-			operation->setChannels(dval->value);
-			this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
-			graph->addOperation(operation);
-			break;
+		else {
+			/* If input is not connected, add a constant value operation instead */
+			switch (outputsocket->getActualDataType()) {
+			case COM_DT_VALUE:
+			{
+				SetValueOperation *operation = new SetValueOperation();
+				bNodeSocketValueFloat *dval = (bNodeSocketValueFloat*)inputsocket->getbNodeSocket()->default_value;
+				operation->setValue(dval->value);
+				outputsocket->relinkConnections(operation->getOutputSocket(0));
+				graph->addOperation(operation);
+				break;
+			}
+			case COM_DT_COLOR:
+			{
+				SetColorOperation *operation = new SetColorOperation();
+				bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA*)inputsocket->getbNodeSocket()->default_value;
+				operation->setChannels(dval->value);
+				outputsocket->relinkConnections(operation->getOutputSocket(0));
+				graph->addOperation(operation);
+				break;
+			}
+			case COM_DT_VECTOR:
+			{
+				SetVectorOperation *operation = new SetVectorOperation();
+				bNodeSocketValueVector *dval = (bNodeSocketValueVector*)inputsocket->getbNodeSocket()->default_value;
+				operation->setVector(dval->value);
+				outputsocket->relinkConnections(operation->getOutputSocket(0));
+				graph->addOperation(operation);
+				break;
+			}
+				/* quiet warnings */
+			case COM_DT_UNKNOWN:
+				break;
+			}
 		}
-		case COM_DT_VECTOR:
-		{
-			SetVectorOperation *operation = new SetVectorOperation();
-			bNodeSocketValueVector *dval = (bNodeSocketValueVector*)inputsocket->getbNodeSocket()->default_value;
-			operation->setVector(dval->value);
-			this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
-			graph->addOperation(operation);
-			break;
-		}
-			/* quiet warnings */
-		case COM_DT_UNKNOWN:
-			break;
-		}
 	}
 }

Modified: trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.h
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.h	2012-06-10 09:10:56 UTC (rev 47661)
+++ trunk/blender/source/blender/compositor/nodes/COM_SocketProxyNode.h	2012-06-10 09:30:31 UTC (rev 47662)
@@ -37,10 +37,4 @@
 	virtual bool isProxyNode() const { return true; }
 };
 
-class OutputSocketProxyNode: public SocketProxyNode {
-public:
-	OutputSocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput): SocketProxyNode(editorNode, editorInput, editorOutput) {}
-	void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
-};
-
 #endif




More information about the Bf-blender-cvs mailing list