diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-14 15:05:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-14 15:05:26 +0400 |
commit | 9fd6c535cabbcf4ec12c21bc9229c94944bc6c91 (patch) | |
tree | 35d589545700387c79b403cce898981edd5e06e5 /source | |
parent | f2074949e7a3dbf3a1dc5b51a0a3eee0eee9aada (diff) |
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.
Diffstat (limited to 'source')
3 files changed, 21 insertions, 4 deletions
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index 30875afcb3f..9a80c5e82ae 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -99,6 +99,9 @@ bool ExecutionGroup::canContainOperation(NodeOperation *operation) 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()) { diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp index 6ad58caf17b..b1bc0966687 100644 --- a/source/blender/compositor/nodes/COM_GroupNode.cpp +++ b/source/blender/compositor/nodes/COM_GroupNode.cpp @@ -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 @@ GroupNode::GroupNode(bNode *editorNode) : Node(editorNode) 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 @@ void GroupNode::ungroup(ExecutionSystem &system) 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]; diff --git a/source/blender/compositor/operations/COM_SetColorOperation.h b/source/blender/compositor/operations/COM_SetColorOperation.h index 374390b45a4..a6ff390c3c9 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.h +++ b/source/blender/compositor/operations/COM_SetColorOperation.h @@ -49,8 +49,8 @@ public: 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]; |