TuttleOFX
1
|
00001 #include "EXRReaderDefinitions.hpp" 00002 #include "EXRReaderPluginFactory.hpp" 00003 #include "EXRReaderPlugin.hpp" 00004 00005 #include <tuttle/plugin/context/ReaderPluginFactory.hpp> 00006 00007 #include <string> 00008 00009 namespace tuttle { 00010 namespace plugin { 00011 namespace exr { 00012 namespace reader { 00013 00014 static const bool kSupportTiles = false; 00015 00016 /** 00017 * @brief Function called to describe the plugin main features. 00018 * @param[in, out] desc Effect descriptor 00019 */ 00020 void EXRReaderPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00021 { 00022 desc.setLabels( 00023 "TuttleExrReader", 00024 "ExrReader", 00025 "Exr file reader" ); 00026 desc.setPluginGrouping( "tuttle/image/io" ); 00027 00028 desc.setDescription( "EXR File reader\n" 00029 "Plugin is used to read exr files.\n" 00030 ); 00031 00032 // add the supported contexts 00033 desc.addSupportedContext( OFX::eContextReader ); 00034 desc.addSupportedContext( OFX::eContextGeneral ); 00035 00036 // add supported pixel depths 00037 desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00038 desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00039 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00040 00041 // add supported extensions 00042 desc.addSupportedExtension( "exr" ); 00043 00044 // plugin flags 00045 desc.setRenderThreadSafety( OFX::eRenderFullySafe ); 00046 desc.setHostFrameThreading( false ); 00047 desc.setSupportsMultiResolution( false ); 00048 desc.setSupportsMultipleClipDepths( true ); 00049 desc.setSupportsTiles( kSupportTiles ); 00050 } 00051 00052 /** 00053 * @brief Function called to describe the plugin controls and features. 00054 * @param[in, out] desc Effect descriptor 00055 * @param[in] context Application context 00056 */ 00057 void EXRReaderPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00058 OFX::EContext context ) 00059 { 00060 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00061 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00062 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00063 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00064 dstClip->setSupportsTiles( kSupportTiles ); 00065 00066 describeReaderParamsInContext( desc, context ); 00067 00068 OFX::ChoiceParamDescriptor* outRedIs = desc.defineChoiceParam( kParamOutputRedIs ); 00069 outRedIs->appendOption( "0" ); 00070 outRedIs->appendOption( "1" ); 00071 outRedIs->appendOption( "2" ); 00072 outRedIs->appendOption( "3" ); 00073 outRedIs->setLabel( "Red is" ); 00074 outRedIs->setDefault( 0 ); 00075 00076 OFX::ChoiceParamDescriptor* outGreenIs = desc.defineChoiceParam( kParamOutputGreenIs ); 00077 outGreenIs->appendOption( "0" ); 00078 outGreenIs->appendOption( "1" ); 00079 outGreenIs->appendOption( "2" ); 00080 outGreenIs->appendOption( "3" ); 00081 outGreenIs->setLabel( "Green is" ); 00082 outGreenIs->setDefault( 0 ); 00083 00084 OFX::ChoiceParamDescriptor* outBlueIs = desc.defineChoiceParam( kParamOutputBlueIs ); 00085 outBlueIs->appendOption( "0" ); 00086 outBlueIs->appendOption( "1" ); 00087 outBlueIs->appendOption( "2" ); 00088 outBlueIs->appendOption( "3" ); 00089 outBlueIs->setLabel( "Blue is" ); 00090 outBlueIs->setDefault( 0 ); 00091 00092 OFX::ChoiceParamDescriptor* outAlphaIs = desc.defineChoiceParam( kParamOutputAlphaIs ); 00093 outAlphaIs->appendOption( "0" ); 00094 outAlphaIs->appendOption( "1" ); 00095 outAlphaIs->appendOption( "2" ); 00096 outAlphaIs->appendOption( "3" ); 00097 outAlphaIs->setLabel( "Alpha is" ); 00098 outAlphaIs->setDefault( 0 ); 00099 00100 OFX::ChoiceParamDescriptor* outputData = desc.defineChoiceParam( kParamOutputData ); 00101 outputData->appendOption( "display" ); 00102 outputData->appendOption( "data" ); 00103 outputData->setLabel( "Output Data" ); 00104 outputData->setDefault( 0 ); 00105 } 00106 00107 /** 00108 * @brief Function called to create a plugin effect instance 00109 * @param[in] handle effect handle 00110 * @param[in] context Application context 00111 * @return plugin instance 00112 */ 00113 OFX::ImageEffect* EXRReaderPluginFactory::createInstance( OfxImageEffectHandle handle, 00114 OFX::EContext context ) 00115 { 00116 return new EXRReaderPlugin( handle ); 00117 } 00118 00119 } 00120 } 00121 } 00122 }