TuttleOFX
1
|
00001 #include "OfxhImageEffectNodeDescriptor.hpp" 00002 #include "OfxhPlugin.hpp" 00003 #include "OfxhPluginBinary.hpp" 00004 00005 #include <tuttle/host/Core.hpp> /// @todo tuttle: please remove this ! (don't use as singleton) 00006 00007 namespace tuttle { 00008 namespace host { 00009 namespace ofx { 00010 namespace imageEffect { 00011 00012 //////////////////////////////////////////////////////////////////////////////// 00013 // descriptor 00014 00015 /// properties common on an effect and a descriptor 00016 static property::OfxhPropSpec effectDescriptorStuff[] = { 00017 /* name type dim. r/o default value */ 00018 { kOfxPropType, property::ePropTypeString, 1, true, kOfxTypeImageEffect }, 00019 { kOfxPropName, property::ePropTypeString, 1, false, "UNIQUE_NAME_NOT_SET" }, 00020 { kOfxPropLabel, property::ePropTypeString, 1, false, "" }, 00021 { kOfxPropShortLabel, property::ePropTypeString, 1, false, "" }, 00022 { kOfxPropLongLabel, property::ePropTypeString, 1, false, "" }, 00023 { kOfxPropPluginDescription, property::ePropTypeString, 1, false, "No plugin description." }, 00024 { kOfxImageEffectPropSupportedContexts, property::ePropTypeString, 0, false, "" }, 00025 { kOfxImageEffectPluginPropGrouping, property::ePropTypeString, 1, false, "" }, 00026 { kOfxImageEffectPluginPropSingleInstance, property::ePropTypeInt, 1, false, "0" }, 00027 { kOfxImageEffectPluginRenderThreadSafety, property::ePropTypeString, 1, false, kOfxImageEffectRenderInstanceSafe }, 00028 { kOfxImageEffectPluginPropHostFrameThreading, property::ePropTypeInt, 1, false, "1" }, 00029 { kOfxImageEffectPluginPropOverlayInteractV1, property::ePropTypePointer, 1, false, NULL }, 00030 { kOfxImageEffectPropSupportsMultiResolution, property::ePropTypeInt, 1, false, "1" }, 00031 { kOfxImageEffectPropSupportsTiles, property::ePropTypeInt, 1, false, "1" }, 00032 { kOfxImageEffectPropTemporalClipAccess, property::ePropTypeInt, 1, false, "0" }, 00033 { kOfxImageEffectPropSupportedPixelDepths, property::ePropTypeString, 0, false, "" }, 00034 { kTuttleOfxImageEffectPropSupportedExtensions, property::ePropTypeString, 0, false, "" }, 00035 { kOfxImageEffectPluginPropFieldRenderTwiceAlways, property::ePropTypeInt, 1, false, "1" }, 00036 { kOfxImageEffectPropSupportsMultipleClipDepths, property::ePropTypeInt, 1, false, "0" }, 00037 { kOfxImageEffectPropSupportsMultipleClipPARs, property::ePropTypeInt, 1, false, "0" }, 00038 { kOfxImageEffectPropClipPreferencesSlaveParam, property::ePropTypeString, 0, false, "" }, 00039 { kOfxImageEffectInstancePropSequentialRender, property::ePropTypeInt, 1, false, "0" }, 00040 { kOfxPluginPropFilePath, property::ePropTypeString, 1, true, "" }, 00041 { 0 } 00042 }; 00043 00044 OfxhImageEffectNodeDescriptor::OfxhImageEffectNodeDescriptor() 00045 : OfxhImageEffectNodeBase( effectDescriptorStuff ) 00046 , _plugin( NULL ) 00047 { 00048 /// @todo tuttle... 00049 } 00050 00051 OfxhImageEffectNodeDescriptor::OfxhImageEffectNodeDescriptor( OfxhPlugin& plug ) 00052 : OfxhImageEffectNodeBase( effectDescriptorStuff ) 00053 , _plugin( &plug ) 00054 { 00055 _properties.setStringProperty( kOfxPluginPropFilePath, plug.getBinary().getBundlePath() ); 00056 tuttle::host::core().getHost().initDescriptor( *this ); 00057 } 00058 00059 OfxhImageEffectNodeDescriptor::OfxhImageEffectNodeDescriptor( const OfxhImageEffectNodeDescriptor& other, OfxhPlugin& plug ) 00060 : OfxhImageEffectNodeBase( other._properties ) 00061 , _plugin( &plug ) 00062 { 00063 _properties.setStringProperty( kOfxPluginPropFilePath, plug.getBinary().getBundlePath() ); 00064 tuttle::host::core().getHost().initDescriptor( *this ); 00065 } 00066 00067 OfxhImageEffectNodeDescriptor::OfxhImageEffectNodeDescriptor( const std::string& bundlePath, OfxhPlugin& plug ) 00068 : OfxhImageEffectNodeBase( effectDescriptorStuff ) 00069 , _plugin( &plug ) 00070 { 00071 _properties.setStringProperty( kOfxPluginPropFilePath, bundlePath ); 00072 tuttle::host::core().getHost().initDescriptor( *this ); 00073 } 00074 00075 OfxhImageEffectNodeDescriptor::~OfxhImageEffectNodeDescriptor() 00076 {} 00077 00078 bool OfxhImageEffectNodeDescriptor::operator==( const This& other ) const 00079 { 00080 if( OfxhImageEffectNodeBase::operator!=( other ) || 00081 attribute::OfxhParamSetDescriptor::operator!=( other ) || 00082 _clipsByOrder != other._clipsByOrder ) 00083 return false; 00084 return true; 00085 } 00086 00087 /** 00088 * @brief create a new clip and add this to the clip map 00089 */ 00090 attribute::OfxhClipImageDescriptor* OfxhImageEffectNodeDescriptor::defineClip( const std::string& name ) 00091 { 00092 attribute::OfxhClipImageDescriptor* c = new attribute::OfxhClipImageDescriptor( name ); 00093 00094 _clips[name] = c; 00095 _clipsByOrder.push_back( c ); 00096 return c; 00097 } 00098 00099 /// @warning tuttle some modifs here, doc needs update 00100 /// get the interact description, this will also call describe on the interact 00101 void OfxhImageEffectNodeDescriptor::initOverlayDescriptor( int bitDepthPerComponent, bool hasAlpha ) 00102 { 00103 if( _overlayDescriptor.getState() == interact::eUninitialised ) 00104 { 00105 OfxPluginEntryPoint* overlayEntryPoint = getOverlayInteractMainEntry(); 00106 // OK, we need to describe it, set the entry point and describe away 00107 _overlayDescriptor.setEntryPoint( overlayEntryPoint ); 00108 _overlayDescriptor.describe( bitDepthPerComponent, hasAlpha ); 00109 } 00110 } 00111 00112 void OfxhImageEffectNodeDescriptor::addClip( const std::string& name, attribute::OfxhClipImageDescriptor* clip ) 00113 { 00114 _clips[name] = clip; 00115 _clipsByOrder.push_back( clip ); 00116 } 00117 00118 } 00119 } 00120 } 00121 } 00122