[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60233] trunk/blender/source/blender/ compositor: Fix for OutputFile node, this would crash with unconnected sockets in MultiEXR mode, because it matches sockets and EXR layers by index and was skipping unconnected sockets .

Lukas Toenne lukas.toenne at googlemail.com
Thu Sep 19 10:21:54 CEST 2013


Revision: 60233
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60233
Author:   lukastoenne
Date:     2013-09-19 08:21:53 +0000 (Thu, 19 Sep 2013)
Log Message:
-----------
Fix for OutputFile node, this would crash with unconnected sockets in MultiEXR mode, because it matches sockets and EXR layers by index and was skipping unconnected sockets. Simply create EXR layer info
for all sockets now and then ignore unconnected layers when finally writing to file in deinitExecution.

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/nodes/COM_OutputFileNode.cpp
    trunk/blender/source/blender/compositor/operations/COM_OutputFileOperation.cpp

Modified: trunk/blender/source/blender/compositor/nodes/COM_OutputFileNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_OutputFileNode.cpp	2013-09-19 07:58:47 UTC (rev 60232)
+++ trunk/blender/source/blender/compositor/nodes/COM_OutputFileNode.cpp	2013-09-19 08:21:53 UTC (rev 60233)
@@ -59,12 +59,12 @@
 		bool hasConnections = false;
 		for (int i = 0; i < num_inputs; ++i) {
 			InputSocket *input = getInputSocket(i);
+			NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage;
+			
+			outputOperation->add_layer(sockdata->layer, input->getDataType());
+			
 			if (input->isConnected()) {
 				hasConnections = true;
-				NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage;
-				
-				outputOperation->add_layer(sockdata->layer, input->getDataType());
-				
 				input->relinkConnections(outputOperation->getInputSocket(i));
 			}
 		}

Modified: trunk/blender/source/blender/compositor/operations/COM_OutputFileOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_OutputFileOperation.cpp	2013-09-19 07:58:47 UTC (rev 60232)
+++ trunk/blender/source/blender/compositor/operations/COM_OutputFileOperation.cpp	2013-09-19 08:21:53 UTC (rev 60233)
@@ -184,15 +184,21 @@
 void OutputOpenExrMultiLayerOperation::initExecution()
 {
 	for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
-		this->m_layers[i].imageInput = getInputSocketReader(i);
-		this->m_layers[i].outputBuffer = init_buffer(this->getWidth(), this->getHeight(), this->m_layers[i].datatype);
+		SocketReader *reader = getInputSocketReader(i);
+		this->m_layers[i].imageInput = reader;
+		if (reader)
+			this->m_layers[i].outputBuffer = init_buffer(this->getWidth(), this->getHeight(), this->m_layers[i].datatype);
+		else
+			this->m_layers[i].outputBuffer = NULL;
 	}
 }
 
 void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
 {
 	for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
-		write_buffer_rect(rect, this->m_tree, this->m_layers[i].imageInput, this->m_layers[i].outputBuffer, this->getWidth(), this->m_layers[i].datatype);
+		OutputOpenExrLayer &layer = this->m_layers[i];
+		if (layer.imageInput)
+			write_buffer_rect(rect, this->m_tree, layer.imageInput, layer.outputBuffer, this->getWidth(), layer.datatype);
 	}
 }
 
@@ -210,6 +216,10 @@
 		BLI_make_existing_file(filename);
 		
 		for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
+			OutputOpenExrLayer &layer = this->m_layers[i];
+			if (!layer.imageInput)
+				continue; /* skip unconnected sockets */
+			
 			char channelname[EXR_TOT_MAXNAME];
 			BLI_strncpy(channelname, this->m_layers[i].name, sizeof(channelname) - 2);
 			char *channelname_ext = channelname + strlen(channelname);




More information about the Bf-blender-cvs mailing list