[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50397] trunk/blender/source/blender/ compositor: fix [#32490] Compsitor crashes on missing OpenEXR multilayer files
Campbell Barton
ideasman42 at gmail.com
Tue Sep 4 21:42:10 CEST 2012
Revision: 50397
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50397
Author: campbellbarton
Date: 2012-09-04 19:42:09 +0000 (Tue, 04 Sep 2012)
Log Message:
-----------
fix [#32490] Compsitor crashes on missing OpenEXR multilayer files
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_GroupNode.cpp
trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp
trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.h
Modified: trunk/blender/source/blender/compositor/intern/COM_Node.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_Node.cpp 2012-09-04 18:47:08 UTC (rev 50396)
+++ trunk/blender/source/blender/compositor/intern/COM_Node.cpp 2012-09-04 19:42:09 UTC (rev 50397)
@@ -137,6 +137,21 @@
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;
Modified: trunk/blender/source/blender/compositor/intern/COM_Node.h
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_Node.h 2012-09-04 18:47:08 UTC (rev 50396)
+++ trunk/blender/source/blender/compositor/intern/COM_Node.h 2012-09-04 19:42:09 UTC (rev 50397)
@@ -100,6 +100,13 @@
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
*/
Modified: trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp 2012-09-04 18:47:08 UTC (rev 50396)
+++ trunk/blender/source/blender/compositor/nodes/COM_GroupNode.cpp 2012-09-04 19:42:09 UTC (rev 50397)
@@ -33,16 +33,7 @@
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);
}
}
Modified: trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp 2012-09-04 18:47:08 UTC (rev 50396)
+++ trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp 2012-09-04 19:42:09 UTC (rev 50397)
@@ -72,12 +72,16 @@
/* 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 @@
}
}
}
+
+ /* without this, multilayer that fail to load will crash blender [#32490] */
+ if (is_multilayer_ok == false) {
+ convertToOperations_invalid(graph, context);
+ }
}
else {
if (numberOfOutputs > 0) {
Modified: trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.h 2012-09-04 18:47:08 UTC (rev 50396)
+++ trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.h 2012-09-04 19:42:09 UTC (rev 50397)
@@ -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];
/**
More information about the Bf-blender-cvs
mailing list