예제 #1
0
/**
 * @brief Function called to describe the plugin controls and features.
 * @param[in, out]   desc       Effect descriptor
 * @param[in]        context    Application context
 */
void SeExprPluginFactory::describeInContext(OFX::ImageEffectDescriptor& desc, OFX::EContext context)
{
    describeGeneratorParamsInContext(desc, context);

    OFX::ChoiceParamDescriptor* chooseInput = desc.defineChoiceParam(kParamChooseInput);
    chooseInput->appendOption(kParamChooseInputCode);
    chooseInput->appendOption(kParamChooseInputFile);
    chooseInput->setDefault(eParamChooseInputCode);

    OFX::StringParamDescriptor* code = desc.defineStringParam(kParamSeExprCode);
    code->setLabel("SeExpr code");
    code->setHint("Write your SeExpr code.");
    code->setStringType(OFX::eStringTypeMultiLine);
    code->setDefault("cfbm([10*u,10*v,.5])");

    OFX::StringParamDescriptor* file = desc.defineStringParam(kTuttlePluginFilename);
    file->setLabel(kTuttlePluginFilenameLabel);
    file->setHint("SeExpr source code file.");
    file->setStringType(OFX::eStringTypeFilePath);

    OFX::Double2DParamDescriptor* textureOffset = desc.defineDouble2DParam(kParamTextureOffset);
    textureOffset->setLabel("Texture Offset (u, v)");
    textureOffset->setHint("Set the u,v offset texture parameters.");
    textureOffset->setDisplayRange(-100, -100, 100, 100);
    textureOffset->setDefault(0.0, 0.0);
}
예제 #2
0
/**
 * @brief Function called to describe the plugin controls and features.
 * @param[in, out]   desc       Effect descriptor
 * @param[in]        context    Application context
 */
void TextPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
                                           OFX::EContext               context )
{
	OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
	srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
	srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
	srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
	srcClip->setSupportsTiles( kSupportTiles );

	// Create the mandated output clip
	OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
	dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
	dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
	dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
	dstClip->setSupportsTiles( kSupportTiles );

	OFX::StringParamDescriptor* text = desc.defineStringParam( kText );
	text->setLabel( "Text" );
	text->setStringType( OFX::eStringTypeMultiLine );

	OFX::StringParamDescriptor* font = desc.defineStringParam( kFont );
	font->setLabel( "Font file" );
	font->setStringType( OFX::eStringTypeFilePath );
	font->setDefault( "/usr/share/fonts/truetype/msttcorefonts/arial.ttf" );

	OFX::IntParamDescriptor* size = desc.defineIntParam( kSize );
	size->setLabel( "Size" );
	size->setDefault( 18 );
	size->setRange( 0, std::numeric_limits<int>::max() );
	size->setDisplayRange( 0, 60 );

	OFX::DoubleParamDescriptor* ratio = desc.defineDoubleParam( kRatio );
	ratio->setLabel( "Ratio" );
	ratio->setRange( 0.0, std::numeric_limits<double>::max() );
	ratio->setDisplayRange( 0.0, 2.0 );
	ratio->setDefault( 1.0 );

	OFX::RGBAParamDescriptor* color = desc.defineRGBAParam( kColor );
	color->setLabel( "Color" );
	color->setDefault( 1.0, 1.0, 1.0, 1.0 );

	OFX::Double2DParamDescriptor* position = desc.defineDouble2DParam( kPosition );
	position->setLabel( "Position" );
	position->setDefault( 0.0, 0.0 );

	OFX::DoubleParamDescriptor* letterSpacing = desc.defineDoubleParam( kLetterSpacing );
	letterSpacing->setLabel( "Letter spacing" );
	letterSpacing->setDisplayRange( -10.0, 10.0 );
	letterSpacing->setDefault( 0.0 );

	OFX::BooleanParamDescriptor* verticalFlip = desc.defineBooleanParam( kVerticalFlip );
	verticalFlip->setLabel( "Vertical flip" );
	verticalFlip->setDefault( false );
	verticalFlip->setAnimates( false );
	verticalFlip->setHint( "Some hosts use inverted images, so you can correct this problem using this flag." );

}
예제 #3
0
void
GenericOCIO::describeInContextOutput(OFX::ImageEffectDescriptor &desc, OFX::ContextEnum /*context*/, OFX::PageParamDescriptor *page, const char* outputSpaceNameDefault, const char* outputSpaceLabel)
{
#ifdef OFX_IO_USING_OCIO
    gHostIsNatron = (OFX::getImageEffectHostDescription()->isNatron);

    char* file = std::getenv("OCIO");
    OCIO::ConstConfigRcPtr config;
    if (file != NULL) {
        //Add choices
        try {
            config = OCIO::Config::CreateFromFile(file);
            gWasOCIOEnvVarFound = true;
        } catch (OCIO::Exception &e) {
        }
    }
    std::string outputSpaceName;
    if (config) {
        outputSpaceName = canonicalizeColorSpace(config, colorSpaceName(config, outputSpaceNameDefault));
    }

    ///////////Output Color-space
    {
        OFX::StringParamDescriptor* param = desc.defineStringParam(kOCIOParamOutputSpace);
        param->setLabel(outputSpaceLabel);
        param->setHint(kOCIOParamOutputSpaceHint);
        param->setAnimates(true);
        if (config) {
            param->setDefault(outputSpaceName);
        } else {
            param->setEnabled(false);
        }
        page->addChild(*param);
    }
#ifdef OFX_OCIO_CHOICE
    {
        OFX::ChoiceParamDescriptor* param = desc.defineChoiceParam(kOCIOParamOutputSpaceChoice);
        param->setLabel(outputSpaceLabel);
        param->setHint(kOCIOParamOutputSpaceHint);
        param->setCascading(OFX::getImageEffectHostDescription()->supportsCascadingChoices);
        if (config) {
            buildChoiceMenu(config, param, OFX::getImageEffectHostDescription()->supportsCascadingChoices, outputSpaceName);
        } else {
            param->setEnabled(false);
            //param->setIsSecret(true); // done in the plugin constructor
        }
        param->setAnimates(true);
        param->setEvaluateOnChange(false); // evaluate only when the StringParam is changed
        param->setIsPersistant(false); // don't save/serialize
        page->addChild(*param);
    }
#endif
#endif
}
예제 #4
0
/**
 * @brief Function called to describe the plugin controls and features.
 * @param[in, out]   desc       Effect descriptor
 * @param[in]        context    Application context
 */
void LutPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, OFX::EContext context )
{
	OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
	srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
	srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
	srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
	srcClip->setSupportsTiles( kSupportTiles );

	OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
	dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
	dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
	dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
	dstClip->setSupportsTiles( kSupportTiles );

	// Controls
	OFX::StringParamDescriptor* filename = desc.defineStringParam( kTuttlePluginFilename );
	filename->setDefault( "" );
	filename->setLabels( kTuttlePluginFilenameLabel, kTuttlePluginFilenameLabel, kTuttlePluginFilenameLabel );
	filename->setStringType( OFX::eStringTypeFilePath );
}
예제 #5
0
/**
 * @brief Function called to describe the plugin controls and features.
 * @param[in, out]   desc       Effect descriptor
 * @param[in]        context    Application context
 */
void DPXWriterPluginFactory::describeInContext(OFX::ImageEffectDescriptor& desc, OFX::EContext context)
{
    OFX::ClipDescriptor* srcClip = desc.defineClip(kOfxImageEffectSimpleSourceClipName);
    srcClip->addSupportedComponent(OFX::ePixelComponentRGBA);
    srcClip->addSupportedComponent(OFX::ePixelComponentRGB);
    srcClip->addSupportedComponent(OFX::ePixelComponentAlpha);
    srcClip->setSupportsTiles(kSupportTiles);

    OFX::ClipDescriptor* dstClip = desc.defineClip(kOfxImageEffectOutputClipName);
    dstClip->addSupportedComponent(OFX::ePixelComponentRGBA);
    dstClip->addSupportedComponent(OFX::ePixelComponentRGB);
    dstClip->addSupportedComponent(OFX::ePixelComponentAlpha);
    dstClip->setSupportsTiles(kSupportTiles);

    // Controls

    describeWriterParamsInContext(desc, context);

    OFX::ChoiceParamDescriptor* bitDepth =
        static_cast<OFX::ChoiceParamDescriptor*>(desc.getParamDescriptor(kTuttlePluginBitDepth));
    bitDepth->resetOptions();
    bitDepth->appendOption(kTuttlePluginBitDepth8);
    bitDepth->appendOption(kTuttlePluginBitDepth10);
    bitDepth->appendOption(kTuttlePluginBitDepth12);
    bitDepth->appendOption(kTuttlePluginBitDepth16);
    bitDepth->appendOption(kTuttlePluginBitDepth32);
    bitDepth->appendOption(kTuttlePluginBitDepth64);
    bitDepth->setDefault(eTuttlePluginBitDepth10);

    OFX::ChoiceParamDescriptor* descriptor =
        static_cast<OFX::ChoiceParamDescriptor*>(desc.getParamDescriptor(kTuttlePluginChannel));
    descriptor->resetOptions();
    descriptor->appendOption(kParamDescriptorUserDefinedDescriptor);
    descriptor->appendOption(kParamDescriptorRed);
    descriptor->appendOption(kParamDescriptorGreen);
    descriptor->appendOption(kParamDescriptorBlue);
    descriptor->appendOption(kParamDescriptorAlpha);
    descriptor->appendOption(kParamDescriptorLuma);
    descriptor->appendOption(kParamDescriptorColorDifference);
    descriptor->appendOption(kParamDescriptorDepth);
    descriptor->appendOption(kParamDescriptorCompositeVideo);
    descriptor->appendOption(kParamDescriptorRGB);
    descriptor->appendOption(kParamDescriptorRGBA);
    descriptor->appendOption(kParamDescriptorABGR);
    descriptor->appendOption(kParamDescriptorCbYCrY);
    descriptor->appendOption(kParamDescriptorCbYACrYA);
    descriptor->appendOption(kParamDescriptorCbYCr);
    descriptor->appendOption(kParamDescriptorCbYCrA);
    descriptor->appendOption(kParamDescriptorUserDefined2Comp);
    descriptor->appendOption(kParamDescriptorUserDefined3Comp);
    descriptor->appendOption(kParamDescriptorUserDefined4Comp);
    descriptor->appendOption(kParamDescriptorUserDefined5Comp);
    descriptor->appendOption(kParamDescriptorUserDefined6Comp);
    descriptor->appendOption(kParamDescriptorUserDefined7Comp);
    descriptor->appendOption(kParamDescriptorUserDefined8Comp);
    descriptor->appendOption(kParamDescriptorUndefinedDescriptor);
    descriptor->appendOption(kParamDescriptorAuto);
    descriptor->setDefault(9); // rgb

    OFX::ChoiceParamDescriptor* transfer = desc.defineChoiceParam(kParamTransfer);
    transfer->setLabel(kParamTransferLabel);
    transfer->setHint(kParamTransferHint);
    transfer->appendOption(kParamCharacteristicUserDefined);
    transfer->appendOption(kParamCharacteristicPrintingDensity);
    transfer->appendOption(kParamCharacteristicLinear);
    transfer->appendOption(kParamCharacteristicLogarithmic);
    transfer->appendOption(kParamCharacteristicUnspecifiedVideo);
    transfer->appendOption(kParamCharacteristicSMPTE274M);
    transfer->appendOption(kParamCharacteristicITUR709);
    transfer->appendOption(kParamCharacteristicITUR601);
    transfer->appendOption(kParamCharacteristicITUR602);
    transfer->appendOption(kParamCharacteristicNTSCCompositeVideo);
    transfer->appendOption(kParamCharacteristicPALCompositeVideo);
    transfer->appendOption(kParamCharacteristicZLinear);
    transfer->appendOption(kParamCharacteristicZHomogeneous);
    transfer->appendOption(kParamCharacteristicUndefinedCharacteristic);
    transfer->setDefault(2); // Linear

    OFX::ChoiceParamDescriptor* colorimetric = desc.defineChoiceParam(kParamColorimetric);
    colorimetric->setLabel(kParamColorimetricLabel);
    colorimetric->setHint(kParamColorimetricHint);
    colorimetric->appendOption(kParamCharacteristicUserDefined);
    colorimetric->appendOption(kParamCharacteristicPrintingDensity);
    colorimetric->appendOption(kParamCharacteristicLinear);
    colorimetric->appendOption(kParamCharacteristicLogarithmic);
    colorimetric->appendOption(kParamCharacteristicUnspecifiedVideo);
    colorimetric->appendOption(kParamCharacteristicSMPTE274M);
    colorimetric->appendOption(kParamCharacteristicITUR709);
    colorimetric->appendOption(kParamCharacteristicITUR601);
    colorimetric->appendOption(kParamCharacteristicITUR602);
    colorimetric->appendOption(kParamCharacteristicNTSCCompositeVideo);
    colorimetric->appendOption(kParamCharacteristicPALCompositeVideo);
    colorimetric->appendOption(kParamCharacteristicZLinear);
    colorimetric->appendOption(kParamCharacteristicZHomogeneous);
    colorimetric->appendOption(kParamCharacteristicUndefinedCharacteristic);
    colorimetric->setDefault(2); // Linear

    OFX::ChoiceParamDescriptor* packed = desc.defineChoiceParam(kParamPacked);
    packed->setLabel(kParamPackedLabel);
    packed->setHint(kParamPackedHint);
    packed->appendOption(kParamPackedPacked);
    packed->appendOption(kParamPackedMethodA);
    packed->appendOption(kParamPackedMethodB);
    packed->setDefault(1);

    OFX::BooleanParamDescriptor* swapEndian = desc.defineBooleanParam(kParamSwapEndian);
    swapEndian->setLabel(kParamSwapEndianLabel);
    swapEndian->setHint(kParamSwapEndianHint);
    swapEndian->setDefault(true);

    OFX::ChoiceParamDescriptor* encoding = desc.defineChoiceParam(kParamEncoding);
    encoding->setLabel(kParamEncodingLabel);
    encoding->setHint(kParamEncodingHint);
    encoding->appendOption(kParamEncodingNone);
    encoding->appendOption(kParamEncodingRle);
    encoding->setDefault(0);

    OFX::ChoiceParamDescriptor* orientation = desc.defineChoiceParam(kParamOrientation);
    orientation->setLabel(kParamOrientationLabel);
    orientation->setHint(kParamOrientationHint);
    orientation->appendOption(kParamOrientationLeftToRightTopToBottom);
    orientation->appendOption(kParamOrientationRightToLeftTopToBottom);
    orientation->appendOption(kParamOrientationLeftToRightBottomToTop);
    orientation->appendOption(kParamOrientationRightToLeftBottomToTop);
    orientation->appendOption(kParamOrientationTopToBottomLeftToRight);
    orientation->appendOption(kParamOrientationTopToBottomRightToLeft);
    orientation->appendOption(kParamOrientationBottomToTopLeftToRight);
    orientation->appendOption(kParamOrientationBottomToTopRightToLeft);
    orientation->appendOption(kParamOrientationUndefinedOrientation);
    orientation->setDefault(0);

    OFX::StringParamDescriptor* project = desc.defineStringParam(kParamProject);
    project->setDefault("");
    OFX::StringParamDescriptor* copyright = desc.defineStringParam(kParamCopyright);
    copyright->setDefault("");
}
예제 #6
0
void
GenericOCIO::describeInContextInput(OFX::ImageEffectDescriptor &desc, OFX::ContextEnum /*context*/, OFX::PageParamDescriptor *page, const char* inputSpaceNameDefault, const char* inputSpaceLabel)
{
#ifdef OFX_IO_USING_OCIO
    gHostIsNatron = (OFX::getImageEffectHostDescription()->isNatron);

    char* file = std::getenv("OCIO");
    OCIO::ConstConfigRcPtr config;
    if (file != NULL) {
        //Add choices
        try {
            config = OCIO::Config::CreateFromFile(file);
            gWasOCIOEnvVarFound = true;
        } catch (OCIO::Exception &e) {
        }
    }
    std::string inputSpaceName, outputSpaceName;
    if (config) {
        inputSpaceName = canonicalizeColorSpace(config, colorSpaceName(config, inputSpaceNameDefault));
    }

    ////////// OCIO config file
    {
        OFX::StringParamDescriptor* param = desc.defineStringParam(kOCIOParamConfigFile);
        param->setLabel(kOCIOParamConfigFileLabel);
        param->setHint(kOCIOParamConfigFileHint);
        param->setStringType(OFX::eStringTypeFilePath);
        param->setFilePathExists(true);
        param->setAnimates(false);
        desc.addClipPreferencesSlaveParam(*param);
        // the OCIO config can only be set in a portable fashion using the environment variable.
        // Nuke, for example, doesn't support changing the entries in a ChoiceParam outside of describeInContext.
        // disable it, and set the default from the env variable.
        assert(OFX::getImageEffectHostDescription());
        param->setEnabled(true);
        if (file == NULL) {
            param->setDefault("WARNING: Open an OCIO config file, or set the OCIO environnement variable");
        } else if (config) {
            param->setDefault(file);
        } else {
            std::string s("ERROR: Invalid OCIO configuration '");
            s += file;
            s += '\'';
            param->setDefault(s);
        }
        page->addChild(*param);
    }

    ///////////Input Color-space
    {
        OFX::StringParamDescriptor* param = desc.defineStringParam(kOCIOParamInputSpace);
        param->setLabel(inputSpaceLabel);
        param->setHint(kOCIOParamInputSpaceHint);
        param->setAnimates(true);
        if (config) {
            param->setDefault(inputSpaceName);
        } else {
            param->setEnabled(false);
        }
        page->addChild(*param);
    }

#ifdef OFX_OCIO_CHOICE
    {
        OFX::ChoiceParamDescriptor* param = desc.defineChoiceParam(kOCIOParamInputSpaceChoice);
        param->setLabel(inputSpaceLabel);
        param->setHint(kOCIOParamInputSpaceHint);
        param->setCascading(OFX::getImageEffectHostDescription()->supportsCascadingChoices);
        if (config) {
            buildChoiceMenu(config, param, OFX::getImageEffectHostDescription()->supportsCascadingChoices, inputSpaceName);
        } else {
            param->setEnabled(false);
            //param->setIsSecret(true); // done in the plugin constructor
        }
        param->setAnimates(true);
        param->setEvaluateOnChange(false); // evaluate only when the StringParam is changed
        param->setIsPersistant(false); // don't save/serialize
        page->addChild(*param);
    }
#endif
#endif
}
예제 #7
0
/**
 * @brief Function called to describe the plugin controls and features.
 * @param[in, out]   desc       Effect descriptor
 * @param[in]        context    Application context
 */
void TextPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
                                           OFX::EContext               context )
{
	OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
	srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
	srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
	srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
	srcClip->setSupportsTiles( kSupportTiles );
	srcClip->setOptional(true);

	// Create the mandated output clip
	OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
	dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
	dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
	dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
	dstClip->setSupportsTiles( kSupportTiles );

	OFX::StringParamDescriptor* text = desc.defineStringParam( kParamText );
	text->setLabel( "Text" );
	text->setStringType( OFX::eStringTypeMultiLine );

	OFX::BooleanParamDescriptor* isExpression = desc.defineBooleanParam( kParamIsExpression );
	isExpression->setLabel( "Expression" );
	isExpression->setHint( "If you check this parameter the text must be a python code.\n"
	                       "The final result must be in a variable with the name of the parameter.\n"
	                       "Example:\n"
	                       "from math import *\n"
	                       //+ kParamText +
	                       "text = 'At frame '+str(time)+', value is ' + str( sin(time) )\n" );
	isExpression->setDefault( false );

	OFX::StringParamDescriptor* font = desc.defineStringParam( kParamFont );
	font->setLabel( "Font file" );
	font->setStringType( OFX::eStringTypeFilePath );
	font->setDefault( "/usr/share/fonts/truetype/msttcorefonts/arial.ttf" );

	OFX::IntParamDescriptor* size = desc.defineIntParam( kParamSize );
	size->setLabel( "Size" );
	size->setDefault( 18 );
	size->setRange( 0, std::numeric_limits<int>::max() );
	size->setDisplayRange( 0, 60 );

	OFX::DoubleParamDescriptor* ratio = desc.defineDoubleParam( kParamRatio );
	ratio->setLabel( "Ratio" );
	ratio->setRange( 0.0, std::numeric_limits<double>::max() );
	ratio->setDisplayRange( 0.0, 2.0 );
	ratio->setDefault( 1.0 );

	OFX::RGBAParamDescriptor* color = desc.defineRGBAParam( kParamColor );
	color->setLabel( "Color" );
	color->setDefault( 1.0, 1.0, 1.0, 1.0 );

	OFX::Double2DParamDescriptor* position = desc.defineDouble2DParam( kParamPosition );
	position->setLabel( "Position" );
	position->setDefault( 0.0, 0.0 );

	OFX::DoubleParamDescriptor* letterSpacing = desc.defineDoubleParam( kParamLetterSpacing );
	letterSpacing->setLabel( "Letter spacing" );
	letterSpacing->setDisplayRange( -10.0, 10.0 );
	letterSpacing->setDefault( 0.0 );

	OFX::ChoiceParamDescriptor* vAlign = desc.defineChoiceParam( kParamVAlign );
	vAlign->setLabel( "Vertically align" );
	vAlign->appendOption( kParamVAlignTop );
	vAlign->appendOption( kParamVAlignCenter );
	vAlign->appendOption( kParamVAlignBottom );
	vAlign->setDefault( eParamVAlignCenter );

	OFX::ChoiceParamDescriptor* hAlign = desc.defineChoiceParam( kParamHAlign );
	hAlign->setLabel( "Horizontally align" );
	hAlign->appendOption( kParamHAlignLeft );
	hAlign->appendOption( kParamHAlignCenter );
	hAlign->appendOption( kParamHAlignRight );
	hAlign->setDefault( eParamHAlignCenter );

	OFX::BooleanParamDescriptor* verticalFlip = desc.defineBooleanParam( kParamVerticalFlip );
	verticalFlip->setLabel( "Vertical flip" );
	verticalFlip->setDefault( false );
	verticalFlip->setAnimates( false );
	verticalFlip->setHint( "Some hosts use inverted images, so you can correct this problem using this flag." );

}