TuttleOFX
1
|
00001 #ifndef _TUTTLE_PLUGIN_GENERATORPLUGINFACTORY_HPP_ 00002 #define _TUTTLE_PLUGIN_GENERATORPLUGINFACTORY_HPP_ 00003 00004 #include "GeneratorDefinition.hpp" 00005 00006 #include <tuttle/plugin/exceptions.hpp> 00007 00008 #include <ofxsImageEffect.h> 00009 #include <ofxsMultiThread.h> 00010 #include <iostream> 00011 00012 namespace tuttle { 00013 namespace plugin { 00014 00015 static const bool kSupportTiles = true; 00016 00017 void describeGeneratorParamsInContext( OFX::ImageEffectDescriptor& desc, 00018 OFX::EContext context ) 00019 { 00020 // Create the mandated optional input clip 00021 OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); 00022 srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00023 srcClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00024 srcClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00025 srcClip->setSupportsTiles( kSupportTiles ); 00026 srcClip->setOptional(true); 00027 00028 // Create the mandated output clip 00029 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00030 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00031 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00032 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00033 dstClip->setSupportsTiles( kSupportTiles ); 00034 00035 OFX::ChoiceParamDescriptor* explicitConversion = desc.defineChoiceParam( kParamGeneratorExplicitConversion ); 00036 explicitConversion->setLabel( "Explicit conversion" ); 00037 explicitConversion->appendOption( kTuttlePluginBitDepthAuto ); 00038 explicitConversion->appendOption( kTuttlePluginBitDepth8 ); 00039 explicitConversion->appendOption( kTuttlePluginBitDepth16 ); 00040 explicitConversion->appendOption( kTuttlePluginBitDepth32f ); 00041 explicitConversion->setCacheInvalidation( OFX::eCacheInvalidateValueAll ); 00042 explicitConversion->setAnimates( false ); 00043 desc.addClipPreferencesSlaveParam( *explicitConversion ); 00044 00045 if( OFX::getImageEffectHostDescription()->supportsMultipleClipDepths ) 00046 { 00047 explicitConversion->setDefault( 0 ); 00048 } 00049 else 00050 { 00051 explicitConversion->setIsSecret( true ); 00052 explicitConversion->setDefault( static_cast<int>( OFX::getImageEffectHostDescription()->getDefaultPixelDepth() ) ); 00053 } 00054 00055 OFX::ChoiceParamDescriptor* components = desc.defineChoiceParam( kTuttlePluginChannel ); 00056 components->setLabel ( kTuttlePluginChannelLabel ); 00057 components->appendOption( kTuttlePluginChannelGray ); 00058 components->appendOption( kTuttlePluginChannelRGB ); 00059 components->appendOption( kTuttlePluginChannelRGBA ); 00060 components->setDefault ( 2 ); // rgba 00061 00062 OFX::ChoiceParamDescriptor* method = desc.defineChoiceParam( kParamMode ); 00063 method->setLabel ( "Mode" ); 00064 method->appendOption( kParamModeFormat ); 00065 method->appendOption( kParamModeSize ); 00066 method->setDefault ( eParamModeFormat ); 00067 00068 OFX::ChoiceParamDescriptor* format = desc.defineChoiceParam( kParamFormat ); 00069 format->setLabel( "Format" ); 00070 format->appendOption( kParamFormatPCVideo ); 00071 format->appendOption( kParamFormatNTSC ); 00072 format->appendOption( kParamFormatPAL ); 00073 format->appendOption( kParamFormatHD ); 00074 format->appendOption( kParamFormatNTSC169 ); 00075 format->appendOption( kParamFormatPAL169 ); 00076 format->appendOption( kParamFormat1kSuper35 ); 00077 format->appendOption( kParamFormat1kCinemascope ); 00078 format->appendOption( kParamFormat2kSuper35 ); 00079 format->appendOption( kParamFormat2kCinemascope ); 00080 format->appendOption( kParamFormat4kSuper35 ); 00081 format->appendOption( kParamFormat4kCinemascope ); 00082 format->appendOption( kParamFormatSquare256 ); 00083 format->appendOption( kParamFormatSquare512 ); 00084 format->appendOption( kParamFormatSquare1k ); 00085 format->appendOption( kParamFormatSquare2k ); 00086 format->setDefault( eParamFormat2kCinemascope ); 00087 00088 OFX::BooleanParamDescriptor* specificRatio = desc.defineBooleanParam( kParamSizeSpecificRatio ); 00089 specificRatio->setLabel( "Specific ratio" ); 00090 specificRatio->setDefault( false ); 00091 specificRatio->setHint( "Specific input image ratio." ); 00092 00093 OFX::Int2DParamDescriptor* size = desc.defineInt2DParam( kParamSize ); 00094 size->setLabel( "Size" ); 00095 size->setDefault( 200, 200 ); 00096 size->setRange( 1, 1, std::numeric_limits<int>::max(), std::numeric_limits<int>::max() ); 00097 size->setHint( "Set the output size (width, height)." ); 00098 00099 OFX::ChoiceParamDescriptor* direction = desc.defineChoiceParam( kParamSizeOrientation ); 00100 direction->setLabel( "Orientation" ); 00101 direction->appendOption( kParamSizeOrientationX ); 00102 direction->appendOption( kParamSizeOrientationY ); 00103 direction->setDefault( eParamSizeOrientationX ); 00104 00105 OFX::DoubleParamDescriptor* ratioValue = desc.defineDoubleParam( kParamSizeRatioValue ); 00106 ratioValue->setLabel( "Ratio Value" ); 00107 ratioValue->setDefault( 1.0 ); 00108 ratioValue->setRange( 1, std::numeric_limits<int>::max() ); 00109 ratioValue->setDisplayRange( 0, 50 ); 00110 ratioValue->setHint( "Set the ratio." ); 00111 00112 OFX::IntParamDescriptor* width = desc.defineIntParam( kParamSizeWidth ); 00113 width->setLabel( "Width" ); 00114 width->setDefault( 200 ); 00115 width->setRange( 1, std::numeric_limits<int>::max() ); 00116 width->setDisplayRange( 0, 3000 ); 00117 width->setHint( "Set the width in pixels and specify the ratio." ); 00118 00119 OFX::IntParamDescriptor* height = desc.defineIntParam( kParamSizeHeight ); 00120 height->setLabel( "Height" ); 00121 height->setDefault( 200 ); 00122 height->setRange( 1, std::numeric_limits<int>::max() ); 00123 height->setDisplayRange( 0, 3000 ); 00124 height->setHint( "Set the height in pixels and specify the ratio." ); 00125 00126 } 00127 00128 } 00129 } 00130 00131 00132 #endif 00133