[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49886] trunk/blender/source/blender/ compositor: fix [#32324] regression: node group with missing ID crashes new tile node system.

Campbell Barton ideasman42 at gmail.com
Tue Aug 14 13:05:28 CEST 2012


Revision: 49886
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49886
Author:   campbellbarton
Date:     2012-08-14 11:05:26 +0000 (Tue, 14 Aug 2012)
Log Message:
-----------
fix [#32324] regression: node group with missing ID crashes new tile node system.

node groups with no ID now output magenta so it doesnt silently fail.

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp
    trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp
    trunk/blender/source/blender/compositor/operations/COM_SetColorOperation.h

Modified: trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp	2012-08-14 08:44:35 UTC (rev 49885)
+++ trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp	2012-08-14 11:05:26 UTC (rev 49886)
@@ -99,6 +99,9 @@
 
 void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operation)
 {
+	/* should never happen but in rare cases it can - it causes confusing crashes */
+	BLI_assert(operation->isOperation() == true);
+
 	if (containsOperation(operation)) return;
 	if (canContainOperation(operation)) {
 		if (!operation->isBufferOperation()) {

Modified: trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp	2012-08-14 08:44:35 UTC (rev 49885)
+++ trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp	2012-08-14 11:05:26 UTC (rev 49886)
@@ -22,6 +22,7 @@
 
 #include "COM_GroupNode.h"
 #include "COM_SocketProxyNode.h"
+#include "COM_SetColorOperation.h"
 #include "COM_ExecutionSystemHelper.h"
 
 GroupNode::GroupNode(bNode *editorNode) : Node(editorNode)
@@ -31,7 +32,18 @@
 
 void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
 {
-	/* pass */
+	if (this->getbNode()->id == NULL) {
+		/* this is a really bad situation - bring on the pink! - so artists know this is bad */
+		const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
+		int index;
+		vector<OutputSocket *> &outputsockets = this->getOutputSockets();
+		for (index = 0; index < outputsockets.size(); index++) {
+			SetColorOperation *operation = new SetColorOperation();
+			this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
+			operation->setChannels(warning_color);
+			graph->addOperation(operation);
+		}
+	}
 }
 
 void GroupNode::ungroup(ExecutionSystem &system)
@@ -46,8 +58,10 @@
 	int nodes_start = system.getNodes().size();
 
 	/* missing node group datablock can happen with library linking */
-	if (!subtree)
+	if (!subtree) {
+		/* this error case its handled in convertToOperations() so we don't get un-convertred sockets */
 		return;
+	}
 
 	for (index = 0; index < inputsockets.size(); index++) {
 		InputSocket *inputSocket = inputsockets[index];

Modified: trunk/blender/source/blender/compositor/operations/COM_SetColorOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_SetColorOperation.h	2012-08-14 08:44:35 UTC (rev 49885)
+++ trunk/blender/source/blender/compositor/operations/COM_SetColorOperation.h	2012-08-14 11:05:26 UTC (rev 49886)
@@ -49,8 +49,8 @@
 	const float getChannel3() { return this->m_channel3; }
 	void setChannel3(float value) { this->m_channel3 = value; }
 	const float getChannel4() { return this->m_channel4; }
-	void setChannel4(float value) { this->m_channel4 = value; }
-	void setChannels(float value[4])
+	void setChannel4(const float value) { this->m_channel4 = value; }
+	void setChannels(const float value[4])
 	{
 		this->m_channel1 = value[0];
 		this->m_channel2 = value[1];




More information about the Bf-blender-cvs mailing list