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:
authorCampbell Barton <ideasman42@gmail.com>2012-12-01 12:47:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-01 12:47:39 +0400
commitee08c27f95908f33a3ed4f97d1d147ca80922b65 (patch)
treee7f433d8dc9892c3ff72b076bf2bf2d9170fe7f8 /source/blender/compositor
parent0da227cac105ef29ac431788a0bd33cb755013cc (diff)
fix [#33368] Crash with multilayer exr node
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/intern/COM_Node.cpp20
-rw-r--r--source/blender/compositor/intern/COM_Node.h4
-rw-r--r--source/blender/compositor/nodes/COM_ImageNode.cpp11
3 files changed, 26 insertions, 9 deletions
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index 300d7ef1952..d49bb5f96fb 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -137,18 +137,26 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocke
graph->addOperation(operation);
}
-/* when a node has no valid data (missing image or group pointer) */
+NodeOperation *Node::convertToOperations_invalid_index(ExecutionSystem *graph, int index)
+{
+ const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
+ SetColorOperation *operation = new SetColorOperation();
+ operation->setChannels(warning_color);
+
+ /* link the operation */
+ this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
+ graph->addOperation(operation);
+ return operation;
+}
+
+/* when a node has no valid data (missing image / group pointer, or missing renderlayer from EXR) */
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);
+ convertToOperations_invalid_index(graph, index);
}
}
diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h
index 468a95ed434..c098d6da32b 100644
--- a/source/blender/compositor/intern/COM_Node.h
+++ b/source/blender/compositor/intern/COM_Node.h
@@ -106,6 +106,10 @@ public:
void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
/**
+ * Create dummy warning operation, use when we can't get the source data.
+ */
+ NodeOperation *convertToOperations_invalid_index(ExecutionSystem *graph, int index);
+ /**
* 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]
diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp
index 729cb1b70a0..4293e344c65 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -83,6 +83,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
is_multilayer_ok = true;
for (index = 0; index < numberOfOutputs; index++) {
+ NodeOperation *operation = NULL;
socket = this->getOutputSocket(index);
if (socket->isConnected() || index == 0) {
bNodeSocket *bnodeSocket = socket->getbNodeSocket();
@@ -91,7 +92,6 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
if (rpass) {
- NodeOperation *operation = NULL;
imageuser->pass = passindex;
switch (rpass->channels) {
case 1:
@@ -105,16 +105,21 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
case 4:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
break;
-
default:
- /* XXX add a dummy operation? */
+ /* dummy operation is added below */
break;
}
+
if (index == 0 && operation) {
addPreviewOperation(graph, context, operation->getOutputSocket());
}
}
}
+
+ /* incase we can't load the layer */
+ if (operation == NULL) {
+ convertToOperations_invalid_index(graph, index);
+ }
}
}
}