Esempio n. 1
0
void SwitchPluginFactory::describeInContext(OFX::ImageEffectDescriptor &desc, OFX::ContextEnum context)
{
    // Source clip only in the filter context
    // create the mandated source clip
    for (int i = 0; i < kSwitchPluginSourceClipCount; ++i) {
        std::stringstream s;
        s << i;
        ClipDescriptor *srcClip = desc.defineClip(s.str());
        srcClip->addSupportedComponent(ePixelComponentRGB);
        srcClip->addSupportedComponent(ePixelComponentRGBA);
        srcClip->addSupportedComponent(ePixelComponentAlpha);
        srcClip->setTemporalClipAccess(false);
        srcClip->setSupportsTiles(true);
        srcClip->setIsMask(false);
        if (i >= 2) {
            srcClip->setOptional(true);
        }
    }

    // create the mandated output clip
    ClipDescriptor *dstClip = desc.defineClip(kOfxImageEffectOutputClipName);
    dstClip->addSupportedComponent(ePixelComponentRGB);
    dstClip->addSupportedComponent(ePixelComponentRGBA);
    dstClip->addSupportedComponent(ePixelComponentAlpha);
    dstClip->setSupportsTiles(true);

    // make some pages and to things in
    PageParamDescriptor *page = desc.definePageParam("Controls");

    IntParamDescriptor *which = desc.defineIntParam(kSwitchPluginParamWhich);
    which->setLabels(kSwitchPluginParamWhichLabel, kSwitchPluginParamWhichLabel, kSwitchPluginParamWhichLabel);
    which->setHint(kSwitchPluginParamWhichHint);
    which->setDefault(0);
    which->setRange(0, kSwitchPluginSourceClipCount);
    which->setDisplayRange(0, 1);
    which->setAnimates(true);
    
    page->addChild(*which);

#ifdef OFX_EXTENSIONS_NUKE
    // Enable transform by the host.
    // It is only possible for transforms which can be represented as a 3x3 matrix.
    desc.setCanTransform(true);
#endif
}
Esempio n. 2
0
void NoiseExamplePluginFactory::describeInContext(OFX::ImageEffectDescriptor &desc, ContextEnum context) 
{
  ClipDescriptor *dstClip = desc.defineClip("Output");
  dstClip->addSupportedComponent(ePixelComponentRGBA);
  dstClip->addSupportedComponent(ePixelComponentAlpha);
  dstClip->setSupportsTiles(true);
  dstClip->setFieldExtraction(eFieldExtractSingle);
  DoubleParamDescriptor *param = desc.defineDoubleParam("Noise");
  param->setLabels("noise", "noise", "noise");
  param->setScriptName("noise");
  param->setHint("How much noise to make.");
  param->setDefault(0.2);
  param->setRange(0, 10);
  param->setIncrement(0.1);
  param->setDisplayRange(0, 1);
  param->setAnimates(true); // can animate
  param->setDoubleType(eDoubleTypeScale);
  PageParamDescriptor *page = desc.definePageParam("Controls");
  page->addChild(*param);
}
Esempio n. 3
0
void BasicExamplePluginFactory::describeInContext(OFX::ImageEffectDescriptor& desc, OFX::ContextEnum context)
{
  // Source clip only in the filter context
  // create the mandated source clip
  ClipDescriptor *srcClip = desc.defineClip(kOfxImageEffectSimpleSourceClipName);
  srcClip->addSupportedComponent(ePixelComponentRGBA);
  srcClip->addSupportedComponent(ePixelComponentAlpha);
  srcClip->setTemporalClipAccess(false);
  srcClip->setSupportsTiles(true);
  srcClip->setIsMask(false);

  // if general or paint context, define the mask clip
  if(context == eContextGeneral || context == eContextPaint) {                
    // if paint context, it is a mandated input called 'brush'
    ClipDescriptor *maskClip = context == eContextGeneral ? desc.defineClip("Mask") : desc.defineClip("Brush");
    maskClip->addSupportedComponent(ePixelComponentAlpha);
    maskClip->setTemporalClipAccess(false);
    if(context == eContextGeneral)
      maskClip->setOptional(true);
    maskClip->setSupportsTiles(true); 
    maskClip->setIsMask(true); // we are a mask input
  }

  // create the mandated output clip
  ClipDescriptor *dstClip = desc.defineClip(kOfxImageEffectOutputClipName);
  dstClip->addSupportedComponent(ePixelComponentRGBA);
  dstClip->addSupportedComponent(ePixelComponentAlpha);
  dstClip->setSupportsTiles(true);

  // make some pages and to things in 
  PageParamDescriptor *page = desc.definePageParam("Controls");

  // group param to group the scales
  GroupParamDescriptor *componentScalesGroup = desc.defineGroupParam("componentScales");
  componentScalesGroup->setHint("Scales on the individual component");
  componentScalesGroup->setLabels("Components", "Components", "Components");            

  // make overall scale params 
  DoubleParamDescriptor *param = defineScaleParam(desc, "scale", "scale", "Scales all component in the image", 0);
  page->addChild(*param);

  // add a boolean to enable the component scale
  BooleanParamDescriptor *boolP = desc.defineBooleanParam("scaleComponents");
  boolP->setDefault(true);
  boolP->setHint("Enables scales on individual components");
  boolP->setLabels("Scale Components", "Scale Components", "Scale Components");
  boolP->setParent(*componentScalesGroup);
  page->addChild(*boolP);

  // make the four component scale params 
  param = defineScaleParam(desc, "scaleR", "red", "Scales the red component of the image", componentScalesGroup);
  page->addChild(*param);

  param = defineScaleParam(desc, "scaleG", "green", "Scales the green component of the image", componentScalesGroup);
  page->addChild(*param);

  param = defineScaleParam(desc, "scaleB", "blue", "Scales the blue component of the image", componentScalesGroup);
  page->addChild(*param);

  param = defineScaleParam(desc, "scaleA", "alpha", "Scales the alpha component of the image", componentScalesGroup);
  page->addChild(*param);
}
Esempio n. 4
0
void InvertPluginFactory::describeInContext(OFX::ImageEffectDescriptor &desc, OFX::ContextEnum context)
{
    // Source clip only in the filter context
    // create the mandated source clip
    ClipDescriptor *srcClip = desc.defineClip(kOfxImageEffectSimpleSourceClipName);
    srcClip->addSupportedComponent(ePixelComponentRGBA);
    srcClip->addSupportedComponent(ePixelComponentRGB);
    srcClip->addSupportedComponent(ePixelComponentAlpha);
    srcClip->setTemporalClipAccess(false);
    srcClip->setSupportsTiles(true);
    srcClip->setIsMask(false);
    
    // create the mandated output clip
    ClipDescriptor *dstClip = desc.defineClip(kOfxImageEffectOutputClipName);
    dstClip->addSupportedComponent(ePixelComponentRGBA);
    dstClip->addSupportedComponent(ePixelComponentRGB);
    dstClip->addSupportedComponent(ePixelComponentAlpha);
    dstClip->setSupportsTiles(true);

    if (context == eContextGeneral || context == eContextPaint) {
        ClipDescriptor *maskClip = context == eContextGeneral ? desc.defineClip("Mask") : desc.defineClip("Brush");
        maskClip->addSupportedComponent(ePixelComponentAlpha);
        maskClip->setTemporalClipAccess(false);
        if (context == eContextGeneral) {
            maskClip->setOptional(true);
        }
        maskClip->setSupportsTiles(true);
        maskClip->setIsMask(true);
    }

    // make some pages and to things in
    PageParamDescriptor *page = desc.definePageParam("Controls");

    OFX::BooleanParamDescriptor* processR = desc.defineBooleanParam(kParamProcessR);
    processR->setLabels(kParamProcessRLabel, kParamProcessRLabel, kParamProcessRLabel);
    processR->setHint(kParamProcessRHint);
    processR->setDefault(true);
    processR->setLayoutHint(eLayoutHintNoNewLine);
    page->addChild(*processR);

    OFX::BooleanParamDescriptor* processG = desc.defineBooleanParam(kParamProcessG);
    processG->setLabels(kParamProcessGLabel, kParamProcessGLabel, kParamProcessGLabel);
    processG->setHint(kParamProcessGHint);
    processG->setDefault(true);
    processG->setLayoutHint(eLayoutHintNoNewLine);
    page->addChild(*processG);

    OFX::BooleanParamDescriptor* processB = desc.defineBooleanParam( kParamProcessB );
    processB->setLabels(kParamProcessBLabel, kParamProcessBLabel, kParamProcessBLabel);
    processB->setHint(kParamProcessBHint);
    processB->setDefault(true);
    processB->setLayoutHint(eLayoutHintNoNewLine);
    page->addChild(*processB);

    OFX::BooleanParamDescriptor* processA = desc.defineBooleanParam( kParamProcessA );
    processA->setLabels(kParamProcessALabel, kParamProcessALabel, kParamProcessALabel);
    processA->setHint(kParamProcessAHint);
    processA->setDefault(true);
    page->addChild(*processA);

    ofxsMaskMixDescribeParams(desc, page);
}
Esempio n. 5
0
/** @brief The describe in context function, passed a plugin descriptor and a context */
void PropTesterPluginFactory::describeInContext(OFX::ImageEffectDescriptor &desc, ContextEnum context) 
{
  // Source clip only in the filter context
  if(context == eContextGeneral) {
    // create the mandated source clip
    ClipDescriptor *srcClip = desc.defineClip("Extra");
    srcClip->addSupportedComponent(ePixelComponentRGBA);
    srcClip->setTemporalClipAccess(false);
    srcClip->setOptional(false);
    srcClip->setSupportsTiles(true);
    srcClip->setIsMask(false);
  }

  // Source clip only in the filter context
  if(context == eContextFilter || context == eContextGeneral) {
    // create the mandated source clip
    ClipDescriptor *srcClip = desc.defineClip(kOfxImageEffectSimpleSourceClipName);
    srcClip->addSupportedComponent(ePixelComponentRGBA);
    srcClip->setTemporalClipAccess(false);
    //srcClip->setOptional(false);
    srcClip->setSupportsTiles(true);
    srcClip->setIsMask(false);
  }

  // create the mandated output clip
  ClipDescriptor *dstClip = desc.defineClip(kOfxImageEffectOutputClipName);
  dstClip->addSupportedComponent(ePixelComponentRGBA);
  dstClip->setTemporalClipAccess(false);
  //dstClip->setOptional(false);
  dstClip->setSupportsTiles(true);
  dstClip->setIsMask(false);


  // make some pages and to things in 
  PageParamDescriptor *page1 = desc.definePageParam("page1");
  PageParamDescriptor *page2 = desc.definePageParam("page2");
  PageParamDescriptor *page3 = desc.definePageParam("page3");

  // make an int param
  IntParamDescriptor *iParam = desc.defineIntParam("Int");
  iParam->setLabels("Int", "Int", "Int");
  iParam->setScriptName("int");
  iParam->setHint("An integer parameter");
  iParam->setDefault(0);
  iParam->setRange(-100, 100);
  iParam->setDisplayRange(-100, 100);

  page1->addChild(*iParam);

  // make a 2D int param
  Int2DParamDescriptor *i2DParam = desc.defineInt2DParam("Int2D");
  i2DParam->setLabels("Int2D", "Int2D", "Int2D");
  i2DParam->setScriptName("int2D");
  i2DParam->setHint("A 2D integer parameter");
  i2DParam->setDefault(0, 0);
  i2DParam->setRange(-100, -100, 100, 100);
  i2DParam->setDisplayRange(-100, -100, 100, 100);

  page1->addChild(*i2DParam);

  // make a 3D int param
  Int3DParamDescriptor *i3DParam = desc.defineInt3DParam("Int3D");
  i3DParam->setLabels("Int3D", "Int3D", "Int2D");
  i3DParam->setScriptName("int3D");
  i3DParam->setHint("A 3D integer parameter");
  i3DParam->setDefault(0, 0, 0);
  i3DParam->setRange(-100, -100, -100, 100, 100, 100);
  i3DParam->setDisplayRange(-100, -100, -100, 100, 100, 100);

  page1->addChild(*i3DParam);

  page1->addChild(PageParamDescriptor::gSkipColumn);

  // boolean
  BooleanParamDescriptor *boolean = desc.defineBooleanParam("bool");
  boolean->setLabels("bool", "bool", "bool");
  boolean->setDefault(false);

  page1->addChild(*boolean);

  // choice 
  ChoiceParamDescriptor *choice = desc.defineChoiceParam("choice");
  choice->setLabels("choice", "choice", "choice");
  choice->appendOption("This", "This");
  choice->appendOption("That", "That");
  choice->appendOption("The Other", "The Other");
  choice->resetOptions();
  choice->appendOption("Tom", "Tom");
  choice->appendOption("Dick", "Dick");
  choice->appendOption("Harry", "Harry");
  choice->setDefault(0);

  page1->addChild(*choice);

  page1->addChild(PageParamDescriptor::gSkipColumn);

  // push button
  PushButtonParamDescriptor *push = desc.definePushButtonParam("push");
  push->setLabels("push me", "push me", "push me Big Nose");
  page1->addChild(*push);

  // make a custom param
  CustomParamDescriptor *custom = desc.defineCustomParam("custom");
  custom->setLabels("custom", "custom", "custom");
  custom->setDefault("wibble");

  // rgba colours
  RGBAParamDescriptor *rgba = desc.defineRGBAParam("rgba");
  rgba->setLabels("rgba", "rgba", "rgba");
  rgba->setDefault(0, 0, 0, 1);

  page1->addChild(*rgba);

  RGBParamDescriptor *rgba2 = desc.defineRGBParam("rgbaCustom");
  rgba2->setLabels("RGB Custom", "RGB Custom", "RGB Custom");
  rgba2->setDefault(0, 1, 1);
  rgba2->setInteractDescriptor(new ColourInteractDescriptor<0>);
  page1->addChild(*rgba2);

  RGBParamDescriptor *rgba3 = desc.defineRGBParam("rgbaCustom2");
  rgba3->setLabels("RGB Custom 2", "RGB Custom 2", "RGB Custom 2");
  rgba3->setDefault(1, 0, 1);
  rgba3->setInteractDescriptor(new ColourInteractDescriptor<1>);
  page1->addChild(*rgba3);

  page1->addChild(PageParamDescriptor::gSkipRow);

  // rgb colour
  RGBParamDescriptor *rgb = desc.defineRGBParam("rgb");
  rgb->setLabels("rgb", "rgb", "rgb");
  rgb->setDefault(0, 0, 0);
  page1->addChild(*rgb);

  // make a 1D double parameter of each type
  describeDoubleParam(desc, "double", eDoubleTypePlain, -100, 100, page2);
  describeDoubleParam(desc, "angle", eDoubleTypeAngle, -100, 100, page2);
  describeDoubleParam(desc, "scale", eDoubleTypeScale, -1, 1, page2);
  describeDoubleParam(desc, "time", eDoubleTypeTime, -100, 100, page2);
  describeDoubleParam(desc, "absoluteTime", eDoubleTypeAbsoluteTime, 0, 1000, page2);
  describeDoubleParam(desc, "X_Value", eDoubleTypeNormalisedX, -1, 1, page2);
  describeDoubleParam(desc, "Y_Value", eDoubleTypeNormalisedY, -1, 1, page2);
  describeDoubleParam(desc, "X_Position", eDoubleTypeNormalisedXAbsolute, -1, 1, page2);
  describeDoubleParam(desc, "Y_Position", eDoubleTypeNormalisedYAbsolute, -1, 1, page2);

  page2->addChild(PageParamDescriptor::gSkipColumn);

  // make a 2D double parameter of each type
  describe2DDoubleParam(desc, "double2D", eDoubleTypePlain, -100, 100, page2);
  describe2DDoubleParam(desc, "angle2D", eDoubleTypeAngle, -100, 100, page2);
  describe2DDoubleParam(desc, "scale2D", eDoubleTypeScale, -1, 1, page2);
  describe2DDoubleParam(desc, "XY_Value", eDoubleTypeNormalisedXY, -1, 1, page2);
  describe2DDoubleParam(desc, "XY_Position", eDoubleTypeNormalisedXYAbsolute, -1, 1, page2);

  page2->addChild(PageParamDescriptor::gSkipColumn);

  // make a 3D double parameter of each type
  describe3DDoubleParam(desc, "double3D", eDoubleTypePlain, -100, 100, page2);
  describe3DDoubleParam(desc, "angle3D", eDoubleTypeAngle, -100, 100, page2);
  describe3DDoubleParam(desc, "scale3D", eDoubleTypeScale, -1, 1, page2);

  // make a string param param of each type
  describeStringParam(desc, "singleLine", eStringTypeSingleLine, page3);
  describeStringParam(desc, "multiLine", eStringTypeMultiLine, page3);
  describeStringParam(desc, "filePath", eStringTypeFilePath, page3);
  describeStringParam(desc, "dirPath", eStringTypeDirectoryPath, page3);
  describeStringParam(desc, "label", eStringTypeLabel, page3);

}