Example #1
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);

}