当前位置: 首页>>代码示例>>C++>>正文


C++ NodeOperation::getOutputSocket方法代码示例

本文整理汇总了C++中NodeOperation::getOutputSocket方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeOperation::getOutputSocket方法的具体用法?C++ NodeOperation::getOutputSocket怎么用?C++ NodeOperation::getOutputSocket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NodeOperation的用法示例。


在下文中一共展示了NodeOperation::getOutputSocket方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: convertToOperations

void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	InputSocket *inputSocketImage = this->getInputSocket(0);
	InputSocket *inputSocketKey = this->getInputSocket(1);
	OutputSocket *outputSocketImage = this->getOutputSocket(0);
	OutputSocket *outputSocketMatte = this->getOutputSocket(1);

	NodeOperation *operation;
	bNode *editorsnode = getbNode();
	NodeChroma *storage = (NodeChroma *)editorsnode->storage;

	/* work in RGB color space */
	if (storage->channel == 1) {
		operation = new DistanceRGBMatteOperation();
		((DistanceRGBMatteOperation *) operation)->setSettings(storage);

		inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
		inputSocketKey->relinkConnections(operation->getInputSocket(1), 1, graph);
	}
	/* work in YCbCr color space */
	else {
		operation = new DistanceYCCMatteOperation();
		((DistanceYCCMatteOperation *) operation)->setSettings(storage);

		ConvertRGBToYCCOperation *operationYCCImage = new ConvertRGBToYCCOperation();
		inputSocketImage->relinkConnections(operationYCCImage->getInputSocket(0), 0, graph);
		addLink(graph, operationYCCImage->getOutputSocket(), operation->getInputSocket(0));
		graph->addOperation(operationYCCImage);

		ConvertRGBToYCCOperation *operationYCCMatte = new ConvertRGBToYCCOperation();
		inputSocketKey->relinkConnections(operationYCCMatte->getInputSocket(0), 1, graph);
		addLink(graph, operationYCCMatte->getOutputSocket(), operation->getInputSocket(1));
		graph->addOperation(operationYCCMatte);
	}

	if (outputSocketMatte->isConnected()) {
		outputSocketMatte->relinkConnections(operation->getOutputSocket());
	}

	graph->addOperation(operation);

	SetAlphaOperation *operationAlpha = new SetAlphaOperation();
	addLink(graph, operation->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
	addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));

	graph->addOperation(operationAlpha);
	addPreviewOperation(graph, context, operationAlpha->getOutputSocket());

	if (outputSocketImage->isConnected()) {
		outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
	}
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:52,代码来源:COM_DistanceMatteNode.cpp

示例2: missingSocketLink

void RenderLayersNode::missingSocketLink(NodeConverter &converter,
                                         NodeOutput *output) const
{
	NodeOperation *operation;
	switch (output->getDataType()) {
		case COM_DT_COLOR:
		{
			const float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
			SetColorOperation *color_operation = new SetColorOperation();
			color_operation->setChannels(color);
			operation = color_operation;
			break;
		}
		case COM_DT_VECTOR:
		{
			const float vector[3] = {0.0f, 0.0f, 0.0f};
			SetVectorOperation *vector_operation = new SetVectorOperation();
			vector_operation->setVector(vector);
			operation = vector_operation;
			break;
		}
		case COM_DT_VALUE:
		{
			SetValueOperation *value_operation = new SetValueOperation();
			value_operation->setValue(0.0f);
			operation = value_operation;
			break;
		}
	}

	converter.mapOutputSocket(output, operation->getOutputSocket());
	converter.addOperation(operation);
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:33,代码来源:COM_RenderLayersNode.cpp

示例3: add_datatype_conversions

void NodeOperationBuilder::add_datatype_conversions()
{
	Links convert_links;
	for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) {
		const Link &link = *it;
		
		/* proxy operations can skip data type conversion */
		NodeOperation *from_op = &link.from()->getOperation();
		NodeOperation *to_op = &link.to()->getOperation();
		if (!(from_op->useDatatypeConversion() || to_op->useDatatypeConversion()))
			continue;
		
		if (link.from()->getDataType() != link.to()->getDataType())
			convert_links.push_back(link);
	}
	for (Links::const_iterator it = convert_links.begin(); it != convert_links.end(); ++it) {
		const Link &link = *it;
		NodeOperation *converter = Converter::convertDataType(link.from(), link.to());
		if (converter) {
			addOperation(converter);
			
			removeInputLink(link.to());
			addLink(link.from(), converter->getInputSocket(0));
			addLink(converter->getOutputSocket(0), link.to());
		}
	}
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:27,代码来源:COM_NodeOperationBuilder.cpp

示例4: convertToOperations

void ColorBalanceNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const
{
	

	
	

	bNode *editorsnode = getbNode();
	NodeColorBalance *n = (NodeColorBalance *)editorsnode->storage;

	NodeInput *inputSocketImage = this->getInputSocket(0);
	NodeInput *inputSocketKey = this->getInputSocket(1);
	NodeOutput *outputSocketImage = this->getOutputSocket(0);
	NodeOutput *outputSocketMatte = this->getOutputSocket(1);
	
	ConvertRGBToHSVOperation *operationRGBToHSV_Image = new ConvertRGBToHSVOperation();
	ConvertRGBToHSVOperation *operationRGBToHSV_Key = new ConvertRGBToHSVOperation();
	converter.addOperation(operationRGBToHSV_Image);
	converter.addOperation(operationRGBToHSV_Key);
	
	NodeOperation *operation;
	ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation();
	operationLGG->setGain(n->gain);
	operation = operationLGG;
	converter.addOperation(operation);
	
	SetAlphaOperation *operationAlpha = new SetAlphaOperation();
	converter.addOperation(operationAlpha);
	
	converter.mapInputSocket(inputSocketImage, operationRGBToHSV_Image->getInputSocket(0));
	converter.mapInputSocket(inputSocketKey, operationRGBToHSV_Key->getInputSocket(0));
	converter.addLink(operationRGBToHSV_Image->getOutputSocket(), operation->getInputSocket(0));
	converter.addLink(operationRGBToHSV_Key->getOutputSocket(), operation->getInputSocket(1));
	converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0));
	
	converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0));
	converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1));
	converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket());
	
	converter.addPreview(operationAlpha->getOutputSocket());

}
开发者ID:pawkoz,项目名称:dyplom,代码行数:42,代码来源:COM_ColorBalanceNode.cpp

示例5: convertToOperations

void ChannelMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
	bNode *node = this->getbNode();
	
	NodeInput *inputSocketImage = this->getInputSocket(0);
	NodeOutput *outputSocketImage = this->getOutputSocket(0);
	NodeOutput *outputSocketMatte = this->getOutputSocket(1);
	
	NodeOperation *convert = NULL;
	/* colorspace */
	switch (node->custom1) {
		case CMP_NODE_CHANNEL_MATTE_CS_RGB:
			break;
		case CMP_NODE_CHANNEL_MATTE_CS_HSV: /* HSV */
			convert = new ConvertRGBToHSVOperation();
			break;
		case CMP_NODE_CHANNEL_MATTE_CS_YUV: /* YUV */
			convert = new ConvertRGBToYUVOperation();
			break;
		case CMP_NODE_CHANNEL_MATTE_CS_YCC: /* YCC */
			convert = new ConvertRGBToYCCOperation();
			((ConvertRGBToYCCOperation *)convert)->setMode(0); /* BLI_YCC_ITU_BT601 */
			break;
		default:
			break;
	}
	
	ChannelMatteOperation *operation = new ChannelMatteOperation();
	/* pass the ui properties to the operation */
	operation->setSettings((NodeChroma *)node->storage, node->custom2);
	converter.addOperation(operation);
	
	SetAlphaOperation *operationAlpha = new SetAlphaOperation();
	converter.addOperation(operationAlpha);
	
	if (convert) {
		converter.addOperation(convert);
		
		converter.mapInputSocket(inputSocketImage, convert->getInputSocket(0));
		converter.addLink(convert->getOutputSocket(), operation->getInputSocket(0));
		converter.addLink(convert->getOutputSocket(), operationAlpha->getInputSocket(0));
	}
	else {
		converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0));
		converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0));
	}
	
	converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0));
	
	converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1));
	converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket());
	
	converter.addPreview(operationAlpha->getOutputSocket());
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:54,代码来源:COM_ChannelMatteNode.cpp

示例6: reconnect

void MuteNode::reconnect(ExecutionSystem *graph, OutputSocket *output)
{
	vector<InputSocket *> &inputsockets = this->getInputSockets();
	for (unsigned int index = 0; index < inputsockets.size(); index++) {
		InputSocket *input = inputsockets[index];
		if (input->getDataType() == output->getDataType()) {
			if (input->isConnected()) {
				output->relinkConnections(input->getConnection()->getFromSocket(), false);
				return;
			}
		}
	}
	
	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(), false);
		graph->addOperation(operation);
	}

	output->clearConnections();
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:50,代码来源:COM_MuteNode.cpp

示例7: convertToOperations

void ConvertAlphaNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
	NodeOperation *operation = NULL;
	bNode *node = this->getbNode();

	/* value hardcoded in rna_nodetree.c */
	if (node->custom1 == 1) {
		operation = new ConvertPremulToStraightOperation();
	}
	else {
		operation = new ConvertStraightToPremulOperation();
	}
	
	converter.addOperation(operation);
	
	converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
	converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket());
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:18,代码来源:COM_ConvertAlphaNode.cpp

示例8: convertToOperations

void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	NodeOperation *operation = NULL;
	bNode *node = this->getbNode();

	/* value hardcoded in rna_nodetree.c */
	if (node->custom1 == 1) {
		operation = new ConvertPremulToStraightOperation();
	}
	else {
		operation = new ConvertStraightToPremulOperation();
	}

	this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
	this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());

	graph->addOperation(operation);
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:18,代码来源:COM_ConvertAlphaNode.cpp

示例9: convertToOperations

void ColorBalanceNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const
{
	bNode *node = this->getbNode();
	NodeColorBalance *n = (NodeColorBalance *)node->storage;

	NodeInput *inputSocket = this->getInputSocket(0);
	NodeInput *inputImageSocket = this->getInputSocket(1);
	NodeOutput *outputSocket = this->getOutputSocket(0);

	NodeOperation *operation;
	if (node->custom1 == 0) {
		ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation();

		float lift_lgg[3], gamma_inv[3];
		for (int c = 0; c < 3; c++) {
			lift_lgg[c] = 2.0f - n->lift[c];
			gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f;
		}

		operationLGG->setGain(n->gain);
		operationLGG->setLift(lift_lgg);
		operationLGG->setGammaInv(gamma_inv);
		operation = operationLGG;
	}
	else {
		ColorBalanceASCCDLOperation *operationCDL = new ColorBalanceASCCDLOperation();

		float offset[3];
		copy_v3_fl(offset, n->offset_basis);
		add_v3_v3(offset, n->offset);

		operationCDL->setOffset(offset);
		operationCDL->setPower(n->power);
		operationCDL->setSlope(n->slope);
		operation = operationCDL;
	}
	converter.addOperation(operation);

	converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
	converter.mapInputSocket(inputImageSocket, operation->getInputSocket(1));
	converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:42,代码来源:COM_ColorBalanceNode.cpp

示例10: add_complex_operation_buffers

void NodeOperationBuilder::add_complex_operation_buffers()
{
	/* note: complex ops and get cached here first, since adding operations
	 * will invalidate iterators over the main m_operations
	 */
	Operations complex_ops;
	for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it)
		if ((*it)->isComplex())
			complex_ops.push_back(*it);
	
	for (Operations::const_iterator it = complex_ops.begin(); it != complex_ops.end(); ++it) {
		NodeOperation *op = *it;
		
		DebugInfo::operation_read_write_buffer(op);
		
		for (int index = 0; index < op->getNumberOfInputSockets(); index++)
			add_input_buffers(op, op->getInputSocket(index));
		
		for (int index = 0; index < op->getNumberOfOutputSockets(); index++)
			add_output_buffers(op, op->getOutputSocket(index));
	}
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:22,代码来源:COM_NodeOperationBuilder.cpp

示例11: convertToOperations

void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	InputSocket *inputSocket = this->getInputSocket(0);
	InputSocket *inputImageSocket = this->getInputSocket(1);
	OutputSocket *outputSocket = this->getOutputSocket(0);
	
	bNode *node = this->getbNode();
	NodeColorBalance *n = (NodeColorBalance *)node->storage;
	NodeOperation *operation;
	if (node->custom1 == 0) {
		ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation();
		{
			int c;
	
			for (c = 0; c < 3; c++) {
				n->lift_lgg[c] = 2.0f - n->lift[c];
				n->gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f;
			}
		}
	
		operationLGG->setGain(n->gain);
		operationLGG->setLift(n->lift_lgg);
		operationLGG->setGammaInv(n->gamma_inv);
		operation = operationLGG;
	}
	else {
		ColorBalanceASCCDLOperation *operationCDL = new ColorBalanceASCCDLOperation();
		operationCDL->setGain(n->gain);
		operationCDL->setLift(n->lift);
		operationCDL->setGamma(n->gamma);
		operation = operationCDL;
	}
	
	inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
	inputImageSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
	outputSocket->relinkConnections(operation->getOutputSocket(0));
	graph->addOperation(operation);
}
开发者ID:244xiao,项目名称:blender,代码行数:38,代码来源:COM_ColorBalanceNode.cpp

示例12: convertToOperations

void ZCombineNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
	if ((context.getRenderData()->scemode & R_FULL_SAMPLE) || this->getbNode()->custom2) {
		ZCombineOperation *operation = NULL;
		if (this->getbNode()->custom1) {
			operation = new ZCombineAlphaOperation();
		}
		else {
			operation = new ZCombineOperation();
		}
		converter.addOperation(operation);
		
		converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
		converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
		converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2));
		converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3));
		converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket());
		
		MathMinimumOperation *zoperation = new MathMinimumOperation();
		converter.addOperation(zoperation);
		
		converter.mapInputSocket(getInputSocket(1), zoperation->getInputSocket(0));
		converter.mapInputSocket(getInputSocket(3), zoperation->getInputSocket(1));
		converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket());
	}
	else {
		/* XXX custom1 is "use_alpha", what on earth is this supposed to do here?!? */
		// not full anti alias, use masking for Z combine. be aware it uses anti aliasing.
		// step 1 create mask
		NodeOperation *maskoperation;
		if (this->getbNode()->custom1) {
			maskoperation = new MathGreaterThanOperation();
			converter.addOperation(maskoperation);
			
			converter.mapInputSocket(getInputSocket(1), maskoperation->getInputSocket(0));
			converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1));
		}
		else {
			maskoperation = new MathLessThanOperation();
			converter.addOperation(maskoperation);
			
			converter.mapInputSocket(getInputSocket(1), maskoperation->getInputSocket(0));
			converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1));
		}

		// step 2 anti alias mask bit of an expensive operation, but does the trick
		AntiAliasOperation *antialiasoperation = new AntiAliasOperation();
		converter.addOperation(antialiasoperation);
		
		converter.addLink(maskoperation->getOutputSocket(), antialiasoperation->getInputSocket(0));

		// use mask to blend between the input colors.
		ZCombineMaskOperation *zcombineoperation = this->getbNode()->custom1 ? new ZCombineMaskAlphaOperation() : new ZCombineMaskOperation();
		converter.addOperation(zcombineoperation);
		
		converter.addLink(antialiasoperation->getOutputSocket(), zcombineoperation->getInputSocket(0));
		converter.mapInputSocket(getInputSocket(0), zcombineoperation->getInputSocket(1));
		converter.mapInputSocket(getInputSocket(2), zcombineoperation->getInputSocket(2));
		converter.mapOutputSocket(getOutputSocket(0), zcombineoperation->getOutputSocket());

		MathMinimumOperation *zoperation = new MathMinimumOperation();
		converter.addOperation(zoperation);
		
		converter.mapInputSocket(getInputSocket(1), zoperation->getInputSocket(0));
		converter.mapInputSocket(getInputSocket(3), zoperation->getInputSocket(1));
		converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket());
	}
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:68,代码来源:COM_ZCombineNode.cpp

示例13: convertToOperations

void ZCombineNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
{
	if ((context->getRenderData()->scemode & R_FULL_SAMPLE) || this->getbNode()->custom2) {
		if (this->getOutputSocket(0)->isConnected()) {
			ZCombineOperation *operation = NULL;
			if (this->getbNode()->custom1) {
				operation = new ZCombineAlphaOperation();
			}
			else {
				operation = new ZCombineOperation();
			}

			this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
			this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, system);
			this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, system);
			this->getInputSocket(3)->relinkConnections(operation->getInputSocket(3), 3, system);
			this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
			system->addOperation(operation);
			if (this->getOutputSocket(1)->isConnected()) {
				MathMinimumOperation *zoperation = new MathMinimumOperation();
				addLink(system, operation->getInputSocket(1)->getConnection()->getFromSocket(), zoperation->getInputSocket(0));
				addLink(system, operation->getInputSocket(3)->getConnection()->getFromSocket(), zoperation->getInputSocket(1));
				this->getOutputSocket(1)->relinkConnections(zoperation->getOutputSocket());
				system->addOperation(zoperation);
			}
		}
		else {
			if (this->getOutputSocket(1)->isConnected()) {
				MathMinimumOperation *zoperation = new MathMinimumOperation();
				this->getInputSocket(1)->relinkConnections(zoperation->getInputSocket(0), 1, system);
				this->getInputSocket(3)->relinkConnections(zoperation->getInputSocket(1), 3, system);
				this->getOutputSocket(1)->relinkConnections(zoperation->getOutputSocket());
				system->addOperation(zoperation);
			}
		}
	}
	else {
		// not full anti alias, use masking for Z combine. be aware it uses anti aliasing.
		// step 1 create mask
		NodeOperation *maskoperation;

		if (this->getbNode()->custom1) {
			maskoperation = new MathGreaterThanOperation();
			this->getInputSocket(1)->relinkConnections(maskoperation->getInputSocket(0), 3, system);
			this->getInputSocket(3)->relinkConnections(maskoperation->getInputSocket(1), 1, system);
		}
		else {
			maskoperation = new MathLessThanOperation();
			this->getInputSocket(1)->relinkConnections(maskoperation->getInputSocket(0), 1, system);
			this->getInputSocket(3)->relinkConnections(maskoperation->getInputSocket(1), 3, system);
		}

		// step 2 anti alias mask bit of an expensive operation, but does the trick
		AntiAliasOperation *antialiasoperation = new AntiAliasOperation();
		addLink(system, maskoperation->getOutputSocket(), antialiasoperation->getInputSocket(0));

		// use mask to blend between the input colors.
		ZCombineMaskOperation *zcombineoperation = this->getbNode()->custom1?new ZCombineMaskAlphaOperation():new ZCombineMaskOperation();
		addLink(system, antialiasoperation->getOutputSocket(), zcombineoperation->getInputSocket(0));
		this->getInputSocket(0)->relinkConnections(zcombineoperation->getInputSocket(1), 0, system);
		this->getInputSocket(2)->relinkConnections(zcombineoperation->getInputSocket(2), 2, system);
		this->getOutputSocket(0)->relinkConnections(zcombineoperation->getOutputSocket());

		system->addOperation(maskoperation);
		system->addOperation(antialiasoperation);
		system->addOperation(zcombineoperation);

		if (this->getOutputSocket(1)->isConnected()) {
			MathMinimumOperation *zoperation = new MathMinimumOperation();
			addLink(system, maskoperation->getInputSocket(0)->getConnection()->getFromSocket(), zoperation->getInputSocket(0));
			addLink(system, maskoperation->getInputSocket(1)->getConnection()->getFromSocket(), zoperation->getInputSocket(1));
			this->getOutputSocket(1)->relinkConnections(zoperation->getOutputSocket());
			system->addOperation(zoperation);
		}
	}
}
开发者ID:244xiao,项目名称:blender,代码行数:76,代码来源:COM_ZCombineNode.cpp

示例14: convertToOperations

void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	/// Image output
	OutputSocket *outputImage = this->getOutputSocket(0);
	bNode *editorNode = this->getbNode();
	Image *image = (Image *)editorNode->id;
	ImageUser *imageuser = (ImageUser *)editorNode->storage;
	int framenumber = context->getFramenumber();
	int numberOfOutputs = this->getNumberOfOutputSockets();
	BKE_image_user_frame_calc(imageuser, context->getFramenumber(), 0);

	/* force a load, we assume iuser index will be set OK anyway */
	if (image && image->type == IMA_TYPE_MULTILAYER) {
		bool is_multilayer_ok = false;
		ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL);
		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++) {
					NodeOperation *operation = NULL;
					socket = this->getOutputSocket(index);
					if (socket->isConnected() || index == 0) {
						bNodeSocket *bnodeSocket = socket->getbNodeSocket();
						NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;
						int passindex = storage->pass_index;
						
						RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
						if (rpass) {
							imageuser->pass = passindex;
							switch (rpass->channels) {
								case 1:
									operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VALUE);
									break;
								/* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
								/* XXX any way to detect actual vector images? */
								case 3:
									operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VECTOR);
									break;
								case 4:
									operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
									break;
								default:
									/* 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);
					}
				}
			}
		}
		BKE_image_release_ibuf(image, ibuf, NULL);

		/* without this, multilayer that fail to load will crash blender [#32490] */
		if (is_multilayer_ok == false) {
			convertToOperations_invalid(graph, context);
		}
	}
	else {
		if (numberOfOutputs >  0) {
			ImageOperation *operation = new ImageOperation();
			if (outputImage->isConnected()) {
				outputImage->relinkConnections(operation->getOutputSocket());
			}
			operation->setImage(image);
			operation->setImageUser(imageuser);
			operation->setFramenumber(framenumber);
			graph->addOperation(operation);
			addPreviewOperation(graph, context, operation->getOutputSocket());
		}
		
		if (numberOfOutputs > 1) {
			OutputSocket *alphaImage = this->getOutputSocket(1);
			if (alphaImage->isConnected()) {
				ImageAlphaOperation *alphaOperation = new ImageAlphaOperation();
				alphaOperation->setImage(image);
				alphaOperation->setImageUser(imageuser);
				alphaOperation->setFramenumber(framenumber);
				alphaImage->relinkConnections(alphaOperation->getOutputSocket());
				graph->addOperation(alphaOperation);
			}
		}
		if (numberOfOutputs > 2) {
			OutputSocket *depthImage = this->getOutputSocket(2);
			if (depthImage->isConnected()) {
				ImageDepthOperation *depthOperation = new ImageDepthOperation();
				depthOperation->setImage(image);
//.........这里部分代码省略.........
开发者ID:danielmarg,项目名称:blender-main,代码行数:101,代码来源:COM_ImageNode.cpp

示例15: convertToOperations

void ImageNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
	/// Image output
	NodeOutput *outputImage = this->getOutputSocket(0);
	bNode *editorNode = this->getbNode();
	Image *image = (Image *)editorNode->id;
	ImageUser *imageuser = (ImageUser *)editorNode->storage;
	int framenumber = context.getFramenumber();
	int numberOfOutputs = this->getNumberOfOutputSockets();
	bool outputStraightAlpha = (editorNode->custom1 & CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0;
	BKE_image_user_frame_calc(imageuser, context.getFramenumber(), 0);
	/* force a load, we assume iuser index will be set OK anyway */
	if (image && image->type == IMA_TYPE_MULTILAYER) {
		bool is_multilayer_ok = false;
		ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL);
		if (image->rr) {
			RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
			if (rl) {
				NodeOutput *socket;
				int index;

				is_multilayer_ok = true;

				for (index = 0; index < numberOfOutputs; index++) {
					NodeOperation *operation = NULL;
					socket = this->getOutputSocket(index);
					bNodeSocket *bnodeSocket = socket->getbNodeSocket();
					RenderPass *rpass = (RenderPass *)BLI_findstring(&rl->passes, bnodeSocket->identifier, offsetof(RenderPass, internal_name));
					int view = 0;

					/* Passes in the file can differ from passes stored in sockets (#36755).
					 * Look up the correct file pass using the socket identifier instead.
					 */
#if 0
					NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;*/
					int passindex = storage->pass_index;*/
					RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
#endif

					/* returns the image view to use for the current active view */
					if (BLI_listbase_count_ex(&image->rr->views, 2) > 1) {
						const int view_image = imageuser->view;
						const bool is_allview = (view_image == 0); /* if view selected == All (0) */

						if (is_allview) {
							/* heuristic to match image name with scene names
							 * check if the view name exists in the image */
							view = BLI_findstringindex(&image->rr->views, context.getViewName(), offsetof(RenderView, name));
							if (view == -1) view = 0;
						}
						else {
							view = view_image - 1;
						}
					}

					if (rpass) {
						switch (rpass->channels) {
							case 1:
								operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index,
								                              rpass->passtype, view, COM_DT_VALUE);
								break;
								/* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
								/* XXX any way to detect actual vector images? */
							case 3:
								operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index,
								                              rpass->passtype, view, COM_DT_VECTOR);
								break;
							case 4:
								operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index,
								                              rpass->passtype, view, COM_DT_COLOR);
								break;
							default:
								/* dummy operation is added below */
								break;
						}
						if (index == 0 && operation) {
							converter.addPreview(operation->getOutputSocket());
						}
						if (rpass->passtype == SCE_PASS_COMBINED) {
							BLI_assert(operation != NULL);
							BLI_assert(index < numberOfOutputs - 1);
							NodeOutput *outputSocket = this->getOutputSocket(index + 1);
							SeparateChannelOperation *separate_operation;
							separate_operation = new SeparateChannelOperation();
							separate_operation->setChannel(3);
							converter.addOperation(separate_operation);
							converter.addLink(operation->getOutputSocket(), separate_operation->getInputSocket(0));
							converter.mapOutputSocket(outputSocket, separate_operation->getOutputSocket());
							index++;
						}
					}

					/* incase we can't load the layer */
					if (operation == NULL)
						converter.setInvalidOutput(getOutputSocket(index));
				}
			}
		}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:98,代码来源:COM_ImageNode.cpp


注:本文中的NodeOperation::getOutputSocket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。