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

Jeroen Bakker j.bakker at atmind.nl
Wed May 2 21:50:57 CEST 2012


Revision: 46210
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46210
Author:   jbakker
Date:     2012-05-02 19:50:56 +0000 (Wed, 02 May 2012)
Log Message:
-----------
TileBranch
 * fix for [#31223] crash on mute RGB node
Mute nodes did not work for nodes with only output sockets.

Strange that it should be possible :)

Jeroen & Monique
 - At Mind - 

Modified Paths:
--------------
    branches/tile/source/blender/compositor/nodes/COM_MuteNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_MuteNode.h

Modified: branches/tile/source/blender/compositor/nodes/COM_MuteNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_MuteNode.cpp	2012-05-02 19:21:30 UTC (rev 46209)
+++ branches/tile/source/blender/compositor/nodes/COM_MuteNode.cpp	2012-05-02 19:50:56 UTC (rev 46210)
@@ -23,11 +23,14 @@
 #include "COM_MuteNode.h"
 #include "COM_SocketConnection.h"
 #include "stdio.h"
+#include "COM_SetValueOperation.h"
+#include "COM_SetVectorOperation.h"
+#include "COM_SetColorOperation.h"
 
 MuteNode::MuteNode(bNode *editorNode): Node(editorNode) {
 }
 
-void MuteNode::reconnect(OutputSocket * output) {
+void MuteNode::reconnect(ExecutionSystem * graph, OutputSocket * output) {
 	vector<InputSocket*> &inputsockets = this->getInputSockets();
 	for (unsigned int index = 0; index < inputsockets.size() ; index ++) {
 		InputSocket *input = inputsockets[index];
@@ -38,6 +41,40 @@
 			}
 		}
 	}
+	
+	NodeOperation * operation;
+	switch (output->getDataType()) {
+	case COM_DT_VALUE:
+	{
+		SetValueOperation *valueoperation = new SetValueOperation();
+		valueoperation->setValue(0.0f);
+		operation = valueoperation;
+		break;
+	}
+	case COM_DT_VECTOR:
+	{
+		SetVectorOperation *vectoroperation = new SetVectorOperation();
+		vectoroperation->setX(0.0f);
+		vectoroperation->setY(0.0f);
+		vectoroperation->setW(0.0f);
+		operation = vectoroperation;
+		break;
+	}
+	case COM_DT_COLOR:
+	{
+		SetColorOperation *coloroperation = new SetColorOperation();
+		coloroperation->setChannel1(0.0f);
+		coloroperation->setChannel2(0.0f);
+		coloroperation->setChannel3(0.0f);
+		coloroperation->setChannel4(0.0f);
+		operation = coloroperation;
+		break;
+	}
+	}
+	if (operation) {
+		output->relinkConnections(operation->getOutputSocket(), false);
+		graph->addOperation(operation);
+	}
 
 	output->clearConnections();
 }
@@ -48,7 +85,7 @@
 	for (unsigned int index = 0 ; index < outputsockets.size() ; index ++) {
 		OutputSocket * output = outputsockets[index];
 		if (output->isConnected()) {
-			reconnect(output);
+			reconnect(graph, output);
 		}
 	}
 }

Modified: branches/tile/source/blender/compositor/nodes/COM_MuteNode.h
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_MuteNode.h	2012-05-02 19:21:30 UTC (rev 46209)
+++ branches/tile/source/blender/compositor/nodes/COM_MuteNode.h	2012-05-02 19:50:56 UTC (rev 46210)
@@ -34,7 +34,7 @@
 	MuteNode(bNode *editorNode);
 	void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
 private:
-	void reconnect(OutputSocket * output);
+	void reconnect(ExecutionSystem* graph, OutputSocket * output);
 };
 
 #endif




More information about the Bf-blender-cvs mailing list