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


C++ CompositorContext::getRenderData方法代码示例

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


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

示例1: convertToOperations

void CompositorNode::convertToOperations(NodeConverter &converter,
                                         const CompositorContext &context) const
{
  bNode *editorNode = this->getbNode();
  bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC) || context.isRendering();
  bool ignore_alpha = (editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0;

  NodeInput *imageSocket = this->getInputSocket(0);
  NodeInput *alphaSocket = this->getInputSocket(1);
  NodeInput *depthSocket = this->getInputSocket(2);

  CompositorOperation *compositorOperation = new CompositorOperation();
  compositorOperation->setScene(context.getScene());
  compositorOperation->setSceneName(context.getScene()->id.name);
  compositorOperation->setRenderData(context.getRenderData());
  compositorOperation->setViewName(context.getViewName());
  compositorOperation->setbNodeTree(context.getbNodeTree());
  /* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */
  compositorOperation->setUseAlphaInput(ignore_alpha || alphaSocket->isLinked());
  compositorOperation->setActive(is_active);

  converter.addOperation(compositorOperation);
  converter.mapInputSocket(imageSocket, compositorOperation->getInputSocket(0));
  /* only use alpha link if "use alpha" is enabled */
  if (ignore_alpha) {
    converter.addInputValue(compositorOperation->getInputSocket(1), 1.0f);
  }
  else {
    converter.mapInputSocket(alphaSocket, compositorOperation->getInputSocket(1));
  }
  converter.mapInputSocket(depthSocket, compositorOperation->getInputSocket(2));

  converter.addNodeInputPreview(imageSocket);
}
开发者ID:dfelinto,项目名称:blender,代码行数:34,代码来源:COM_CompositorNode.cpp

示例2: testSocketLink

void RenderLayersNode::testSocketLink(NodeConverter &converter,
                                      const CompositorContext &context,
                                      NodeOutput *output,
                                      RenderLayersProg *operation,
                                      Scene *scene,
                                      int layerId,
                                      bool is_preview) const
{
	operation->setScene(scene);
	operation->setLayerId(layerId);
	operation->setRenderData(context.getRenderData());
	operation->setViewName(context.getViewName());

	converter.mapOutputSocket(output, operation->getOutputSocket());
	converter.addOperation(operation);

	if (is_preview) /* only for image socket */
		converter.addPreview(operation->getOutputSocket());
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:19,代码来源:COM_RenderLayersNode.cpp

示例3: convertToOperations

void BoxMaskNode::convertToOperations(NodeConverter &converter,
                                      const CompositorContext &context) const
{
  NodeInput *inputSocket = this->getInputSocket(0);
  NodeOutput *outputSocket = this->getOutputSocket(0);

  BoxMaskOperation *operation;
  operation = new BoxMaskOperation();
  operation->setData((NodeBoxMask *)this->getbNode()->storage);
  operation->setMaskType(this->getbNode()->custom1);
  converter.addOperation(operation);

  if (inputSocket->isLinked()) {
    converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
    converter.mapOutputSocket(outputSocket, operation->getOutputSocket());
  }
  else {
    /* Value operation to produce original transparent image */
    SetValueOperation *valueOperation = new SetValueOperation();
    valueOperation->setValue(0.0f);
    converter.addOperation(valueOperation);

    /* Scale that image up to render resolution */
    const RenderData *rd = context.getRenderData();
    ScaleFixedSizeOperation *scaleOperation = new ScaleFixedSizeOperation();

    scaleOperation->setIsAspect(false);
    scaleOperation->setIsCrop(false);
    scaleOperation->setOffset(0.0f, 0.0f);
    scaleOperation->setNewWidth(rd->xsch * rd->size / 100.0f);
    scaleOperation->setNewHeight(rd->ysch * rd->size / 100.0f);
    scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE);
    converter.addOperation(scaleOperation);

    converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0));
    converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0));
    converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
  }

  converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
}
开发者ID:dfelinto,项目名称:blender,代码行数:41,代码来源:COM_BoxMaskNode.cpp

示例4: convertToOperations

void TranslateNode::convertToOperations(NodeConverter &converter,
                                        const CompositorContext &context) const
{
  bNode *bnode = this->getbNode();
  NodeTranslateData *data = (NodeTranslateData *)bnode->storage;

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

  TranslateOperation *operation = new TranslateOperation();
  if (data->relative) {
    const RenderData *rd = context.getRenderData();
    float fx = rd->xsch * rd->size / 100.0f;
    float fy = rd->ysch * rd->size / 100.0f;

    operation->setFactorXY(fx, fy);
  }

  converter.addOperation(operation);
  converter.mapInputSocket(inputXSocket, operation->getInputSocket(1));
  converter.mapInputSocket(inputYSocket, operation->getInputSocket(2));
  converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));

  if (data->wrap_axis) {
    WriteBufferOperation *writeOperation = new WriteBufferOperation(COM_DT_COLOR);
    WrapOperation *wrapOperation = new WrapOperation(COM_DT_COLOR);
    wrapOperation->setMemoryProxy(writeOperation->getMemoryProxy());
    wrapOperation->setWrapping(data->wrap_axis);

    converter.addOperation(writeOperation);
    converter.addOperation(wrapOperation);
    converter.mapInputSocket(inputSocket, writeOperation->getInputSocket(0));
    converter.addLink(wrapOperation->getOutputSocket(), operation->getInputSocket(0));
  }
  else {
    converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
  }
}
开发者ID:dfelinto,项目名称:blender,代码行数:40,代码来源:COM_TranslateNode.cpp

示例5: convertToOperations

void OutputFileNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
	NodeImageMultiFile *storage = (NodeImageMultiFile *)this->getbNode()->storage;
	
	if (!context.isRendering()) {
		/* only output files when rendering a sequence -
		 * otherwise, it overwrites the output files just
		 * scrubbing through the timeline when the compositor updates.
		 */
		return;
	}
	
	if (storage->format.imtype == R_IMF_IMTYPE_MULTILAYER) {
		/* single output operation for the multilayer file */
		OutputOpenExrMultiLayerOperation *outputOperation = new OutputOpenExrMultiLayerOperation(
		        context.getRenderData(), context.getbNodeTree(), storage->base_path, storage->format.exr_codec);
		converter.addOperation(outputOperation);
		
		int num_inputs = getNumberOfInputSockets();
		bool previewAdded = false;
		for (int i = 0; i < num_inputs; ++i) {
			NodeInput *input = getInputSocket(i);
			NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage;
			
			/* note: layer becomes an empty placeholder if the input is not linked */
			outputOperation->add_layer(sockdata->layer, input->getDataType(), input->isLinked());
			
			converter.mapInputSocket(input, outputOperation->getInputSocket(i));
			
			if (!previewAdded) {
				converter.addNodeInputPreview(input);
				previewAdded = true;
			}
		}
	}
	else {  /* single layer format */
		int num_inputs = getNumberOfInputSockets();
		bool previewAdded = false;
		for (int i = 0; i < num_inputs; ++i) {
			NodeInput *input = getInputSocket(i);
			if (input->isLinked()) {
				NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage;
				ImageFormatData *format = (sockdata->use_node_format ? &storage->format : &sockdata->format);
				char path[FILE_MAX];
				
				/* combine file path for the input */
				BLI_join_dirfile(path, FILE_MAX, storage->base_path, sockdata->path);
				
				OutputSingleLayerOperation *outputOperation = new OutputSingleLayerOperation(
				        context.getRenderData(), context.getbNodeTree(), input->getDataType(), format, path,
				        context.getViewSettings(), context.getDisplaySettings());
				converter.addOperation(outputOperation);
				
				converter.mapInputSocket(input, outputOperation->getInputSocket(0));
				
				if (!previewAdded) {
					converter.addNodeInputPreview(input);
					previewAdded = true;
				}
			}
		}
	}
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:63,代码来源:COM_OutputFileNode.cpp

示例6: 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


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