TuttleOFX
1
|
00001 #include "OCIOLutPluginFactory.hpp" 00002 #include "OCIOLutPlugin.hpp" 00003 #include "OCIOLutDefinitions.hpp" 00004 00005 #include <tuttle/plugin/exceptions.hpp> 00006 00007 #include <ofxsImageEffect.h> 00008 #include <ofxsMultiThread.h> 00009 00010 namespace tuttle { 00011 namespace plugin { 00012 namespace ocio{ 00013 namespace lut { 00014 00015 /** 00016 * @brief Function called to describe the plugin main features. 00017 * @param[in, out] desc Effect descriptor 00018 */ 00019 void OCIOLutPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00020 { 00021 desc.setLabels( "TuttleOcioLut", "OCIOLut", "Color transformation through LUT file using OpenColorIO Transform" ); 00022 desc.setPluginGrouping( "tuttle/image/process/color/ocio" ); 00023 00024 desc.setDescription( 00025 "OCIO Lut\n" 00026 "\n" 00027 "Lut input filename (3dl, ccc, cc, csp, cub, cube, hdl, mga, m3d, spi1d, spi3d, spimtx, vf)" ); 00028 00029 // add the supported contexts 00030 desc.addSupportedContext( OFX::eContextGeneral ); 00031 desc.addSupportedContext( OFX::eContextFilter ); 00032 00033 // add supported pixel depths 00034 // desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00035 // desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00036 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00037 00038 desc.setSupportsTiles( kSupportTiles ); 00039 desc.setRenderThreadSafety( OFX::eRenderFullySafe ); 00040 00041 } 00042 00043 /** 00044 * @brief Function called to describe the plugin controls and features. 00045 * @param[in, out] desc Effect descriptor 00046 * @param[in] context Application context 00047 */ 00048 void OCIOLutPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, OFX::EContext context ) 00049 { 00050 OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); 00051 srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );//@todo mfe, test this 00052 //srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );//@todo mfe, add and test this (cf OCIOPlugin.cpp, render) 00053 srcClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00054 srcClip->setSupportsTiles( kSupportTiles ); 00055 00056 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00057 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00058 //dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00059 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00060 dstClip->setSupportsTiles( kSupportTiles ); 00061 00062 // Controls 00063 OFX::StringParamDescriptor* filename = desc.defineStringParam( kTuttlePluginFilename ); 00064 filename->setDefault( "" ); 00065 filename->setLabel( kTuttlePluginFilenameLabel ); 00066 filename->setStringType( OFX::eStringTypeFilePath ); 00067 00068 OFX::ChoiceParamDescriptor* interpolationType = desc.defineChoiceParam( kParamInterpolationType ); 00069 interpolationType->setDefault(eInterpolationTypeLinear); 00070 interpolationType->setLabel( "Interpolation type"); 00071 interpolationType->appendOption( kParamInterpolationNearest ); 00072 interpolationType->appendOption( kParamInterpolationLinear ); 00073 interpolationType->appendOption( kParamInterpolationTetrahedral ); 00074 00075 00076 } 00077 00078 /** 00079 * @brief Function called to create a plugin effect instance 00080 * @param[in] handle effect handle 00081 * @param[in] context Application context 00082 * @return plugin instance 00083 */ 00084 OFX::ImageEffect* OCIOLutPluginFactory::createInstance( OfxImageEffectHandle handle, OFX::EContext context ) 00085 { 00086 return new OCIOLutPlugin( handle ); 00087 } 00088 00089 } 00090 } 00091 } 00092 }