[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46295] branches/tile/source/blender: TileBranch

Jeroen Bakker j.bakker at atmind.nl
Fri May 4 19:55:06 CEST 2012


Revision: 46295
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46295
Author:   jbakker
Date:     2012-05-04 17:55:05 +0000 (Fri, 04 May 2012)
Log Message:
-----------
TileBranch
 * fix for [#31284] Crasher on pulling a socket input out of a group

 - At Mind - 

Modified Paths:
--------------
    branches/tile/source/blender/blenloader/intern/readfile.c
    branches/tile/source/blender/compositor/nodes/COM_GroupNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.h
    branches/tile/source/blender/compositor/operations/COM_SetVectorOperation.h

Modified: branches/tile/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/tile/source/blender/blenloader/intern/readfile.c	2012-05-04 17:39:37 UTC (rev 46294)
+++ branches/tile/source/blender/blenloader/intern/readfile.c	2012-05-04 17:55:05 UTC (rev 46295)
@@ -13074,7 +13074,7 @@
 		for (scene=main->scene.first; scene; scene=scene->id.next)
 			if (scene->nodetree) 
 				if ( scene->nodetree->chunksize == 0) {
-					scene->nodetree->chunksize = 128;
+					scene->nodetree->chunksize = 256;
 				}
 		}
 	}

Modified: branches/tile/source/blender/compositor/nodes/COM_GroupNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_GroupNode.cpp	2012-05-04 17:39:37 UTC (rev 46294)
+++ branches/tile/source/blender/compositor/nodes/COM_GroupNode.cpp	2012-05-04 17:55:05 UTC (rev 46295)
@@ -42,16 +42,22 @@
 		InputSocket * inputSocket = inputsockets[index];
 		bNodeSocket *editorInput = inputSocket->getbNodeSocket();
 		if (editorInput->groupsock) {
-			SocketProxyNode * proxy = new SocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock);
-			inputSocket->relinkConnections(proxy->getInputSocket(0), true, index, &system);
-			ExecutionSystemHelper::addNode(system.getNodes(), proxy);
+			if (inputSocket->isConnected()) {
+				SocketProxyNode * proxy = new SocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock);
+				inputSocket->relinkConnections(proxy->getInputSocket(0), true, index, &system);
+				ExecutionSystemHelper::addNode(system.getNodes(), proxy);
+			} else {
+				OutputSocketProxyNode * proxy = new OutputSocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock);
+				inputSocket->relinkConnections(proxy->getInputSocket(0), true, index, &system);
+				ExecutionSystemHelper::addNode(system.getNodes(), proxy);
+			}
 		}
 	}
 
 	for (index = 0 ; index < outputsockets.size();index ++) {
 		OutputSocket * outputSocket = outputsockets[index];
 		bNodeSocket *editorOutput = outputSocket->getbNodeSocket();
-		if (editorOutput->groupsock) {
+		if (outputSocket->isConnected() && editorOutput->groupsock) {
 			SocketProxyNode * proxy = new SocketProxyNode(this->getbNode(), editorOutput->groupsock, editorOutput);
 			outputSocket->relinkConnections(proxy->getOutputSocket(0));
 			ExecutionSystemHelper::addNode(system.getNodes(), proxy);

Modified: branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.cpp	2012-05-04 17:39:37 UTC (rev 46294)
+++ branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.cpp	2012-05-04 17:55:05 UTC (rev 46295)
@@ -25,6 +25,9 @@
 #include "stdio.h"
 #include "COM_SocketProxyOperation.h"
 #include "COM_ExecutionSystem.h"
+#include "COM_SetValueOperation.h"
+#include "COM_SetVectorOperation.h"
+#include "COM_SetColorOperation.h"
 
 SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput): Node(editorNode, false) {
 	DataType dt;
@@ -49,3 +52,39 @@
 		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));
+			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;
+		}
+		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;
+		}
+		}
+	}
+}

Modified: branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.h
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.h	2012-05-04 17:39:37 UTC (rev 46294)
+++ branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.h	2012-05-04 17:55:05 UTC (rev 46295)
@@ -37,4 +37,10 @@
 	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

Modified: branches/tile/source/blender/compositor/operations/COM_SetVectorOperation.h
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_SetVectorOperation.h	2012-05-04 17:39:37 UTC (rev 46294)
+++ branches/tile/source/blender/compositor/operations/COM_SetVectorOperation.h	2012-05-04 17:55:05 UTC (rev 46295)
@@ -59,5 +59,10 @@
 	void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
 	const bool isSetOperation() const {return true;}
 
+	void setVector(float vector[3]) {
+		setX(vector[0]);
+		setY(vector[1]);
+		setZ(vector[2]);
+	}
 };
 #endif




More information about the Bf-blender-cvs mailing list