Fix #33804: Blender crash unlinking multilayer exr image in image node

This commit is contained in:
Sergey Sharybin
2013-01-08 08:39:28 +00:00
parent 474b92c76c
commit 1dd8851244

View File

@@ -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);
}
}
}
}
}