Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-06-10 13:30:31 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-06-10 13:30:31 +0400
commit18a966293e2a987c7bd5cd17df6a16f76048a042 (patch)
tree344d97246d464d2e0f75c0a043b455754de92ed4
parent6e9e758d605741a2ecb8b0fbf24881a17dbe7453 (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.
-rw-r--r--source/blender/compositor/nodes/COM_GroupNode.cpp15
-rw-r--r--source/blender/compositor/nodes/COM_SocketProxyNode.cpp78
-rw-r--r--source/blender/compositor/nodes/COM_SocketProxyNode.h6
3 files changed, 42 insertions, 57 deletions
diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp
index 076d4f1501a..ec06a3acd7e 100644
--- a/source/blender/compositor/nodes/COM_GroupNode.cpp
+++ b/source/blender/compositor/nodes/COM_GroupNode.cpp
@@ -45,23 +45,16 @@ void GroupNode::ungroup(ExecutionSystem &system)
InputSocket * inputSocket = inputsockets[index];
bNodeSocket *editorInput = inputSocket->getbNodeSocket();
if (editorInput->groupsock) {
- if (inputSocket->isConnected()) {
- SocketProxyNode * proxy = new SocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock);
- inputSocket->relinkConnections(proxy->getInputSocket(0), index, &system);
- ExecutionSystemHelper::addNode(system.getNodes(), proxy);
- }
- else {
- OutputSocketProxyNode * proxy = new OutputSocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock);
- inputSocket->relinkConnections(proxy->getInputSocket(0), index, &system);
- ExecutionSystemHelper::addNode(system.getNodes(), proxy);
- }
+ SocketProxyNode * proxy = new SocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock);
+ inputSocket->relinkConnections(proxy->getInputSocket(0), index, &system);
+ ExecutionSystemHelper::addNode(system.getNodes(), proxy);
}
}
for (index = 0 ; index < outputsockets.size();index ++) {
OutputSocket * outputSocket = outputsockets[index];
bNodeSocket *editorOutput = outputSocket->getbNodeSocket();
- if (outputSocket->isConnected() && editorOutput->groupsock) {
+ if (editorOutput->groupsock) {
SocketProxyNode * proxy = new SocketProxyNode(this->getbNode(), editorOutput->groupsock, editorOutput);
outputSocket->relinkConnections(proxy->getOutputSocket(0));
ExecutionSystemHelper::addNode(system.getNodes(), proxy);
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;
+ }
}
}
}
diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.h b/source/blender/compositor/nodes/COM_SocketProxyNode.h
index 1b5ee699211..b73ca24a45e 100644
--- a/source/blender/compositor/nodes/COM_SocketProxyNode.h
+++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h
@@ -37,10 +37,4 @@ public:
virtual bool isProxyNode() const { return true; }
};
-class OutputSocketProxyNode: public SocketProxyNode {
-public:
- OutputSocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput): SocketProxyNode(editorNode, editorInput, editorOutput) {}
- void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
-};
-
#endif