[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46936] trunk/blender/source/blender/ compositor: cleanup relink code

Jeroen Bakker j.bakker at atmind.nl
Wed May 23 14:45:07 CEST 2012


Revision: 46936
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46936
Author:   jbakker
Date:     2012-05-23 12:45:07 +0000 (Wed, 23 May 2012)
Log Message:
-----------
cleanup relink code

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/intern/COM_InputSocket.cpp
    trunk/blender/source/blender/compositor/intern/COM_InputSocket.h
    trunk/blender/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_BlurNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_BoxMaskNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_BrightnessNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ColorCurveNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ColorRampNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ColorSpillNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_CombineRGBANode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_CropNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_DefocusNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_DisplaceNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_FilterNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_FlipNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_GammaNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_GlareNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_IDMaskNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_InvertNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_LensDistortionNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_MapUVNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_MapValueNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_MathNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_MixNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_NormalNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_NormalizeNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_RotateNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ScaleNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_SwitchNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_TextureNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_TonemapNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_TransformNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_TranslateNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_VectorBlurNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_VectorCurveNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ViewerNode.cpp
    trunk/blender/source/blender/compositor/nodes/COM_ZCombineNode.cpp

Modified: trunk/blender/source/blender/compositor/intern/COM_InputSocket.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_InputSocket.cpp	2012-05-23 12:15:12 UTC (rev 46935)
+++ trunk/blender/source/blender/compositor/intern/COM_InputSocket.cpp	2012-05-23 12:45:07 UTC (rev 46936)
@@ -128,65 +128,61 @@
 }
 void InputSocket::relinkConnections(InputSocket *relinkToSocket)
 {
-	this->relinkConnections(relinkToSocket, false, -1, NULL);
+	if (!isConnected()) {
+		return;
+	}
+	SocketConnection *connection = this->getConnection();
+	connection->setToSocket(relinkToSocket);
+	relinkToSocket->setConnection(connection);
+	this->setConnection(NULL);
 }
 
-void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem *graph)
+void InputSocket::relinkConnectionsDuplicate(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *graph)
 {
-	if (!duplicate) {
-		this->relinkConnections(relinkToSocket, autoconnect, editorNodeInputSocketIndex, graph);
-	}
-	else {
-		if (!this->isConnected() && autoconnect) {
-			Node *node = (Node*)this->getNode();
-			switch (this->getActualDataType()) {
-			case COM_DT_UNKNOWN:
-			case COM_DT_COLOR:
-				node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
-				break;
-			case COM_DT_VECTOR:
-				node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
-				break;
-			case COM_DT_VALUE:
-				node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
-				break;
-			}
-			return;
+	if (!this->isConnected()) {
+		Node *node = (Node*)this->getNode();
+		switch (this->getActualDataType()) {
+		case COM_DT_UNKNOWN:
+		case COM_DT_COLOR:
+			node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+			break;
+		case COM_DT_VECTOR:
+			node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+			break;
+		case COM_DT_VALUE:
+			node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+			break;
 		}
-		SocketConnection * newConnection = new SocketConnection();
-		OutputSocket * fromSocket = this->getConnection()->getFromSocket();
-		newConnection->setToSocket(relinkToSocket);
-		newConnection->setFromSocket(fromSocket);
-		relinkToSocket->setConnection(newConnection);
-		fromSocket->addConnection(newConnection);
-		graph->addSocketConnection(newConnection);
+		return;
 	}
+	SocketConnection * newConnection = new SocketConnection();
+	OutputSocket * fromSocket = this->getConnection()->getFromSocket();
+	newConnection->setToSocket(relinkToSocket);
+	newConnection->setFromSocket(fromSocket);
+	relinkToSocket->setConnection(newConnection);
+	fromSocket->addConnection(newConnection);
+	graph->addSocketConnection(newConnection);
 }
 
-void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, ExecutionSystem *graph)
+void InputSocket::relinkConnections(InputSocket *relinkToSocket,  int editorNodeInputSocketIndex, ExecutionSystem *graph)
 {
-	if (!isConnected()) {
-		if (autoconnect) {
-			Node *node = (Node*)this->getNode();
-			switch (this->getActualDataType()) {
-			case COM_DT_UNKNOWN:
-			case COM_DT_COLOR:
-				node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
-				break;
-			case COM_DT_VECTOR:
-				node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
-				break;
-			case COM_DT_VALUE:
-				node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
-				break;
-			}
+	if (isConnected()) {
+		relinkConnections(relinkToSocket);
+	} else {
+		Node *node = (Node*)this->getNode();
+		switch (this->getActualDataType()) {
+		case COM_DT_UNKNOWN:
+		case COM_DT_COLOR:
+			node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+			break;
+		case COM_DT_VECTOR:
+			node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+			break;
+		case COM_DT_VALUE:
+			node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+			break;
 		}
-		return;
 	}
-	SocketConnection *connection = this->getConnection();
-	connection->setToSocket(relinkToSocket);
-	relinkToSocket->setConnection(connection);
-	this->setConnection(NULL);
 }
 
 const ChannelInfo *InputSocket::getChannelInfo(const int channelnumber)

Modified: trunk/blender/source/blender/compositor/intern/COM_InputSocket.h
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_InputSocket.h	2012-05-23 12:15:12 UTC (rev 46935)
+++ trunk/blender/source/blender/compositor/intern/COM_InputSocket.h	2012-05-23 12:45:07 UTC (rev 46936)
@@ -126,17 +126,15 @@
 	  * @param editorNodeInputSocketIndex index of the socket number of the bNode (used to retrieve the value for autoconnection)
 	  * @param system ExecutionSystem to update to
 	  */
-	void relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, ExecutionSystem *system);
+	void relinkConnections(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *system);
 	
 	/**
 	  * @brief move all connections of this input socket to another socket
 	  * @param relinkToSocket the socket to move to connections to
-	  * @param autoconnect will a set operation be added when no connections exist
 	  * @param editorNodeInputSocketIndex index of the socket number of the bNode (used to retrieve the value for autoconnection)
-	  * @param duplicate instead of move do a copy of the connection.
 	  * @param system ExecutionSystem to update to
 	  */
-	void relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem *system);
+	void relinkConnectionsDuplicate(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *system);
 	
 	/**
 	  * @brief set the resize mode

Modified: trunk/blender/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_AlphaOverNode.cpp	2012-05-23 12:15:12 UTC (rev 46935)
+++ trunk/blender/source/blender/compositor/nodes/COM_AlphaOverNode.cpp	2012-05-23 12:45:07 UTC (rev 46936)
@@ -64,9 +64,9 @@
 	else {
 		convertProg->setResolutionInputSocketIndex(0);
 	}
-	valueSocket->relinkConnections(convertProg->getInputSocket(0), true, 0, graph);
-	color1Socket->relinkConnections(convertProg->getInputSocket(1), true, 1, graph);
-	color2Socket->relinkConnections(convertProg->getInputSocket(2), true, 2, graph);
+	valueSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph);
+	color1Socket->relinkConnections(convertProg->getInputSocket(1), 1, graph);
+	color2Socket->relinkConnections(convertProg->getInputSocket(2), 2, graph);
 	outputSocket->relinkConnections(convertProg->getOutputSocket(0));
 	graph->addOperation(convertProg);
 }

Modified: trunk/blender/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp	2012-05-23 12:15:12 UTC (rev 46935)
+++ trunk/blender/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp	2012-05-23 12:45:07 UTC (rev 46936)
@@ -36,8 +36,8 @@
 	BilateralBlurOperation *operation = new BilateralBlurOperation();
 	operation->setQuality(context->getQuality());
 	operation->setData(data);
-	this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
-	this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), true, 1, graph);
+	this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+	this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
 	this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
 	graph->addOperation(operation);
 }

Modified: trunk/blender/source/blender/compositor/nodes/COM_BlurNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_BlurNode.cpp	2012-05-23 12:15:12 UTC (rev 46935)
+++ trunk/blender/source/blender/compositor/nodes/COM_BlurNode.cpp	2012-05-23 12:45:07 UTC (rev 46936)
@@ -50,8 +50,8 @@
 	if (data->filtertype == R_FILTER_FAST_GAUSS) {
 		FastGaussianBlurOperation *operationfgb = new FastGaussianBlurOperation();
 		operationfgb->setData(data);
-		this->getInputSocket(0)->relinkConnections(operationfgb->getInputSocket(0), true, 0, graph);
-		this->getInputSocket(1)->relinkConnections(operationfgb->getInputSocket(1), true, 1, graph);
+		this->getInputSocket(0)->relinkConnections(operationfgb->getInputSocket(0), 0, graph);
+		this->getInputSocket(1)->relinkConnections(operationfgb->getInputSocket(1), 1, graph);
 		this->getOutputSocket(0)->relinkConnections(operationfgb->getOutputSocket(0));
 		graph->addOperation(operationfgb);
 		addPreviewOperation(graph, operationfgb->getOutputSocket(), 5);
@@ -60,8 +60,8 @@
 		GaussianXBlurOperation *operationx = new GaussianXBlurOperation();
 		operationx->setData(data);
 		operationx->setQuality(quality);
-		this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), true, 0, graph);
-		this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), true, 1, graph);
+		this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), 0, graph);
+		this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), 1, graph);
 		graph->addOperation(operationx);
 		GaussianYBlurOperation *operationy = new GaussianYBlurOperation();
 		operationy->setData(data);
@@ -75,8 +75,8 @@
 	else {
 		GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation();
 		operation->setData(data);
-		this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
-		this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), true, 1, graph);
+		this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+		this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
 		operation->setQuality(quality);
 		graph->addOperation(operation);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list