void ColorCurveNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { if (this->getInputSocket(2)->isLinked() || this->getInputSocket(3)->isLinked()) { ColorCurveOperation *operation = new ColorCurveOperation(); operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); 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()); } else { ConstantLevelColorCurveOperation *operation = new ConstantLevelColorCurveOperation(); float col[4]; this->getInputSocket(2)->getEditorValueColor(col); operation->setBlackLevel(col); this->getInputSocket(3)->getEditorValueColor(col); operation->setWhiteLevel(col); operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } }
void DifferenceMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { NodeInput *inputSocket = this->getInputSocket(0); NodeInput *inputSocket2 = this->getInputSocket(1); NodeOutput *outputSocketImage = this->getOutputSocket(0); NodeOutput *outputSocketMatte = this->getOutputSocket(1); bNode *editorNode = this->getbNode(); DifferenceMatteOperation *operationSet = new DifferenceMatteOperation(); operationSet->setSettings((NodeChroma *)editorNode->storage); converter.addOperation(operationSet); converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); converter.mapInputSocket(inputSocket2, operationSet->getInputSocket(1)); converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); SetAlphaOperation *operation = new SetAlphaOperation(); converter.addOperation(operation); converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); converter.addPreview(operation->getOutputSocket()); }
void ViewLevelsNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { NodeInput *input = this->getInputSocket(0); if (input->isLinked()) { // add preview to inputSocket; /* calculate mean operation */ { CalculateMeanOperation *operation = new CalculateMeanOperation(); operation->setSetting(this->getbNode()->custom1); converter.addOperation(operation); converter.mapInputSocket(input, operation->getInputSocket(0)); converter.mapOutputSocket(this->getOutputSocket(0), operation->getOutputSocket()); } /* calculate standard deviation operation */ { CalculateStandardDeviationOperation *operation = new CalculateStandardDeviationOperation(); operation->setSetting(this->getbNode()->custom1); converter.addOperation(operation); converter.mapInputSocket(input, operation->getInputSocket(0)); converter.mapOutputSocket(this->getOutputSocket(1), operation->getOutputSocket()); } } else { converter.addOutputValue(getOutputSocket(0), 0.0f); converter.addOutputValue(getOutputSocket(1), 0.0f); } }
void CornerPinNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { NodeInput *input_image = this->getInputSocket(0); /* note: socket order differs between UI node and operations: * bNode uses intuitive order following top-down layout: * upper-left, upper-right, lower-left, lower-right * Operations use same order as the tracking blenkernel functions expect: * lower-left, lower-right, upper-right, upper-left */ const int node_corner_index[4] = { 3, 4, 2, 1 }; NodeOutput *output_warped_image = this->getOutputSocket(0); NodeOutput *output_plane = this->getOutputSocket(1); PlaneCornerPinWarpImageOperation *warp_image_operation = new PlaneCornerPinWarpImageOperation(); converter.addOperation(warp_image_operation); PlaneCornerPinMaskOperation *plane_mask_operation = new PlaneCornerPinMaskOperation(); converter.addOperation(plane_mask_operation); converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0)); for (int i = 0; i < 4; ++i) { NodeInput *corner_input = getInputSocket(node_corner_index[i]); converter.mapInputSocket(corner_input, warp_image_operation->getInputSocket(i + 1)); converter.mapInputSocket(corner_input, plane_mask_operation->getInputSocket(i)); } converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket()); converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket()); }
void ColorMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { bNode *editorsnode = getbNode(); 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); ColorMatteOperation *operation = new ColorMatteOperation(); operation->setSettings((NodeDiamond *)editorsnode->storage); 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()); }
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()); }
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); }
void HueSaturationValueCorrectNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { NodeInput *valueSocket = this->getInputSocket(0); NodeInput *colorSocket = this->getInputSocket(1); NodeOutput *outputSocket = this->getOutputSocket(0); bNode *editorsnode = getbNode(); CurveMapping *storage = (CurveMapping *)editorsnode->storage; ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation(); converter.addOperation(rgbToHSV); ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation(); converter.addOperation(hsvToRGB); HueSaturationValueCorrectOperation *changeHSV = new HueSaturationValueCorrectOperation(); changeHSV->setCurveMapping(storage); converter.addOperation(changeHSV); MixBlendOperation *blend = new MixBlendOperation(); blend->setResolutionInputSocketIndex(1); converter.addOperation(blend); converter.mapInputSocket(colorSocket, rgbToHSV->getInputSocket(0)); converter.addLink(rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0)); converter.addLink(changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0)); converter.addLink(hsvToRGB->getOutputSocket(), blend->getInputSocket(2)); converter.mapInputSocket(colorSocket, blend->getInputSocket(1)); converter.mapInputSocket(valueSocket, blend->getInputSocket(0)); converter.mapOutputSocket(outputSocket, blend->getOutputSocket()); }
void ColorSpillNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *editorsnode = getbNode(); NodeInput *inputSocketImage = this->getInputSocket(0); NodeInput *inputSocketFac = this->getInputSocket(1); NodeOutput *outputSocketImage = this->getOutputSocket(0); 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 converter.addOperation(operation); converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0)); converter.mapInputSocket(inputSocketFac, operation->getInputSocket(1)); converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); }
void TimeNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { SetValueOperation *operation = new SetValueOperation(); bNode *node = this->getbNode(); /* stack order output: fac */ float fac = 0.0f; const int framenumber = context.getFramenumber(); if (framenumber < node->custom1) { fac = 0.0f; } else if (framenumber > node->custom2) { fac = 1.0f; } else if (node->custom1 < node->custom2) { fac = (context.getFramenumber() - node->custom1) / (float)(node->custom2 - node->custom1); } curvemapping_initialize((CurveMapping *)node->storage); fac = curvemapping_evaluateF((CurveMapping *)node->storage, 0, fac); operation->setValue(clamp_f(fac, 0.0f, 1.0f)); converter.addOperation(operation); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); }
void VectorCurveNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { VectorCurveOperation *operation = new VectorCurveOperation(); operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); }
void GammaNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { GammaOperation *operation = new GammaOperation(); converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); }
void BokehBlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *b_node = this->getbNode(); NodeInput *inputSizeSocket = this->getInputSocket(2); bool connectedSizeSocket = inputSizeSocket->isLinked(); const bool extend_bounds = (b_node->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0; if ((b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) && connectedSizeSocket) { VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); operation->setQuality(context.getQuality()); operation->setThreshold(0.0f); operation->setMaxBlur(b_node->custom4); operation->setDoScaleSize(true); 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.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } else { BokehBlurOperation *operation = new BokehBlurOperation(); operation->setQuality(context.getQuality()); operation->setExtendBounds(extend_bounds); converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); // NOTE: on the bokeh blur operation the sockets are switched. // for this reason the next two lines are correct. // Fix for T43771 converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(3)); converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(2)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); if (!connectedSizeSocket) { operation->setSize(this->getInputSocket(2)->getEditorValueFloat()); } } }
void Stabilize2dNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { NodeInput *imageInput = this->getInputSocket(0); MovieClip *clip = (MovieClip *)getbNode()->id; ScaleOperation *scaleOperation = new ScaleOperation(); scaleOperation->setSampler((PixelSampler)this->getbNode()->custom1); RotateOperation *rotateOperation = new RotateOperation(); rotateOperation->setDoDegree2RadConversion(false); TranslateOperation *translateOperation = new TranslateOperation(); MovieClipAttributeOperation *scaleAttribute = new MovieClipAttributeOperation(); MovieClipAttributeOperation *angleAttribute = new MovieClipAttributeOperation(); MovieClipAttributeOperation *xAttribute = new MovieClipAttributeOperation(); MovieClipAttributeOperation *yAttribute = new MovieClipAttributeOperation(); SetSamplerOperation *psoperation = new SetSamplerOperation(); psoperation->setSampler((PixelSampler)this->getbNode()->custom1); scaleAttribute->setAttribute(MCA_SCALE); scaleAttribute->setFramenumber(context.getFramenumber()); scaleAttribute->setMovieClip(clip); angleAttribute->setAttribute(MCA_ANGLE); angleAttribute->setFramenumber(context.getFramenumber()); angleAttribute->setMovieClip(clip); xAttribute->setAttribute(MCA_X); xAttribute->setFramenumber(context.getFramenumber()); xAttribute->setMovieClip(clip); yAttribute->setAttribute(MCA_Y); yAttribute->setFramenumber(context.getFramenumber()); yAttribute->setMovieClip(clip); converter.addOperation(scaleAttribute); converter.addOperation(angleAttribute); converter.addOperation(xAttribute); converter.addOperation(yAttribute); converter.addOperation(scaleOperation); converter.addOperation(translateOperation); converter.addOperation(rotateOperation); converter.addOperation(psoperation); converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1)); converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2)); converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); converter.addLink(angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1)); converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); converter.addLink(xAttribute->getOutputSocket(), translateOperation->getInputSocket(1)); converter.addLink(yAttribute->getOutputSocket(), translateOperation->getInputSocket(2)); converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(), psoperation->getOutputSocket()); }
void BokehImageNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { BokehImageOperation *operation = new BokehImageOperation(); operation->setData((NodeBokehImage *)this->getbNode()->storage); converter.addOperation(operation); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); converter.addPreview(operation->getOutputSocket(0)); }
void TonemapNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { NodeTonemap *data = (NodeTonemap *)this->getbNode()->storage; TonemapOperation *operation = data->type == 1 ? new PhotoreceptorTonemapOperation() : new TonemapOperation(); operation->setData(data); converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); }
void ColorNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { SetColorOperation *operation = new SetColorOperation(); NodeOutput *output = this->getOutputSocket(0); float col[4]; output->getEditorValueColor(col); operation->setChannels(col); converter.addOperation(operation); converter.mapOutputSocket(output, operation->getOutputSocket()); }
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)); }
void SwitchNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bool condition = this->getbNode()->custom1; NodeOperationOutput *result; if (!condition) result = converter.addInputProxy(getInputSocket(0)); else result = converter.addInputProxy(getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), result); }
void BilateralBlurNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { NodeBilateralBlurData *data = (NodeBilateralBlurData *)this->getbNode()->storage; BilateralBlurOperation *operation = new BilateralBlurOperation(); operation->setQuality(context.getQuality()); operation->setData(data); converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); }
void SetAlphaNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { SetAlphaOperation *operation = new SetAlphaOperation(); if (!this->getInputSocket(0)->isLinked() && this->getInputSocket(1)->isLinked()) { operation->setResolutionInputSocketIndex(1); } converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); }
void SocketBufferNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { NodeOutput *output = this->getOutputSocket(0); NodeInput *input = this->getInputSocket(0); DataType datatype = output->getDataType(); WriteBufferOperation *writeOperation = new WriteBufferOperation(datatype); ReadBufferOperation *readOperation = new ReadBufferOperation(datatype); readOperation->setMemoryProxy(writeOperation->getMemoryProxy()); converter.addOperation(writeOperation); converter.addOperation(readOperation); converter.mapInputSocket(input, writeOperation->getInputSocket(0)); converter.mapOutputSocket(output, readOperation->getOutputSocket()); }
void GlareNode::convertToOperations(NodeConverter &converter, const CompositorContext & /*context*/) const { bNode *node = this->getbNode(); NodeGlare *glare = (NodeGlare *)node->storage; GlareBaseOperation *glareoperation = NULL; switch (glare->type) { default: case 3: glareoperation = new GlareGhostOperation(); break; case 2: // streaks glareoperation = new GlareStreaksOperation(); break; case 1: // fog glow glareoperation = new GlareFogGlowOperation(); break; case 0: // simple star glareoperation = new GlareSimpleStarOperation(); break; } BLI_assert(glareoperation); glareoperation->setGlareSettings(glare); GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); thresholdOperation->setGlareSettings(glare); SetValueOperation *mixvalueoperation = new SetValueOperation(); mixvalueoperation->setValue(0.5f + glare->mix * 0.5f); MixGlareOperation *mixoperation = new MixGlareOperation(); mixoperation->setResolutionInputSocketIndex(1); mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT); converter.addOperation(glareoperation); converter.addOperation(thresholdOperation); converter.addOperation(mixvalueoperation); converter.addOperation(mixoperation); converter.mapInputSocket(getInputSocket(0), thresholdOperation->getInputSocket(0)); converter.addLink(thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0)); converter.addLink(mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(0), mixoperation->getInputSocket(1)); converter.addLink(glareoperation->getOutputSocket(), mixoperation->getInputSocket(2)); converter.mapOutputSocket(getOutputSocket(), mixoperation->getOutputSocket()); }
void MovieDistortionNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *bnode = this->getbNode(); MovieClip *clip = (MovieClip *)bnode->id; NodeInput *inputSocket = this->getInputSocket(0); NodeOutput *outputSocket = this->getOutputSocket(0); MovieDistortionOperation *operation = new MovieDistortionOperation(bnode->custom1 == 1); operation->setMovieClip(clip); operation->setFramenumber(context.getFramenumber()); converter.addOperation(operation); converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); }
void InpaintNode::convertToOperations(NodeConverter &converter, const CompositorContext & /*context*/) const { bNode *editorNode = this->getbNode(); /* if (editorNode->custom1 == CMP_NODE_INPAINT_SIMPLE) { */ if (true) { InpaintSimpleOperation *operation = new InpaintSimpleOperation(); operation->setIterations(editorNode->custom2); converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } }
void KeyingScreenNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *editorNode = this->getbNode(); MovieClip *clip = (MovieClip *) editorNode->id; NodeKeyingScreenData *keyingscreen_data = (NodeKeyingScreenData *) editorNode->storage; NodeOutput *outputScreen = this->getOutputSocket(0); // always connect the output image KeyingScreenOperation *operation = new KeyingScreenOperation(); operation->setMovieClip(clip); operation->setTrackingObject(keyingscreen_data->tracking_object); operation->setFramenumber(context.getFramenumber()); converter.addOperation(operation); converter.mapOutputSocket(outputScreen, operation->getOutputSocket()); }
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()); }
void DespeckleNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *editorNode = this->getbNode(); NodeInput *inputSocket = this->getInputSocket(0); NodeInput *inputImageSocket = this->getInputSocket(1); NodeOutput *outputSocket = this->getOutputSocket(0); DespeckleOperation *operation = new DespeckleOperation(); operation->setThreshold(editorNode->custom3); operation->setThresholdNeighbor(editorNode->custom4); converter.addOperation(operation); converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0)); converter.mapInputSocket(inputSocket, operation->getInputSocket(1)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); converter.addPreview(operation->getOutputSocket(0)); }
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()); }
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)); }