TuttleOFX  1
EXRWriterPluginFactory.cpp
Go to the documentation of this file.
00001 #include "EXRWriterPluginFactory.hpp"
00002 #include "EXRWriterPlugin.hpp"
00003 #include "EXRWriterDefinitions.hpp"
00004 
00005 #include <tuttle/plugin/context/WriterPluginFactory.hpp>
00006 
00007 namespace tuttle {
00008 namespace plugin {
00009 namespace exr {
00010 namespace writer {
00011 
00012 /**
00013  * @brief Function called to describe the plugin main features.
00014  * @param[in, out]   desc     Effect descriptor
00015  */
00016 void EXRWriterPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00017 {
00018         desc.setLabels( "TuttleExrWriter", "ExrWriter",
00019                         "Exr file writer" );
00020         desc.setPluginGrouping( "tuttle/image/io" );
00021 
00022         desc.setDescription( "EXR File writer\n"
00023                              "Plugin is used to write exr files." );
00024 
00025         // add the supported contexts
00026         desc.addSupportedContext( OFX::eContextWriter );
00027         desc.addSupportedContext( OFX::eContextGeneral );
00028 
00029         // add supported pixel depths
00030         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00031         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00032         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00033 
00034         // add supported extensions
00035         desc.addSupportedExtension( "exr" );
00036 
00037         // plugin flags
00038         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00039         desc.setHostFrameThreading( false );
00040         desc.setSupportsMultiResolution( false );
00041         desc.setSupportsMultipleClipDepths( true );
00042         desc.setSupportsTiles( kSupportTiles );
00043 }
00044 
00045 /**
00046  * @brief Function called to describe the plugin controls and features.
00047  * @param[in, out]   desc       Effect descriptor
00048  * @param[in]        context    Application context
00049  */
00050 void EXRWriterPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00051                                                 OFX::EContext               context )
00052 {
00053         OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
00054         srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00055         srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
00056         srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00057         srcClip->setSupportsTiles( kSupportTiles );
00058 
00059         OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00060         dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00061         dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00062         dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00063         dstClip->setSupportsTiles( kSupportTiles );
00064 
00065         describeWriterParamsInContext( desc, context );
00066         
00067         OFX::ChoiceParamDescriptor* storageType = desc.defineChoiceParam( kParamStorageType );
00068         storageType->setLabel( "Storage type" );
00069         storageType->appendOption( kParamStorageScanLine );
00070 #ifndef TUTTLE_PRODUCTION
00071         storageType->appendOption( kParamStorageTiles    );
00072 #endif
00073         storageType->setCacheInvalidation( OFX::eCacheInvalidateValueAll );
00074         storageType->setDefault( eParamStorageScanLine );
00075 
00076         OFX::ChoiceParamDescriptor* bitDepth = static_cast<OFX::ChoiceParamDescriptor*>( desc.getParamDescriptor( kTuttlePluginBitDepth ) );
00077         bitDepth->resetOptions();
00078         bitDepth->appendOption( kTuttlePluginBitDepth16f );
00079         bitDepth->appendOption( kTuttlePluginBitDepth32 );
00080         bitDepth->appendOption( kTuttlePluginBitDepth32f );
00081         bitDepth->setDefault( eTuttlePluginBitDepth32f );
00082 }
00083 
00084 /**
00085  * @brief Function called to create a plugin effect instance
00086  * @param[in] handle  effect handle
00087  * @param[in] context    Application context
00088  * @return  plugin instance
00089  */
00090 OFX::ImageEffect* EXRWriterPluginFactory::createInstance( OfxImageEffectHandle handle,
00091                                                           OFX::EContext        context )
00092 {
00093         return new EXRWriterPlugin( handle );
00094 }
00095 
00096 }
00097 }
00098 }
00099 }
00100