[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43844] branches/tile/source/blender/ compositor: Fixed use of deprecated bNodeStack values from sockets.

Lukas Toenne lukas.toenne at googlemail.com
Thu Feb 2 11:05:46 CET 2012


Revision: 43844
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43844
Author:   lukastoenne
Date:     2012-02-02 10:05:44 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
Fixed use of deprecated bNodeStack values from sockets. These have been replaced by the default_value pointer, which points to one of the bNodeSocketValue*** structs, depending on socket type. The bNodeStack ns member in bNodeSocket might still work occasionally since it is restored in writefile.c for forward compatibility (happens on undo push too).

Modified Paths:
--------------
    branches/tile/source/blender/compositor/intern/COM_InputSocket.cpp
    branches/tile/source/blender/compositor/nodes/COM_BlurNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_ColorNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_NormalNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_ValueNode.cpp

Modified: branches/tile/source/blender/compositor/intern/COM_InputSocket.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_InputSocket.cpp	2012-02-02 09:24:48 UTC (rev 43843)
+++ branches/tile/source/blender/compositor/intern/COM_InputSocket.cpp	2012-02-02 10:05:44 UTC (rev 43844)
@@ -201,5 +201,21 @@
 }
 
 float* InputSocket::getStaticValues() {
-	return this->getbNodeSocket()->ns.vec;
+	/* XXX only works for socket types with actual float input values.
+	 * currently all compositor socket types (value, rgba, vector) support this.
+	 */
+	bNodeSocket *b_socket = this->getbNodeSocket();
+	static float default_null = 0.0f;
+	
+	switch (this->getDataType()) {
+	case COM_DT_VALUE:
+		return &((bNodeSocketValueFloat*)b_socket->default_value)->value;
+	case COM_DT_COLOR:
+		return ((bNodeSocketValueRGBA*)b_socket->default_value)->value;
+	case COM_DT_VECTOR:
+		return ((bNodeSocketValueVector*)b_socket->default_value)->value;
+	default:
+		/* XXX this should never happen, just added to please the compiler */
+		return &default_null;
+	}
 }

Modified: branches/tile/source/blender/compositor/nodes/COM_BlurNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_BlurNode.cpp	2012-02-02 09:24:48 UTC (rev 43843)
+++ branches/tile/source/blender/compositor/nodes/COM_BlurNode.cpp	2012-02-02 10:05:44 UTC (rev 43844)
@@ -35,7 +35,7 @@
     bNode* editorNode = this->getbNode();
 	NodeBlurData * data = (NodeBlurData*)editorNode->storage;
 	const bNodeSocket *sock = this->getInputSocket(1)->getbNodeSocket();
-	const float size = sock->ns.vec[0];
+	const float size = ((const bNodeSocketValueFloat*)sock->default_value)->value;
 	if (!data->bokeh) {
 		GaussianXBlurOperation *operationx = new GaussianXBlurOperation();
 		operationx->setData(data);

Modified: branches/tile/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_BokehBlurNode.cpp	2012-02-02 09:24:48 UTC (rev 43843)
+++ branches/tile/source/blender/compositor/nodes/COM_BokehBlurNode.cpp	2012-02-02 10:05:44 UTC (rev 43844)
@@ -54,7 +54,7 @@
 		this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
 		this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), true, 1, graph);
 		this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), true, 3, graph);
-		operation->setSize(this->getInputSocket(2)->getbNodeSocket()->ns.vec[0]);
+		operation->setSize(((bNodeSocketValueFloat*)this->getInputSocket(2)->getbNodeSocket()->default_value)->value);
 		operation->setQuality(context->getQuality());
 		graph->addOperation(operation);
 		this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());

Modified: branches/tile/source/blender/compositor/nodes/COM_ColorNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_ColorNode.cpp	2012-02-02 09:24:48 UTC (rev 43843)
+++ branches/tile/source/blender/compositor/nodes/COM_ColorNode.cpp	2012-02-02 10:05:44 UTC (rev 43844)
@@ -31,7 +31,8 @@
 void ColorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
 	SetColorOperation *operation = new SetColorOperation();
 	bNodeSocket* socket = this->getEditorOutputSocket(0);
+	bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA*)socket->default_value;
 	this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-	operation->setChannels(socket->ns.vec);
+	operation->setChannels(dval->value);
 	graph->addOperation(operation);
 }

Modified: branches/tile/source/blender/compositor/nodes/COM_NormalNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_NormalNode.cpp	2012-02-02 09:24:48 UTC (rev 43843)
+++ branches/tile/source/blender/compositor/nodes/COM_NormalNode.cpp	2012-02-02 10:05:44 UTC (rev 43844)
@@ -37,9 +37,10 @@
 
     SetVectorOperation * operationSet = new SetVectorOperation();
     bNodeSocket * insock = (bNodeSocket*)editorNode->outputs.first;
-    operationSet->setX(insock->ns.vec[0]);
-    operationSet->setY(insock->ns.vec[1]);
-    operationSet->setZ(insock->ns.vec[2]);
+    bNodeSocketValueVector *dval = (bNodeSocketValueVector*)insock->default_value;
+    operationSet->setX(dval->value[0]);
+    operationSet->setY(dval->value[1]);
+    operationSet->setZ(dval->value[2]);
     operationSet->setW(0.0f);
 
     outputSocket->relinkConnections(operationSet->getOutputSocket(0));

Modified: branches/tile/source/blender/compositor/nodes/COM_ValueNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_ValueNode.cpp	2012-02-02 09:24:48 UTC (rev 43843)
+++ branches/tile/source/blender/compositor/nodes/COM_ValueNode.cpp	2012-02-02 10:05:44 UTC (rev 43844)
@@ -31,7 +31,8 @@
 void ValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
 	SetValueOperation *operation = new SetValueOperation();
 	bNodeSocket* socket = this->getEditorOutputSocket(0);
+	bNodeSocketValueFloat *dval = (bNodeSocketValueFloat*)socket->default_value;
 	this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-	operation->setValue(socket->ns.vec[0]);
+	operation->setValue(dval->value);
 	graph->addOperation(operation);
 }




More information about the Bf-blender-cvs mailing list