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 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 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 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 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 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 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 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 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); }
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 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 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 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 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 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 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 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)); } }
void TrackPositionNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *editorNode = this->getbNode(); MovieClip *clip = (MovieClip *) editorNode->id; NodeTrackPosData *trackpos_data = (NodeTrackPosData *) editorNode->storage; NodeOutput *outputX = this->getOutputSocket(0); NodeOutput *outputY = this->getOutputSocket(1); int frame_number; if (editorNode->custom1 == CMP_TRACKPOS_ABSOLUTE_FRAME) { frame_number = editorNode->custom2; } else { frame_number = context.getFramenumber(); } TrackPositionOperation *operationX = new TrackPositionOperation(); operationX->setMovieClip(clip); operationX->setTrackingObject(trackpos_data->tracking_object); operationX->setTrackName(trackpos_data->track_name); operationX->setFramenumber(frame_number); operationX->setAxis(0); operationX->setPosition(editorNode->custom1); operationX->setRelativeFrame(editorNode->custom2); converter.addOperation(operationX); TrackPositionOperation *operationY = new TrackPositionOperation(); operationY->setMovieClip(clip); operationY->setTrackingObject(trackpos_data->tracking_object); operationY->setTrackName(trackpos_data->track_name); operationY->setFramenumber(frame_number); operationY->setAxis(1); operationY->setPosition(editorNode->custom1); operationY->setRelativeFrame(editorNode->custom2); converter.addOperation(operationY); converter.mapOutputSocket(outputX, operationX->getOutputSocket()); converter.mapOutputSocket(outputY, operationY->getOutputSocket()); }
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 SplitViewerNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *editorNode = this->getbNode(); bool do_output = (editorNode->flag & NODE_DO_OUTPUT_RECALC || context.isRendering()) && (editorNode->flag & NODE_DO_OUTPUT); NodeInput *image1Socket = this->getInputSocket(0); NodeInput *image2Socket = this->getInputSocket(1); Image *image = (Image *)this->getbNode()->id; ImageUser *imageUser = (ImageUser *) this->getbNode()->storage; SplitOperation *splitViewerOperation = new SplitOperation(); splitViewerOperation->setSplitPercentage(this->getbNode()->custom1); splitViewerOperation->setXSplit(!this->getbNode()->custom2); converter.addOperation(splitViewerOperation); converter.mapInputSocket(image1Socket, splitViewerOperation->getInputSocket(0)); converter.mapInputSocket(image2Socket, splitViewerOperation->getInputSocket(1)); ViewerOperation *viewerOperation = new ViewerOperation(); viewerOperation->setImage(image); viewerOperation->setImageUser(imageUser); viewerOperation->setViewSettings(context.getViewSettings()); viewerOperation->setDisplaySettings(context.getDisplaySettings()); /* defaults - the viewer node has these options but not exposed for split view * we could use the split to define an area of interest on one axis at least */ viewerOperation->setChunkOrder(COM_ORDER_OF_CHUNKS_DEFAULT); viewerOperation->setCenterX(0.5f); viewerOperation->setCenterY(0.5f); converter.addOperation(viewerOperation); converter.addLink(splitViewerOperation->getOutputSocket(), viewerOperation->getInputSocket(0)); converter.addPreview(splitViewerOperation->getOutputSocket()); if (do_output) converter.registerViewer(viewerOperation); }
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 TransformNode::convertToOperations(NodeConverter &converter, const CompositorContext & /*context*/) const { NodeInput *imageInput = this->getInputSocket(0); NodeInput *xInput = this->getInputSocket(1); NodeInput *yInput = this->getInputSocket(2); NodeInput *angleInput = this->getInputSocket(3); NodeInput *scaleInput = this->getInputSocket(4); ScaleOperation *scaleOperation = new ScaleOperation(); converter.addOperation(scaleOperation); RotateOperation *rotateOperation = new RotateOperation(); rotateOperation->setDoDegree2RadConversion(false); converter.addOperation(rotateOperation); TranslateOperation *translateOperation = new TranslateOperation(); converter.addOperation(translateOperation); SetSamplerOperation *sampler = new SetSamplerOperation(); sampler->setSampler((PixelSampler)this->getbNode()->custom1); converter.addOperation(sampler); converter.mapInputSocket(imageInput, sampler->getInputSocket(0)); converter.addLink(sampler->getOutputSocket(), scaleOperation->getInputSocket(0)); converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(1)); converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(2)); // xscale = yscale converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); converter.mapInputSocket(angleInput, rotateOperation->getInputSocket(1)); converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); converter.mapInputSocket(xInput, translateOperation->getInputSocket(1)); converter.mapInputSocket(yInput, translateOperation->getInputSocket(2)); converter.mapOutputSocket(getOutputSocket(), translateOperation->getOutputSocket()); }
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 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 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 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()); }