NodeOperation *ImageNode::doMultilayerCheck(ExecutionSystem *system, RenderLayer *rl, Image *image, ImageUser *user, int framenumber, int outputsocketIndex, int pass, DataType datatype)
{
	OutputSocket *outputSocket = this->getOutputSocket(outputsocketIndex);
	MultilayerBaseOperation *operation = NULL;
	switch (datatype) {
		case COM_DT_VALUE:
			operation = new MultilayerValueOperation(pass);
			break;
		case COM_DT_VECTOR:
			operation = new MultilayerVectorOperation(pass);
			break;
		case COM_DT_COLOR:
			operation = new MultilayerColorOperation(pass);
			break;
		default:
			break;
	}
	operation->setImage(image);
	operation->setRenderLayer(rl);
	operation->setImageUser(user);
	operation->setFramenumber(framenumber);
	outputSocket->relinkConnections(operation->getOutputSocket());
	system->addOperation(operation);
	return operation;
}
NodeOperation *ImageNode::doMultilayerCheck(NodeConverter &converter, RenderLayer *rl, Image *image, ImageUser *user,
                                            int framenumber, int outputsocketIndex, int passindex, DataType datatype) const
{
	NodeOutput *outputSocket = this->getOutputSocket(outputsocketIndex);
	MultilayerBaseOperation *operation = NULL;
	switch (datatype) {
		case COM_DT_VALUE:
			operation = new MultilayerValueOperation(passindex);
			break;
		case COM_DT_VECTOR:
			operation = new MultilayerVectorOperation(passindex);
			break;
		case COM_DT_COLOR:
			operation = new MultilayerColorOperation(passindex);
			break;
		default:
			break;
	}
	operation->setImage(image);
	operation->setRenderLayer(rl);
	operation->setImageUser(user);
	operation->setFramenumber(framenumber);
	
	converter.addOperation(operation);
	converter.mapOutputSocket(outputSocket, operation->getOutputSocket());
	
	return operation;
}