[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51426] trunk/blender/source/blender/ compositor/intern/COM_ExecutionSystem.cpp: Additional debug assert in the compositor for checking correct conversion of Nodes to Operations .

Lukas Toenne lukas.toenne at googlemail.com
Fri Oct 19 18:29:18 CEST 2012


Revision: 51426
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51426
Author:   lukastoenne
Date:     2012-10-19 16:29:17 +0000 (Fri, 19 Oct 2012)
Log Message:
-----------
Additional debug assert in the compositor for checking correct conversion of Nodes to Operations. This will trigger an assert failure whenever a node has remaining socket connections after conversion. This would mean that not all sockets have been properly relinked and helps detect incomplete code.

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/intern/COM_ExecutionSystem.cpp

Modified: trunk/blender/source/blender/compositor/intern/COM_ExecutionSystem.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_ExecutionSystem.cpp	2012-10-19 14:38:32 UTC (rev 51425)
+++ trunk/blender/source/blender/compositor/intern/COM_ExecutionSystem.cpp	2012-10-19 16:29:17 UTC (rev 51426)
@@ -25,6 +25,7 @@
 #include <sstream>
 
 #include "PIL_time.h"
+#include "BLI_utildefines.h"
 #include "BKE_node.h"
 
 #include "COM_Converter.h"
@@ -240,12 +241,32 @@
 	}
 }
 
+#ifndef NDEBUG
+/* if this fails, there are still connection to/from this node,
+ * which have not been properly relinked to operations!
+ */
+static void debug_check_node_connections(Node *node)
+{
+	for (int i = 0; i < node->getNumberOfInputSockets(); ++i) {
+		BLI_assert(!node->getInputSocket(i)->isConnected());
+	}
+	for (int i = 0; i < node->getNumberOfOutputSockets(); ++i) {
+		BLI_assert(!node->getOutputSocket(i)->isConnected());
+	}
+}
+#else
+/* stub */
+#define debug_check_node_connections(node)
+#endif
+
 void ExecutionSystem::convertToOperations()
 {
 	unsigned int index;
 	for (index = 0; index < this->m_nodes.size(); index++) {
 		Node *node = (Node *)this->m_nodes[index];
 		node->convertToOperations(this, &this->m_context);
+
+		debug_check_node_connections(node);
 	}
 
 	for (index = 0; index < this->m_connections.size(); index++) {




More information about the Bf-blender-cvs mailing list