diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-08 12:39:28 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-08 12:39:28 +0400 |
commit | 1dd8851244a3c88ba315c57549a2c3c46786aad0 (patch) | |
tree | 0995bab81756b654d7f96a79e28e90da0fefc407 /source/blender | |
parent | 474b92c76ce813af8d5352426c5551e0af7a0abf (diff) |
Fix #33804: Blender crash unlinking multilayer exr image in image node
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/compositor/nodes/COM_ImageNode.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp index 4293e344c65..864d6f08311 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cpp +++ b/source/blender/compositor/nodes/COM_ImageNode.cpp @@ -28,6 +28,10 @@ #include "BKE_node.h" #include "BLI_utildefines.h" +#include "COM_SetValueOperation.h" +#include "COM_SetVectorOperation.h" +#include "COM_SetColorOperation.h" + ImageNode::ImageNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -165,6 +169,46 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c graph->addOperation(depthOperation); } } + if (numberOfOutputs > 3) { + /* happens when unlinking image datablock from multilayer node */ + for (int i = 3; i < numberOfOutputs; i++) { + OutputSocket *output = this->getOutputSocket(i); + NodeOperation *operation = NULL; + switch (output->getDataType()) { + case COM_DT_VALUE: + { + SetValueOperation *valueoperation = new SetValueOperation(); + valueoperation->setValue(0.0f); + operation = valueoperation; + break; + } + case COM_DT_VECTOR: + { + SetVectorOperation *vectoroperation = new SetVectorOperation(); + vectoroperation->setX(0.0f); + vectoroperation->setY(0.0f); + vectoroperation->setW(0.0f); + operation = vectoroperation; + break; + } + case COM_DT_COLOR: + { + SetColorOperation *coloroperation = new SetColorOperation(); + coloroperation->setChannel1(0.0f); + coloroperation->setChannel2(0.0f); + coloroperation->setChannel3(0.0f); + coloroperation->setChannel4(0.0f); + operation = coloroperation; + break; + } + } + + if (operation) { + output->relinkConnections(operation->getOutputSocket()); + graph->addOperation(operation); + } + } + } } } |