diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-06-10 13:30:31 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-06-10 13:30:31 +0400 |
commit | 18a966293e2a987c7bd5cd17df6a16f76048a042 (patch) | |
tree | 344d97246d464d2e0f75c0a043b455754de92ed4 /source/blender/compositor/nodes/COM_SocketProxyNode.cpp | |
parent | 6e9e758d605741a2ecb8b0fbf24881a17dbe7453 (diff) |
Fix for Tile group nodes with internally unconnected outputs, this was crashing due to missing constant value operations for such outputs. The SocketProxyNode now checks connection of the input socket on conversion, so this also simplifies usage of proxy nodes quite a bit.
Diffstat (limited to 'source/blender/compositor/nodes/COM_SocketProxyNode.cpp')
-rw-r--r-- | source/blender/compositor/nodes/COM_SocketProxyNode.cpp | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp index 42dd49bd1da..fbb25afe266 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp @@ -46,50 +46,48 @@ SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bN void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) { OutputSocket * outputsocket = this->getOutputSocket(0); - if (outputsocket->isConnected()) { - SocketProxyOperation *operation = new SocketProxyOperation(); - this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0)); - this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); - graph->addOperation(operation); - } -} - -void OutputSocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) -{ - OutputSocket * outputsocket = this->getOutputSocket(0); InputSocket * inputsocket = this->getInputSocket(0); if (outputsocket->isConnected()) { - switch (outputsocket->getActualDataType()) { - case COM_DT_VALUE: - { - SetValueOperation *operation = new SetValueOperation(); - bNodeSocketValueFloat *dval = (bNodeSocketValueFloat*)inputsocket->getbNodeSocket()->default_value; - operation->setValue(dval->value); - this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); - graph->addOperation(operation); - break; - } - case COM_DT_COLOR: - { - SetColorOperation *operation = new SetColorOperation(); - bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA*)inputsocket->getbNodeSocket()->default_value; - operation->setChannels(dval->value); - this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); - graph->addOperation(operation); - break; - } - case COM_DT_VECTOR: - { - SetVectorOperation *operation = new SetVectorOperation(); - bNodeSocketValueVector *dval = (bNodeSocketValueVector*)inputsocket->getbNodeSocket()->default_value; - operation->setVector(dval->value); - this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); + if (inputsocket->isConnected()) { + SocketProxyOperation *operation = new SocketProxyOperation(); + inputsocket->relinkConnections(operation->getInputSocket(0)); + outputsocket->relinkConnections(operation->getOutputSocket(0)); graph->addOperation(operation); - break; } - /* quiet warnings */ - case COM_DT_UNKNOWN: - break; + else { + /* If input is not connected, add a constant value operation instead */ + switch (outputsocket->getActualDataType()) { + case COM_DT_VALUE: + { + SetValueOperation *operation = new SetValueOperation(); + bNodeSocketValueFloat *dval = (bNodeSocketValueFloat*)inputsocket->getbNodeSocket()->default_value; + operation->setValue(dval->value); + outputsocket->relinkConnections(operation->getOutputSocket(0)); + graph->addOperation(operation); + break; + } + case COM_DT_COLOR: + { + SetColorOperation *operation = new SetColorOperation(); + bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA*)inputsocket->getbNodeSocket()->default_value; + operation->setChannels(dval->value); + outputsocket->relinkConnections(operation->getOutputSocket(0)); + graph->addOperation(operation); + break; + } + case COM_DT_VECTOR: + { + SetVectorOperation *operation = new SetVectorOperation(); + bNodeSocketValueVector *dval = (bNodeSocketValueVector*)inputsocket->getbNodeSocket()->default_value; + operation->setVector(dval->value); + outputsocket->relinkConnections(operation->getOutputSocket(0)); + graph->addOperation(operation); + break; + } + /* quiet warnings */ + case COM_DT_UNKNOWN: + break; + } } } } |