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


C++ OutputSocket类代码示例

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


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

示例1: getbNode

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

	bNode *editorsnode = getbNode();

	
	ColorSpillOperation *operation;
	if (editorsnode->custom2 == 0) {
		// Simple color spill
		operation = new ColorSpillOperation();
	}
	else {
		// Average color spill
		operation = new ColorSpillAverageOperation();
	}
	operation->setSettings((NodeColorspill *)editorsnode->storage);
	operation->setSpillChannel(editorsnode->custom1 - 1); // Channel for spilling
	

	inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
	inputSocketFac->relinkConnections(operation->getInputSocket(1), 1, graph);
	
	outputSocketImage->relinkConnections(operation->getOutputSocket());
	graph->addOperation(operation);
}
开发者ID:244xiao,项目名称:blender,代码行数:28,代码来源:COM_ColorSpillNode.cpp

示例2: switch

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;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:25,代码来源:COM_ImageNode.cpp

示例3: addPreviewOperation

void RenderLayersNode::testSocketConnection(ExecutionSystem *system, CompositorContext *context, int outputSocketNumber, RenderLayersBaseProg *operation)
{
	OutputSocket *outputSocket = this->getOutputSocket(outputSocketNumber);
	Scene *scene = (Scene *)this->getbNode()->id;
	short layerId = this->getbNode()->custom1;

	if (outputSocket->isConnected()) {
		operation->setScene(scene);
		operation->setLayerId(layerId);
		operation->setRenderData(context->getRenderData());
		outputSocket->relinkConnections(operation->getOutputSocket());
		system->addOperation(operation);
		if (outputSocketNumber == 0) { // only do for image socket if connected
			addPreviewOperation(system, context, operation->getOutputSocket());
		}
	}
	else {
		if (outputSocketNumber == 0) {
			system->addOperation(operation);
			operation->setScene(scene);
			operation->setLayerId(layerId);
			operation->setRenderData(context->getRenderData());
			addPreviewOperation(system, context, operation->getOutputSocket());
		}
		else {
			delete operation;
		}
	}
}
开发者ID:244xiao,项目名称:blender,代码行数:29,代码来源:COM_RenderLayersNode.cpp

示例4: convertToOperations

void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	vector<OutputSocket *> &outputsockets = this->getOutputSockets();

	for (unsigned int index = 0; index < outputsockets.size(); index++) {
		OutputSocket *output = outputsockets[index];
		if (output->isConnected()) {
			reconnect(graph, output);
		}
	}
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:11,代码来源:COM_MuteNode.cpp

示例5: switch

void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	InputSocket *inputSocket = this->getInputSocket(0);
	InputSocket *inputImageSocket = this->getInputSocket(1);
	OutputSocket *outputSocket = this->getOutputSocket(0);
	ConvolutionFilterOperation *operation = NULL;
	
	switch (this->getbNode()->custom1) {
		case CMP_FILT_SOFT:
			operation = new ConvolutionFilterOperation();
			operation->set3x3Filter(1 / 16.0f, 2 / 16.0f, 1 / 16.0f, 2 / 16.0f, 4 / 16.0f, 2 / 16.0f, 1 / 16.0f, 2 / 16.0f, 1 / 16.0f);
			break;
		case CMP_FILT_SHARP:
			operation = new ConvolutionFilterOperation();
			operation->set3x3Filter(-1, -1, -1, -1, 9, -1, -1, -1, -1);
			break;
		case CMP_FILT_LAPLACE:
			operation = new ConvolutionFilterOperation();
			operation->set3x3Filter(-1 / 8.0f, -1 / 8.0f, -1 / 8.0f, -1 / 8.0f, 1.0f, -1 / 8.0f, -1 / 8.0f, -1 / 8.0f, -1 / 8.0f);
			break;
		case CMP_FILT_SOBEL:
			operation = new ConvolutionEdgeFilterOperation();
			operation->set3x3Filter(1, 2, 1, 0, 0, 0, -1, -2, -1);
			break;
		case CMP_FILT_PREWITT:
			operation = new ConvolutionEdgeFilterOperation();
			operation->set3x3Filter(1, 1, 1, 0, 0, 0, -1, -1, -1);
			break;
		case CMP_FILT_KIRSCH:
			operation = new ConvolutionEdgeFilterOperation();
			operation->set3x3Filter(5, 5, 5, -3, -3, -3, -2, -2, -2);
			break;
		case CMP_FILT_SHADOW:
			operation = new ConvolutionFilterOperation();
			operation->set3x3Filter(1, 2, 1, 0, 1, 0, -1, -2, -1);
			break;
		default:
			operation = new ConvolutionFilterOperation();
			operation->set3x3Filter(0, 0, 0, 0, 1, 0, 0, 0, 0);
			break;
	}
	operation->setbNode(this->getbNode());
	inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
	inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph);
	outputSocket->relinkConnections(operation->getOutputSocket());
	addPreviewOperation(graph, operation->getOutputSocket(0));
	
	graph->addOperation(operation);
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:49,代码来源:COM_FilterNode.cpp

示例6: ConvertYCCToRGBOperation

void CombineYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	ConvertYCCToRGBOperation *operation = new ConvertYCCToRGBOperation();
	OutputSocket *outputSocket = this->getOutputSocket(0);

	bNode *node = this->getbNode();
	operation->setMode(node->custom1);

	if (outputSocket->isConnected()) {
		outputSocket->relinkConnections(operation->getOutputSocket());
		addLink(graph, outputSocket, operation->getInputSocket(0));
	}

	graph->addOperation(operation);
	CombineRGBANode::convertToOperations(graph, context);
}
开发者ID:244xiao,项目名称:blender,代码行数:16,代码来源:COM_CombineYCCANode.cpp

示例7: DespeckleOperation

void DespeckleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	bNode *editorNode = this->getbNode();
	InputSocket *inputSocket = this->getInputSocket(0);
	InputSocket *inputImageSocket = this->getInputSocket(1);
	OutputSocket *outputSocket = this->getOutputSocket(0);
	DespeckleOperation *operation = new DespeckleOperation();

	operation->setbNode(editorNode);
	operation->setThreshold(editorNode->custom3);
	operation->setThresholdNeighbor(editorNode->custom4);

	inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
	inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph);
	outputSocket->relinkConnections(operation->getOutputSocket());
	addPreviewOperation(graph, context, operation->getOutputSocket(0));

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

示例8: DistanceMatteOperation

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);

	DistanceMatteOperation *operation = new DistanceMatteOperation();
	bNode *editorsnode = getbNode();
	operation->setSettings((NodeChroma *)editorsnode->storage);

	inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
	inputSocketKey->relinkConnections(operation->getInputSocket(1), 1, graph);

	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, operationAlpha->getOutputSocket());

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

示例9: ColorBalanceLGGOperation

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

示例10: getbNode

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

示例11: SocketProxyOperation

void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	OutputSocket *outputsocket = this->getOutputSocket(0);
	InputSocket *inputsocket = this->getInputSocket(0);
	if (outputsocket->isConnected()) {
		if (inputsocket->isConnected()) {
			SocketProxyOperation *operation = new SocketProxyOperation(this->getOutputSocket()->getDataType());
			inputsocket->relinkConnections(operation->getInputSocket(0));
			outputsocket->relinkConnections(operation->getOutputSocket(0));
			graph->addOperation(operation);
		}
		else {
			/* If input is not connected, add a constant value operation instead */
			switch (outputsocket->getDataType()) {
				case COM_DT_VALUE:
				{
					SetValueOperation *operation = new SetValueOperation();
					bNodeSocketValueFloat *dval = (bNodeSocketValueFloat *)inputsocket->getbNodeSocket()->default_value;
					operation->setValue(dval->value);
					outputsocket->relinkConnections(operation->getOutputSocket(0));
					graph->addOperation(operation);
					break;
				}
				case COM_DT_COLOR:
				{
					SetColorOperation *operation = new SetColorOperation();
					bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA *)inputsocket->getbNodeSocket()->default_value;
					operation->setChannels(dval->value);
					outputsocket->relinkConnections(operation->getOutputSocket(0));
					graph->addOperation(operation);
					break;
				}
				case COM_DT_VECTOR:
				{
					SetVectorOperation *operation = new SetVectorOperation();
					bNodeSocketValueVector *dval = (bNodeSocketValueVector *)inputsocket->getbNodeSocket()->default_value;
					operation->setVector(dval->value);
					outputsocket->relinkConnections(operation->getOutputSocket(0));
					graph->addOperation(operation);
					break;
				}
			}
		}
	}
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:45,代码来源:COM_SocketProxyNode.cpp

示例12: ConvertRGBToYCCOperation

void ChromaMatteNode::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);

	ConvertRGBToYCCOperation *operationRGBToYCC_Image = new ConvertRGBToYCCOperation();
	ConvertRGBToYCCOperation *operationRGBToYCC_Key = new ConvertRGBToYCCOperation();
	operationRGBToYCC_Image->setMode(0); /* BLI_YCC_ITU_BT601 */
	operationRGBToYCC_Key->setMode(0); /* BLI_YCC_ITU_BT601 */

	ChromaMatteOperation *operation = new ChromaMatteOperation();
	bNode *editorsnode = getbNode();
	operation->setSettings((NodeChroma *)editorsnode->storage);

	inputSocketImage->relinkConnections(operationRGBToYCC_Image->getInputSocket(0), 0, graph);
	inputSocketKey->relinkConnections(operationRGBToYCC_Key->getInputSocket(0), 0, graph);

	addLink(graph, operationRGBToYCC_Image->getOutputSocket(), operation->getInputSocket(0));
	addLink(graph, operationRGBToYCC_Key->getOutputSocket(), operation->getInputSocket(1));

	graph->addOperation(operationRGBToYCC_Image);
	graph->addOperation(operationRGBToYCC_Key);
	graph->addOperation(operation);

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

	SetAlphaOperation *operationAlpha = new SetAlphaOperation();
	addLink(graph, operationRGBToYCC_Image->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:JasonWilkins,项目名称:blender-wayland,代码行数:41,代码来源:COM_ChromaMatteNode.cpp

示例13: switch

void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	InputSocket *valueSocket = this->getInputSocket(0);
	InputSocket *color1Socket = this->getInputSocket(1);
	InputSocket *color2Socket = this->getInputSocket(2);
	OutputSocket *outputSocket = this->getOutputSocket(0);
	bNode *editorNode = this->getbNode();
	bool useAlphaPremultiply = this->getbNode()->custom2 & 1;
	bool useClamp = this->getbNode()->custom2 & 2;
	
	MixBaseOperation *convertProg;
	
	switch (editorNode->custom1) {
		case MA_RAMP_ADD:
			convertProg = new MixAddOperation();
			break;
		case MA_RAMP_MULT:
			convertProg = new MixMultiplyOperation();
			break;
		case MA_RAMP_LIGHT:
			convertProg = new MixLightenOperation();
			break;
		case MA_RAMP_BURN:
			convertProg = new MixBurnOperation();
			break;
		case MA_RAMP_HUE:
			convertProg = new MixHueOperation();
			break;
		case MA_RAMP_COLOR:
			convertProg = new MixColorOperation();
			break;
		case MA_RAMP_SOFT:
			convertProg = new MixSoftLightOperation();
			break;
		case MA_RAMP_SCREEN:
			convertProg = new MixScreenOperation();
			break;
		case MA_RAMP_LINEAR:
			convertProg = new MixLinearLightOperation();
			break;
		case MA_RAMP_DIFF:
			convertProg = new MixDifferenceOperation();
			break;
		case MA_RAMP_SAT:
			convertProg = new MixSaturationOperation();
			break;
		case MA_RAMP_DIV:
			convertProg = new MixDivideOperation();
			break;
		case MA_RAMP_SUB:
			convertProg = new MixSubtractOperation();
			break;
		case MA_RAMP_DARK:
			convertProg = new MixDarkenOperation();
			break;
		case MA_RAMP_OVERLAY:
			convertProg = new MixOverlayOperation();
			break;
		case MA_RAMP_VAL:
			convertProg = new MixValueOperation();
			break;
		case MA_RAMP_DODGE:
			convertProg = new MixDodgeOperation();
			break;

		case MA_RAMP_BLEND:
		default:
			convertProg = new MixBlendOperation();
			break;
	}
	convertProg->setUseValueAlphaMultiply(useAlphaPremultiply);
	convertProg->setUseClamp(useClamp);

	if (color1Socket->isConnected()) {
		convertProg->setResolutionInputSocketIndex(1);
	}
	else {
		if (color2Socket->isConnected())
			convertProg->setResolutionInputSocketIndex(2);
		else
			convertProg->setResolutionInputSocketIndex(0);
	}

	valueSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph);
	color1Socket->relinkConnections(convertProg->getInputSocket(1), 1, graph);
	color2Socket->relinkConnections(convertProg->getInputSocket(2), 2, graph);
	outputSocket->relinkConnections(convertProg->getOutputSocket(0));
	addPreviewOperation(graph, context, convertProg->getOutputSocket(0));
	
	convertProg->getInputSocket(2)->setResizeMode(color2Socket->getResizeMode());
	
	graph->addOperation(convertProg);
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:93,代码来源:COM_MixNode.cpp

示例14: BKE_image_user_frame_calc

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: BKE_image_user_frame_calc

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();
	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) {
				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();
						/* 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
						int passindex;
						RenderPass *rpass;
						for (rpass = (RenderPass *)rl->passes.first, passindex = 0; rpass; rpass = rpass->next, ++passindex)
							if (STREQ(rpass->name, bnodeSocket->identifier))
								break;
						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);
					}
				}
			}
开发者ID:diosney,项目名称:blender,代码行数:73,代码来源:COM_ImageNode.cpp


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