diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-04 23:42:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-04 23:42:09 +0400 |
commit | 1d4316f35fcf2f4b9ed73b648422f4e36a071881 (patch) | |
tree | bf97cc2aac690567cd5fe79a0c511ed47e81a9f6 /source/blender/compositor | |
parent | 306e2b48786bc27d818c1ee04382cf654310c3a0 (diff) |
fix [#32490] Compsitor crashes on missing OpenEXR multilayer files
Diffstat (limited to 'source/blender/compositor')
5 files changed, 35 insertions, 10 deletions
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp index 320baacb669..50393d14f35 100644 --- a/source/blender/compositor/intern/COM_Node.cpp +++ b/source/blender/compositor/intern/COM_Node.cpp @@ -137,6 +137,21 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocke graph->addOperation(operation); } +/* when a node has no valid data (missing image or group pointer) */ +void Node::convertToOperations_invalid(ExecutionSystem *graph, CompositorContext *context) +{ + /* 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); + } +} + bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex) { bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first; diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index e19b1d774c9..7ce40e3cb34 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -100,6 +100,13 @@ public: void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex); /** + * when a node has no valid data (missing image or a group nodes ID pointer is NULL) + * call this function from #convertToOperations, this way the node sockets are converted + * into valid outputs, without this the compositor system gets confused and crashes, see [#32490] + */ + void convertToOperations_invalid(ExecutionSystem *graph, CompositorContext *context); + + /** * Creates a new link between an outputSocket and inputSocket and registrates the link to the graph * @return the new created link */ diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp index b1bc0966687..e10d7dbad2e 100644 --- a/source/blender/compositor/nodes/COM_GroupNode.cpp +++ b/source/blender/compositor/nodes/COM_GroupNode.cpp @@ -33,16 +33,7 @@ GroupNode::GroupNode(bNode *editorNode) : Node(editorNode) void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { 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); - } + convertToOperations_invalid(graph, context); } } diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp index addde140b9f..2d13ffb82b6 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cpp +++ b/source/blender/compositor/nodes/COM_ImageNode.cpp @@ -72,12 +72,16 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c /* force a load, we assume iuser index will be set OK anyway */ if (image && image->type == IMA_TYPE_MULTILAYER) { + bool is_multilayer_ok = false; BKE_image_get_ibuf(image, imageuser); if (image->rr) { RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer); if (rl) { OutputSocket *socket; int index; + + is_multilayer_ok = true; + for (index = 0; index < numberOfOutputs; index++) { socket = this->getOutputSocket(index); if (socket->isConnected() || index == 0) { @@ -114,6 +118,11 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c } } } + + /* without this, multilayer that fail to load will crash blender [#32490] */ + if (is_multilayer_ok == false) { + convertToOperations_invalid(graph, context); + } } else { if (numberOfOutputs > 0) { diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h index ae94e974db0..c1d91c16a3c 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.h +++ b/source/blender/compositor/operations/COM_CompositorOperation.h @@ -31,6 +31,9 @@ */ class CompositorOperation : public NodeOperation { private: + /** + * @brief Scene name, used for getting the render output, includes 'SC' prefix. + */ char m_sceneName[MAX_ID_NAME]; /** |