diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-10-19 20:29:17 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-10-19 20:29:17 +0400 |
commit | 97c68098cca15480f07afb28261021bb3548c89b (patch) | |
tree | 897bcf1cbfd8b789495bad55f9b42b9c92cfb39a /source | |
parent | 1b2d2da69ab7d68497370c397f39247b3b48378a (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/compositor/intern/COM_ExecutionSystem.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp index 0018cbbae9f..57ff5c5c838 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp @@ -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 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation) } } +#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++) { |