[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52697] trunk/blender/source/blender/ compositor: fix [#33368] Crash with multilayer exr node
Campbell Barton
ideasman42 at gmail.com
Sat Dec 1 09:47:42 CET 2012
Revision: 52697
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52697
Author: campbellbarton
Date: 2012-12-01 08:47:39 +0000 (Sat, 01 Dec 2012)
Log Message:
-----------
fix [#33368] Crash with multilayer exr node
Modified Paths:
--------------
trunk/blender/source/blender/compositor/intern/COM_Node.cpp
trunk/blender/source/blender/compositor/intern/COM_Node.h
trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp
Modified: trunk/blender/source/blender/compositor/intern/COM_Node.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_Node.cpp 2012-12-01 07:58:27 UTC (rev 52696)
+++ trunk/blender/source/blender/compositor/intern/COM_Node.cpp 2012-12-01 08:47:39 UTC (rev 52697)
@@ -137,18 +137,26 @@
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);
}
}
Modified: trunk/blender/source/blender/compositor/intern/COM_Node.h
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_Node.h 2012-12-01 07:58:27 UTC (rev 52696)
+++ trunk/blender/source/blender/compositor/intern/COM_Node.h 2012-12-01 08:47:39 UTC (rev 52697)
@@ -106,6 +106,10 @@
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]
Modified: trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp 2012-12-01 07:58:27 UTC (rev 52696)
+++ trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp 2012-12-01 08:47:39 UTC (rev 52697)
@@ -83,6 +83,7 @@
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 @@
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 @@
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);
+ }
}
}
}
More information about the Bf-blender-cvs
mailing list