[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53652] trunk/blender/source/blender/ compositor/nodes/COM_ImageNode.cpp: Fix #33804: Blender crash unlinking multilayer exr image in image node

Sergey Sharybin sergey.vfx at gmail.com
Tue Jan 8 09:39:34 CET 2013


Revision: 53652
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53652
Author:   nazgul
Date:     2013-01-08 08:39:28 +0000 (Tue, 08 Jan 2013)
Log Message:
-----------
Fix #33804: Blender crash unlinking multilayer exr image in image node

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp

Modified: trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp	2013-01-08 07:36:22 UTC (rev 53651)
+++ trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp	2013-01-08 08:39:28 UTC (rev 53652)
@@ -28,6 +28,10 @@
 #include "BKE_node.h"
 #include "BLI_utildefines.h"
 
+#include "COM_SetValueOperation.h"
+#include "COM_SetVectorOperation.h"
+#include "COM_SetColorOperation.h"
+
 ImageNode::ImageNode(bNode *editorNode) : Node(editorNode)
 {
 	/* pass */
@@ -165,6 +169,46 @@
 				graph->addOperation(depthOperation);
 			}
 		}
+		if (numberOfOutputs > 3) {
+			/* happens when unlinking image datablock from multilayer node */
+			for (int i = 3; i < numberOfOutputs; i++) {
+				OutputSocket *output = this->getOutputSocket(i);
+				NodeOperation *operation = NULL;
+				switch (output->getDataType()) {
+					case COM_DT_VALUE:
+					{
+						SetValueOperation *valueoperation = new SetValueOperation();
+						valueoperation->setValue(0.0f);
+						operation = valueoperation;
+						break;
+					}
+					case COM_DT_VECTOR:
+					{
+						SetVectorOperation *vectoroperation = new SetVectorOperation();
+						vectoroperation->setX(0.0f);
+						vectoroperation->setY(0.0f);
+						vectoroperation->setW(0.0f);
+						operation = vectoroperation;
+						break;
+					}
+					case COM_DT_COLOR:
+					{
+						SetColorOperation *coloroperation = new SetColorOperation();
+						coloroperation->setChannel1(0.0f);
+						coloroperation->setChannel2(0.0f);
+						coloroperation->setChannel3(0.0f);
+						coloroperation->setChannel4(0.0f);
+						operation = coloroperation;
+						break;
+					}
+				}
+
+				if (operation) {
+					output->relinkConnections(operation->getOutputSocket());
+					graph->addOperation(operation);
+				}
+			}
+		}
 	}
 }
 




More information about the Bf-blender-cvs mailing list