TuttleOFX
1
|
00001 /* 00002 * OFX Support Library, a library that skins the OFX plug-in API with C++ classes. 00003 * Copyright (C) 2004-2005 The Open Effects Association Ltd 00004 * Author Bruno Nicoletti bruno@thefoundry.co.uk 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * 00009 * Redistributions of source code must retain the above copyright notice, 00010 * this list of conditions and the following disclaimer. 00011 * Redistributions in binary form must reproduce the above copyright notice, 00012 * this list of conditions and the following disclaimer in the documentation 00013 * and/or other materials provided with the distribution. 00014 * Neither the name The Open Effects Association Ltd, nor the names of its 00015 * contributors may be used to endorse or promote products derived from this 00016 * software without specific prior written permission. 00017 * 00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00019 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00020 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00021 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 00022 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00023 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00024 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00025 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00026 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00027 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00028 * 00029 * The Open Effects Association Ltd 00030 * 1 Wardour St 00031 * London W1D 6PA 00032 * England 00033 * 00034 * 00035 */ 00036 00037 /** @file 00038 * 00039 * This file contains headers for classes that are used to validate property sets and make sure they have the right members and default values. 00040 * 00041 */ 00042 00043 #include "ofxsSupportPrivate.h" 00044 #include <cstdarg> 00045 #include <cassert> 00046 00047 /** @brief Null pointer definition */ 00048 #define NULLPTR ( (void*)( 0 ) ) 00049 00050 // #define kOfxsDisableValidation 00051 00052 // disable validation if not a debug build 00053 //#ifndef DEBUG 00054 //#define kOfxsDisableValidation 00055 //#endif 00056 00057 //#define kOfxsDisableValidation 00058 /** @brief OFX namespace 00059 */ 00060 namespace OFX { 00061 00062 /** @brief The validation code has its own namespace */ 00063 namespace Validation { 00064 00065 #ifndef kOfxsDisableValidation 00066 /** @brief Set the vector by getting dimension things specified by ilk from the argp list, used by PropertyDescription ctor */ 00067 static void setVectorFromVarArgs( OFX::PropertyTypeEnum ilk, 00068 int dimension, 00069 va_list& argp, 00070 std::vector<ValueHolder>& vec ) 00071 { 00072 char* vS; 00073 int vI; 00074 double vD; 00075 void* vP; 00076 00077 for( int i = 0; i < dimension; i++ ) 00078 { 00079 switch( ilk ) 00080 { 00081 case eString: 00082 vS = va_arg( argp, char* ); 00083 vec.push_back( vS ); 00084 break; 00085 00086 case eInt: 00087 vI = va_arg( argp, int ); 00088 vec.push_back( vI ); 00089 break; 00090 00091 case ePointer: 00092 vP = va_arg( argp, void* ); 00093 vec.push_back( vP ); 00094 break; 00095 00096 case eDouble: 00097 vD = va_arg( argp, double ); 00098 vec.push_back( vD ); 00099 break; 00100 } 00101 } 00102 } 00103 00104 /** @brief PropertyDescription var-args constructor */ 00105 PropertyDescription::PropertyDescription( const char* name, OFX::PropertyTypeEnum ilk, int dimension, ... ) 00106 : _name( name ), 00107 _exists( false ), 00108 // only set when we have validated it 00109 _dimension( dimension ), 00110 _ilk( ilk ) 00111 { 00112 // go through the var args to extract defaults to check against and values to set to 00113 va_list argp; 00114 00115 va_start( argp, dimension ); 00116 00117 bool going = true; 00118 while( going ) 00119 { 00120 // what is being set ? 00121 DescriptionTag tag = DescriptionTag( va_arg( argp, int ) ); 00122 00123 switch( tag ) 00124 { 00125 case eDescDefault: // we are setting default values to check against 00126 setVectorFromVarArgs( ilk, dimension, argp, _defaultValue ); 00127 break; 00128 00129 case eDescFinished: // we are finished 00130 going = false; 00131 break; 00132 } 00133 } 00134 00135 va_end( argp ); 00136 } 00137 00138 /** @brief See if the property exists in the containing property set and has the correct dimension */ 00139 void PropertyDescription::validate( bool checkDefaults, 00140 PropertySet& propSet ) 00141 { 00142 // see if it exists by fetching the dimension, 00143 00144 try 00145 { 00146 int hostDimension = propSet.propGetDimension( _name.c_str() ); 00147 _exists = true; 00148 00149 if( _dimension != -1 ) // -1 implies variable dimension 00150 OFX::Log::error( hostDimension != _dimension, "Host reports property '%s' has dimension %d, it should be %d;", _name.c_str(), hostDimension, _dimension ); 00151 // check type by getting the first element, the property getting will print any failure messages to the log 00152 00153 if( hostDimension > 0 ) 00154 { 00155 switch( _ilk ) 00156 { 00157 case OFX::ePointer: { 00158 /*void* vP = */propSet.propGetPointer( _name ); 00159 } 00160 break; 00161 case OFX::eInt: { 00162 /*int vI = */propSet.propGetInt( _name ); 00163 } 00164 break; 00165 case OFX::eString: { 00166 /*std::string vS = */propSet.propGetString( _name ); 00167 } 00168 break; 00169 case OFX::eDouble: { 00170 /*double vD = */propSet.propGetDouble( _name ); 00171 } 00172 break; 00173 } 00174 } 00175 00176 // check the defaults are OK, if there are any 00177 int nDefs = _defaultValue.size(); 00178 if( checkDefaults && nDefs > 0 ) 00179 { 00180 OFX::Log::error( hostDimension != nDefs, "Host reports default dimension of '%s' as %d, which is different to the default dimension size of %d;", 00181 _name.c_str(), hostDimension, nDefs ); 00182 00183 int N = hostDimension < nDefs ? hostDimension : nDefs; 00184 00185 for( int i = 0; i < N; i++ ) 00186 { 00187 switch( _ilk ) 00188 { 00189 case OFX::ePointer: { 00190 void* vP = propSet.propGetPointer( _name, i ); 00191 OFX::Log::error( vP != (void*) _defaultValue[i], "Default value of %s[%d] = %p, it should be %p;", 00192 _name.c_str(), i, vP, (void*) _defaultValue[i] ); 00193 } 00194 break; 00195 case OFX::eInt: { 00196 int vI = propSet.propGetInt( _name, i ); 00197 OFX::Log::error( vI != (int) _defaultValue[i], "Default value of %s[%d] = %d, it should be %d;", 00198 _name.c_str(), i, vI, (int) _defaultValue[i] ); 00199 } 00200 break; 00201 case OFX::eString: { 00202 std::string vS = propSet.propGetString( _name, i ); 00203 OFX::Log::error( vS != _defaultValue[i].vString, "Default value of %s[%d] = '%s', it should be '%s';", 00204 _name.c_str(), i, vS.c_str(), _defaultValue[i].vString.c_str() ); 00205 } 00206 break; 00207 case OFX::eDouble: { 00208 double vD = propSet.propGetDouble( _name, i ); 00209 OFX::Log::error( vD != (double) _defaultValue[i], "Default value of %s[%d] = %g, it should be %g;", 00210 _name.c_str(), i, vD, (double) _defaultValue[i] ); 00211 } 00212 break; 00213 } 00214 } 00215 } 00216 } 00217 catch( OFX::Exception::Suite& ) 00218 { 00219 // just catch it, the error will be reported 00220 _exists = false; 00221 } 00222 catch( OFX::Exception::PropertyUnknownToHost& ) 00223 { 00224 // just catch it, the error will be reported 00225 _exists = false; 00226 } 00227 catch( OFX::Exception::PropertyValueIllegalToHost& ) 00228 { 00229 // just catch it, the error will be reported 00230 _exists = false; 00231 } 00232 } 00233 00234 /** @brief This macro is used to short hand passing the var args to @ref OFX::Validation::PropertySetDescription::PropertySetDescription */ 00235 #define mPropDescriptionArg( descs ) descs, sizeof( descs ) / sizeof( PropertyDescription ) 00236 00237 /** @brief A set of property descriptions, constructor 00238 * 00239 * Passed in as a zero terminated pairs of (PropertyDescription *descArray, int nDescriptions) 00240 * 00241 */ 00242 PropertySetDescription::PropertySetDescription( const char* setName, ... ) // PropertyDescription *v, int nV) 00243 : _setName( setName ) 00244 { 00245 00246 // go through the var args to extract defaults to check against and values to set to 00247 va_list argp; 00248 00249 va_start( argp, setName ); 00250 00251 // bool going = true; 00252 while( 1 ) 00253 { 00254 // get a pointer 00255 PropertyDescription* descs = (PropertyDescription*) va_arg( argp, PropertyDescription* ); 00256 00257 // have we finished 00258 if( !descs ) 00259 break; 00260 00261 // get the count 00262 int nDescs = (int) va_arg( argp, int ); 00263 00264 // and set it up 00265 for( int i = 0; i < nDescs; i++ ) 00266 { 00267 _descriptions.push_back( descs + i ); 00268 } 00269 00270 } 00271 00272 va_end( argp ); 00273 } 00274 00275 /** @brief destructor */ 00276 PropertySetDescription::~PropertySetDescription() 00277 { 00278 int nToDelete = _deleteThese.size(); 00279 00280 for( int i = 0; i < nToDelete; i++ ) 00281 { 00282 delete _deleteThese[i]; 00283 } 00284 } 00285 00286 /** @brief Add more properties into the property vector */ 00287 void PropertySetDescription::addProperty( PropertyDescription* desc, 00288 bool deleteOnDestruction ) 00289 { 00290 _descriptions.push_back( desc ); 00291 if( deleteOnDestruction ) 00292 _deleteThese.push_back( desc ); 00293 } 00294 00295 /** @brief Validate all the properties in the set */ 00296 void PropertySetDescription::validate( OFX::PropertySet& propSet, 00297 bool checkDefaults, 00298 bool logOrdinaryMessages ) 00299 { 00300 OFX::Log::print( "START validating properties of %s.", _setName.c_str() ); 00301 OFX::Log::indent(); 00302 00303 // don't print ordinary messages whilst we are checking them 00304 if( !logOrdinaryMessages ) 00305 PropertySet::propDisableLogging(); 00306 00307 // check each property in the description 00308 int n = _descriptions.size(); 00309 for( int i = 0; i < n; i++ ) 00310 { 00311 assert( _descriptions[i] ); 00312 _descriptions[i]->validate( checkDefaults, propSet ); 00313 } 00314 00315 if( !logOrdinaryMessages ) 00316 PropertySet::propEnableLogging(); 00317 00318 OFX::Log::outdent(); 00319 OFX::Log::print( "STOP property validation of %s.", _setName.c_str() ); 00320 } 00321 00322 /** @brief A list of properties that all hosts must have, and will be validated against. None of these has a default, but they must exist. */ 00323 static PropertyDescription gHostProps[] = 00324 { 00325 // single dimensional string properties 00326 PropertyDescription( kOfxPropType, OFX::eString, 1, eDescFinished ), 00327 PropertyDescription( kOfxPropName, OFX::eString, 1, eDescFinished ), 00328 PropertyDescription( kOfxPropLabel, OFX::eString, 1, eDescFinished ), 00329 00330 // single dimensional int properties 00331 PropertyDescription( kOfxImageEffectHostPropIsBackground, OFX::eInt, 1, eDescFinished ), 00332 PropertyDescription( kOfxImageEffectPropSupportsOverlays, OFX::eInt, 1, eDescFinished ), 00333 PropertyDescription( kOfxImageEffectPropSupportsMultiResolution, OFX::eInt, 1, eDescFinished ), 00334 PropertyDescription( kOfxImageEffectPropSupportsTiles, OFX::eInt, 1, eDescFinished ), 00335 PropertyDescription( kOfxImageEffectPropTemporalClipAccess, OFX::eInt, 1, eDescFinished ), 00336 PropertyDescription( kOfxImageEffectPropSupportsMultipleClipDepths, OFX::eInt, 1, eDescFinished ), 00337 PropertyDescription( kOfxImageEffectPropSupportsMultipleClipPARs, OFX::eInt, 1, eDescFinished ), 00338 PropertyDescription( kOfxImageEffectPropSetableFrameRate, OFX::eInt, 1, eDescFinished ), 00339 PropertyDescription( kOfxImageEffectPropSetableFielding, OFX::eInt, 1, eDescFinished ), 00340 PropertyDescription( kOfxParamHostPropSupportsStringAnimation, OFX::eInt, 1, eDescFinished ), 00341 PropertyDescription( kOfxParamHostPropSupportsCustomInteract, OFX::eInt, 1, eDescFinished ), 00342 PropertyDescription( kOfxParamHostPropSupportsChoiceAnimation, OFX::eInt, 1, eDescFinished ), 00343 PropertyDescription( kOfxParamHostPropSupportsBooleanAnimation, OFX::eInt, 1, eDescFinished ), 00344 PropertyDescription( kOfxParamHostPropSupportsCustomAnimation, OFX::eInt, 1, eDescFinished ), 00345 PropertyDescription( kOfxParamHostPropMaxParameters, OFX::eInt, 1, eDescFinished ), 00346 PropertyDescription( kOfxParamHostPropMaxPages, OFX::eInt, 1, eDescFinished ), 00347 00348 // variable multi dimensional string properties 00349 PropertyDescription( kOfxImageEffectPropSupportedComponents, OFX::eString, -1, eDescFinished ), 00350 PropertyDescription( kOfxImageEffectPropSupportedContexts, OFX::eString, -1, eDescFinished ), 00351 00352 // multi dimensional int properities 00353 PropertyDescription( kOfxParamHostPropPageRowColumnCount, OFX::eInt, 2, eDescFinished ), 00354 }; 00355 00356 /** @brief the property set for the global host pointer */ 00357 static PropertySetDescription gHostPropSet( "Host Property", 00358 gHostProps, sizeof( gHostProps ) / sizeof( PropertyDescription ), 00359 NULLPTR ); 00360 00361 /** @brief A list of properties to validate the effect descriptor against */ 00362 static PropertyDescription gPluginDescriptorProps[] = 00363 { 00364 // string props that have no defaults that can be checked against 00365 PropertyDescription( kOfxPropLabel, OFX::eString, 1, eDescFinished ), 00366 PropertyDescription( kOfxPropShortLabel, OFX::eString, 1, eDescFinished ), 00367 PropertyDescription( kOfxPropLongLabel, OFX::eString, 1, eDescFinished ), 00368 PropertyDescription( kOfxPropPluginDescription, OFX::eString, 1, eDescFinished ), 00369 PropertyDescription( kOfxImageEffectPluginPropGrouping, OFX::eString, 1, eDescFinished ), 00370 PropertyDescription( kOfxPluginPropFilePath, OFX::eString, 1, eDescFinished ), 00371 00372 // string props with defaults that can be checked against 00373 PropertyDescription( kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeImageEffect, eDescFinished ), 00374 PropertyDescription( kOfxImageEffectPluginRenderThreadSafety, OFX::eString, 1, eDescDefault, kOfxImageEffectRenderFullySafe, eDescFinished ), 00375 00376 // int props with defaults that can be checked against 00377 PropertyDescription( kOfxImageEffectPluginPropSingleInstance, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00378 PropertyDescription( kOfxImageEffectPluginPropHostFrameThreading, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00379 PropertyDescription( kOfxImageEffectPropSupportsMultiResolution, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00380 PropertyDescription( kOfxImageEffectPropSupportsTiles, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00381 PropertyDescription( kOfxImageEffectPropTemporalClipAccess, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00382 PropertyDescription( kOfxImageEffectPluginPropFieldRenderTwiceAlways, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00383 PropertyDescription( kOfxImageEffectPropSupportsMultipleClipDepths, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00384 PropertyDescription( kOfxImageEffectPropSupportsMultipleClipPARs, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00385 00386 // Pointer props with defaults that can be checked against 00387 PropertyDescription( kOfxImageEffectPluginPropOverlayInteractV1, OFX::ePointer, 1, eDescDefault, ( void* )( 0 ), eDescFinished ), 00388 00389 // string props that have variable dimension, and can't be checked against for defaults 00390 PropertyDescription( kOfxImageEffectPropSupportedContexts, OFX::eString, -1, eDescFinished ), 00391 PropertyDescription( kOfxImageEffectPropSupportedPixelDepths, OFX::eString, -1, eDescFinished ), 00392 PropertyDescription( kTuttleOfxImageEffectPropSupportedExtensions, OFX::eString, -1, eDescFinished ), 00393 PropertyDescription( kOfxImageEffectPropClipPreferencesSlaveParam, OFX::eString, -1, eDescFinished ), 00394 }; 00395 00396 /** @brief the property set for the global plugin descriptor */ 00397 static PropertySetDescription gPluginDescriptorPropSet( "Plugin Descriptor", 00398 gPluginDescriptorProps, sizeof( gPluginDescriptorProps ) / sizeof( PropertyDescription ), 00399 NULLPTR ); 00400 00401 /** @brief A list of properties to validate the plugin instance */ 00402 static PropertyDescription gPluginInstanceProps[] = 00403 { 00404 // string props with defaults that can be checked against 00405 PropertyDescription( kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeImageEffectInstance, eDescFinished ), 00406 00407 // int props with defaults that can be checked against 00408 PropertyDescription( kOfxImageEffectInstancePropSequentialRender, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00409 00410 // Pointer props with defaults that can be checked against 00411 PropertyDescription( kOfxPropInstanceData, OFX::ePointer, 1, eDescDefault, ( void* )( 0 ), eDescFinished ), 00412 PropertyDescription( kOfxImageEffectPropPluginHandle, OFX::ePointer, eDescFinished ), 00413 00414 // string props that have no defaults that can be checked against 00415 PropertyDescription( kOfxImageEffectPropContext, OFX::eString, 1, eDescFinished ), 00416 00417 // int props with not defaults that can be checked against 00418 PropertyDescription( kOfxPropIsInteractive, OFX::eInt, 1, eDescFinished ), 00419 00420 // double props that can't be checked against for defaults 00421 PropertyDescription( kOfxImageEffectPropProjectSize, OFX::eDouble, 2, eDescFinished ), 00422 PropertyDescription( kOfxImageEffectPropProjectExtent, OFX::eDouble, 2, eDescFinished ), 00423 PropertyDescription( kOfxImageEffectPropProjectOffset, OFX::eDouble, 2, eDescFinished ), 00424 PropertyDescription( kOfxImageEffectPropProjectPixelAspectRatio, OFX::eDouble, 1, eDescFinished ), 00425 PropertyDescription( kOfxImageEffectInstancePropEffectDuration, OFX::eDouble, 1, eDescFinished ), 00426 PropertyDescription( kOfxImageEffectPropFrameRate, OFX::eDouble, 1, eDescFinished ), 00427 }; 00428 00429 /** @brief the property set for a plugin instance */ 00430 static PropertySetDescription gPluginInstancePropSet( "Plugin Instance", 00431 gPluginInstanceProps, sizeof( gPluginInstanceProps ) / sizeof( PropertyDescription ), 00432 NULLPTR ); 00433 00434 /** @brief A list of properties to validate a clip descriptor */ 00435 static PropertyDescription gClipDescriptorProps[] = 00436 { 00437 // string props with checkable defaults 00438 PropertyDescription( kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeClip, eDescFinished ), 00439 PropertyDescription( kOfxImageClipPropFieldExtraction, OFX::eString, 1, eDescDefault, kOfxImageFieldDoubled, eDescFinished ), 00440 00441 // string props with no checkable defaults 00442 PropertyDescription( kOfxImageEffectPropSupportedComponents, OFX::eString, -1, eDescFinished ), 00443 PropertyDescription( kOfxPropName, OFX::eString, 1, eDescFinished ), 00444 PropertyDescription( kOfxPropLabel, OFX::eString, 1, eDescFinished ), 00445 PropertyDescription( kOfxPropShortLabel, OFX::eString, 1, eDescFinished ), 00446 PropertyDescription( kOfxPropLongLabel, OFX::eString, 1, eDescFinished ), 00447 00448 // int props with checkable defaults 00449 PropertyDescription( kOfxImageEffectPropTemporalClipAccess, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00450 PropertyDescription( kOfxImageClipPropOptional, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00451 PropertyDescription( kOfxImageClipPropIsMask, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00452 PropertyDescription( kOfxImageEffectPropSupportsTiles, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00453 }; 00454 00455 /** @brief the property set for a clip descriptor */ 00456 static PropertySetDescription gClipDescriptorPropSet( "Clip Descriptor", 00457 gClipDescriptorProps, sizeof( gClipDescriptorProps ) / sizeof( PropertyDescription ), 00458 NULLPTR ); 00459 00460 /** @brief A list of properties to validate a clip instance */ 00461 static PropertyDescription gClipInstanceProps[] = 00462 { 00463 // we can only validate this one against a fixed default 00464 PropertyDescription( kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeClip, eDescFinished ), 00465 00466 // the rest are set by the plugin during description or by the host 00467 PropertyDescription( kOfxPropName, OFX::eString, 1, eDescFinished ), 00468 PropertyDescription( kOfxPropLabel, OFX::eString, 1, eDescFinished ), 00469 PropertyDescription( kOfxPropShortLabel, OFX::eString, 1, eDescFinished ), 00470 PropertyDescription( kOfxPropLongLabel, OFX::eString, 1, eDescFinished ), 00471 PropertyDescription( kOfxImageEffectPropSupportedComponents, OFX::eString, -1, eDescFinished ), 00472 PropertyDescription( kOfxImageClipPropFieldExtraction, OFX::eString, 1, eDescFinished ), 00473 PropertyDescription( kOfxImageEffectPropPixelDepth, OFX::eString, 1, eDescFinished ), 00474 PropertyDescription( kOfxImageEffectPropComponents, OFX::eString, 1, eDescFinished ), 00475 PropertyDescription( kOfxImageClipPropUnmappedPixelDepth, OFX::eString, 1, eDescFinished ), 00476 PropertyDescription( kOfxImageClipPropUnmappedComponents, OFX::eString, 1, eDescFinished ), 00477 PropertyDescription( kOfxImageEffectPropPreMultiplication, OFX::eString, 1, eDescFinished ), 00478 PropertyDescription( kOfxImageClipPropFieldOrder, OFX::eString, 1, eDescFinished ), 00479 00480 // int props 00481 PropertyDescription( kOfxImageEffectPropTemporalClipAccess, OFX::eInt, 1, eDescFinished ), 00482 PropertyDescription( kOfxImageClipPropOptional, OFX::eInt, 1, eDescFinished ), 00483 PropertyDescription( kOfxImageClipPropIsMask, OFX::eInt, 1, eDescFinished ), 00484 PropertyDescription( kOfxImageEffectPropSupportsTiles, OFX::eInt, 1, eDescFinished ), 00485 PropertyDescription( kOfxImageClipPropConnected, OFX::eInt, 1, eDescFinished ), 00486 PropertyDescription( kOfxImageClipPropContinuousSamples, OFX::eInt, 1, eDescFinished ), 00487 00488 // double props 00489 PropertyDescription( kOfxImagePropPixelAspectRatio, OFX::eDouble, 1, eDescFinished ), 00490 PropertyDescription( kOfxImageEffectPropFrameRate, OFX::eDouble, 1, eDescFinished ), 00491 PropertyDescription( kOfxImageEffectPropFrameRange, OFX::eDouble, 2, eDescFinished ), 00492 PropertyDescription( kOfxImageEffectPropUnmappedFrameRate, OFX::eDouble, 1, eDescFinished ), 00493 PropertyDescription( kOfxImageEffectPropUnmappedFrameRange, OFX::eDouble, 2, eDescFinished ), 00494 }; 00495 00496 /** @brief the property set for a clip instance */ 00497 static PropertySetDescription gClipInstancePropSet( "Clip Instance", gClipInstanceProps, sizeof( gClipInstanceProps ) / sizeof( PropertyDescription ), 00498 NULLPTR ); 00499 00500 /** @brief List of properties to validate an image instance */ 00501 static PropertyDescription gImageInstanceProps[] = 00502 { 00503 // this is the only property with a checkable default 00504 PropertyDescription( kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeImage, eDescFinished ), 00505 00506 // all other properties are set by the host 00507 PropertyDescription( kOfxImageEffectPropPixelDepth, OFX::eString, 1, eDescFinished ), 00508 PropertyDescription( kOfxImageEffectPropComponents, OFX::eString, 1, eDescFinished ), 00509 PropertyDescription( kOfxImageEffectPropPreMultiplication, OFX::eString, 1, eDescFinished ), 00510 PropertyDescription( kOfxImagePropField, OFX::eString, 1, eDescFinished ), 00511 PropertyDescription( kOfxImagePropUniqueIdentifier, OFX::eString, 1, eDescFinished ), 00512 00513 // double props 00514 PropertyDescription( kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished ), 00515 PropertyDescription( kOfxImagePropPixelAspectRatio, OFX::eDouble, 1, eDescFinished ), 00516 00517 // pointer props 00518 PropertyDescription( kOfxImagePropData, OFX::ePointer, 1, eDescFinished ), 00519 00520 // int props 00521 PropertyDescription( kOfxImagePropBounds, OFX::eInt, 4, eDescFinished ), 00522 PropertyDescription( kOfxImagePropRegionOfDefinition, OFX::eInt, 4, eDescFinished ), 00523 PropertyDescription( kOfxImagePropRowBytes, OFX::eInt, 1, eDescFinished ), 00524 }; 00525 00526 /** @brief the property set for an image instance */ 00527 static PropertySetDescription gImageInstancePropSet( "Image Instance", 00528 gImageInstanceProps, sizeof( gImageInstanceProps ) / sizeof( PropertyDescription ), 00529 NULLPTR ); 00530 00531 //////////////////////////////////////////////////////////////////////////////// 00532 // Action in/out args properties 00533 //////////////////////////////////////////////////////////////////////////////// 00534 00535 /** @brief kOfxImageEffectActionDescribeInContext actions's inargs properties */ 00536 static PropertyDescription gDescribeInContextActionInArgProps[] = 00537 { 00538 PropertyDescription( kOfxImageEffectPropContext, OFX::eString, 1, eDescFinished ), 00539 }; 00540 00541 /** @brief the property set for describe in context action */ 00542 static PropertySetDescription gDescribeInContextActionInArgPropSet( kOfxImageEffectActionDescribeInContext " in argument", 00543 gDescribeInContextActionInArgProps, sizeof( gDescribeInContextActionInArgProps ) / sizeof( PropertyDescription ), 00544 NULLPTR ); 00545 00546 /** @brief kOfxImageEffectActionRender action's inargs properties */ 00547 static PropertyDescription gRenderActionInArgProps[] = 00548 { 00549 PropertyDescription( kOfxPropTime, OFX::eDouble, 1, eDescFinished ), 00550 PropertyDescription( kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished ), 00551 PropertyDescription( kOfxImageEffectPropRenderWindow, OFX::eInt, 4, eDescFinished ), 00552 PropertyDescription( kOfxImageEffectPropFieldToRender, OFX::eString, 1, eDescFinished ), 00553 }; 00554 00555 /** @brief kOfxImageEffectActionRender property set */ 00556 static PropertySetDescription gRenderActionInArgPropSet( kOfxImageEffectActionRender " in argument", 00557 gRenderActionInArgProps, sizeof( gRenderActionInArgProps ) / sizeof( PropertyDescription ), 00558 NULLPTR ); 00559 00560 /** @brief kOfxImageEffectActionBeginSequenceRender action's inargs properties */ 00561 static PropertyDescription gBeginSequenceRenderActionInArgProps[] = 00562 { 00563 PropertyDescription( kOfxImageEffectPropFrameRange, OFX::eDouble, 2, eDescFinished ), 00564 PropertyDescription( kOfxImageEffectPropFrameStep, OFX::eDouble, 1, eDescFinished ), 00565 PropertyDescription( kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished ), 00566 PropertyDescription( kOfxPropIsInteractive, OFX::eInt, 1, eDescFinished ), 00567 }; 00568 00569 /** @brief kOfxImageEffectActionBeginSequenceRender property set */ 00570 static PropertySetDescription gBeginSequenceRenderActionInArgPropSet( kOfxImageEffectActionBeginSequenceRender " in argument", 00571 gBeginSequenceRenderActionInArgProps, sizeof( gBeginSequenceRenderActionInArgProps ) / sizeof( PropertyDescription ), 00572 NULLPTR ); 00573 00574 /** @brief kOfxImageEffectActionEndSequenceRender action's inargs properties */ 00575 static PropertyDescription gEndSequenceRenderActionInArgProps[] = 00576 { 00577 PropertyDescription( kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished ), 00578 PropertyDescription( kOfxPropIsInteractive, OFX::eInt, 1, eDescFinished ), 00579 }; 00580 00581 /** @brief kOfxImageEffectActionEndSequenceRender property set */ 00582 static PropertySetDescription gEndSequenceRenderActionInArgPropSet( kOfxImageEffectActionEndSequenceRender " in argument", 00583 gEndSequenceRenderActionInArgProps, sizeof( gEndSequenceRenderActionInArgProps ) / sizeof( PropertyDescription ), 00584 NULLPTR ); 00585 00586 /** @brief kOfxImageEffectActionIsIdentity action's inargs properties */ 00587 static PropertyDescription gIsIdentityActionInArgProps[] = 00588 { 00589 PropertyDescription( kOfxPropTime, OFX::eDouble, 1, eDescFinished ), 00590 PropertyDescription( kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished ), 00591 PropertyDescription( kOfxImageEffectPropRenderWindow, OFX::eInt, 4, eDescFinished ), 00592 PropertyDescription( kOfxImageEffectPropFieldToRender, OFX::eString, 1, eDescFinished ), 00593 }; 00594 00595 /** @brief kOfxImageEffectActionIsIdentity property set */ 00596 static PropertySetDescription gIsIdentityActionInArgPropSet( kOfxImageEffectActionIsIdentity " in argument", 00597 gIsIdentityActionInArgProps, sizeof( gIsIdentityActionInArgProps ) / sizeof( PropertyDescription ), 00598 NULLPTR ); 00599 00600 /** @brief kOfxImageEffectActionIsIdentity action's outargs properties */ 00601 static PropertyDescription gIsIdentityActionOutArgProps[] = 00602 { 00603 PropertyDescription( kOfxPropTime, OFX::eDouble, 1, eDescFinished ), 00604 PropertyDescription( kOfxPropName, OFX::eString, 1, eDescFinished ), 00605 }; 00606 00607 /** @brief kOfxImageEffectActionIsIdentity property set */ 00608 static PropertySetDescription gIsIdentityActionOutArgPropSet( kOfxImageEffectActionIsIdentity " out argument", 00609 gIsIdentityActionOutArgProps, sizeof( gIsIdentityActionOutArgProps ) / sizeof( PropertyDescription ), 00610 NULLPTR ); 00611 00612 /** @brief kOfxImageEffectActionGetRegionOfDefinition action's inargs properties */ 00613 static PropertyDescription gGetRegionOfDefinitionInArgProps[] = 00614 { 00615 PropertyDescription( kOfxPropTime, OFX::eDouble, 1, eDescFinished ), 00616 PropertyDescription( kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished ), 00617 }; 00618 00619 /** @brief kOfxImageEffectActionGetRegionOfDefinition property set */ 00620 static PropertySetDescription gGetRegionOfDefinitionInArgPropSet( kOfxImageEffectActionGetRegionOfDefinition " in argument", 00621 gGetRegionOfDefinitionInArgProps, sizeof( gGetRegionOfDefinitionInArgProps ) / sizeof( PropertyDescription ), 00622 NULLPTR ); 00623 00624 /** @brief kOfxImageEffectActionGetRegionOfDefinition action's outargs properties */ 00625 static PropertyDescription gGetRegionOfDefinitionOutArgProps[] = 00626 { 00627 PropertyDescription( kOfxImageEffectPropRegionOfDefinition, OFX::eDouble, 4, eDescFinished ), 00628 }; 00629 00630 /** @brief kOfxImageEffectActionGetRegionOfDefinition property set */ 00631 static PropertySetDescription gGetRegionOfDefinitionOutArgPropSet( kOfxImageEffectActionGetRegionOfDefinition " out argument", 00632 gGetRegionOfDefinitionOutArgProps, sizeof( gGetRegionOfDefinitionOutArgProps ) / sizeof( PropertyDescription ), 00633 NULLPTR ); 00634 00635 /** @brief kOfxImageEffectActionGetRegionsOfInterest action's inargs properties */ 00636 static PropertyDescription gGetRegionOfInterestInArgProps[] = 00637 { 00638 PropertyDescription( kOfxPropTime, OFX::eDouble, 1, eDescFinished ), 00639 PropertyDescription( kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished ), 00640 PropertyDescription( kOfxImageEffectPropRegionOfInterest, OFX::eDouble, 4, eDescFinished ), 00641 }; 00642 00643 /** @brief kOfxImageEffectActionGetRegionsOfInterest property set */ 00644 static PropertySetDescription gGetRegionOfInterestInArgPropSet( kOfxImageEffectActionGetRegionsOfInterest "in argument", 00645 gGetRegionOfInterestInArgProps, sizeof( gGetRegionOfInterestInArgProps ) / sizeof( PropertyDescription ), 00646 NULLPTR ); 00647 00648 /** @brief kOfxImageEffectActionGetTimeDomain action's outargs properties */ 00649 static PropertyDescription gGetTimeDomainOutArgProps[] = 00650 { 00651 PropertyDescription( kOfxImageEffectPropFrameRange, OFX::eDouble, 2, eDescFinished ), 00652 }; 00653 00654 /** @brief kOfxImageEffectActionGetTimeDomain property set */ 00655 static PropertySetDescription gGetTimeDomainOutArgPropSet( kOfxImageEffectActionGetTimeDomain " out argument", 00656 gGetTimeDomainOutArgProps, sizeof( gGetTimeDomainOutArgProps ) / sizeof( PropertyDescription ), 00657 NULLPTR ); 00658 00659 /** @brief kOfxImageEffectActionGetFramesNeeded action's inargs properties */ 00660 static PropertyDescription gGetFramesNeededInArgProps[] = 00661 { 00662 PropertyDescription( kOfxPropTime, OFX::eDouble, 1, eDescFinished ), 00663 }; 00664 00665 /** @brief kOfxImageEffectActionGetFramesNeeded property set */ 00666 static PropertySetDescription gGetFramesNeededInArgPropSet( kOfxImageEffectActionGetFramesNeeded " in argument", 00667 gGetFramesNeededInArgProps, sizeof( gGetFramesNeededInArgProps ) / sizeof( PropertyDescription ), 00668 NULLPTR ); 00669 00670 /** @brief kOfxImageEffectActionGetClipPreferences action's outargs properties */ 00671 static PropertyDescription gGetClipPreferencesOutArgProps[] = 00672 { 00673 PropertyDescription( kOfxImageEffectPropFrameRate, OFX::eDouble, 1, eDescFinished ), 00674 PropertyDescription( kOfxImagePropPixelAspectRatio, OFX::eDouble, 1, eDescFinished ), 00675 PropertyDescription( kOfxImageClipPropContinuousSamples, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00676 PropertyDescription( kOfxImageEffectFrameVarying, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00677 PropertyDescription( kOfxImageEffectPropPreMultiplication, OFX::eString, 1, eDescFinished ), 00678 }; 00679 00680 /** @brief kOfxImageEffectActionGetClipPreferences property set */ 00681 static PropertySetDescription gGetClipPreferencesOutArgPropSet( kOfxImageEffectActionGetClipPreferences " out argument", 00682 gGetClipPreferencesOutArgProps, sizeof( gGetClipPreferencesOutArgProps ) / sizeof( PropertyDescription ), 00683 NULLPTR ); 00684 00685 /** @brief kOfxActionInstanceChanged action's inargs properties */ 00686 static PropertyDescription gInstanceChangedInArgProps[] = 00687 { 00688 PropertyDescription( kOfxPropType, OFX::eString, 1, eDescFinished ), 00689 PropertyDescription( kOfxPropName, OFX::eString, 1, eDescFinished ), 00690 PropertyDescription( kOfxPropChangeReason, OFX::eString, 1, eDescFinished ), 00691 PropertyDescription( kOfxPropTime, OFX::eDouble, 1, eDescFinished ), 00692 PropertyDescription( kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished ), 00693 }; 00694 00695 /** @brief kOfxActionInstanceChanged property set */ 00696 static PropertySetDescription gInstanceChangedInArgPropSet( kOfxActionInstanceChanged " in argument", 00697 gInstanceChangedInArgProps, sizeof( gInstanceChangedInArgProps ) / sizeof( PropertyDescription ), 00698 NULLPTR ); 00699 00700 /** @brief kOfxActionBeginInstanceChanged and kOfxActionEndInstanceChanged actions' inargs properties */ 00701 static PropertyDescription gBeginEndInstanceChangedInArgProps[] = 00702 { 00703 PropertyDescription( kOfxPropChangeReason, OFX::eString, 1, eDescFinished ), 00704 }; 00705 00706 /** @brief kOfxActionBeginInstanceChanged property set */ 00707 static PropertySetDescription gBeginInstanceChangedInArgPropSet( kOfxActionBeginInstanceChanged " in argument", 00708 gBeginEndInstanceChangedInArgProps, sizeof( gBeginEndInstanceChangedInArgProps ) / sizeof( PropertyDescription ), 00709 NULLPTR ); 00710 /** @brief kOfxActionEndInstanceChanged property set */ 00711 static PropertySetDescription gEndInstanceChangedInArgPropSet( kOfxActionEndInstanceChanged " in argument", 00712 gBeginEndInstanceChangedInArgProps, sizeof( gBeginEndInstanceChangedInArgProps ) / sizeof( PropertyDescription ), 00713 NULLPTR ); 00714 00715 //////////////////////////////////////////////////////////////////////////////// 00716 // parameter properties 00717 //////////////////////////////////////////////////////////////////////////////// 00718 00719 /** @brief Basic parameter descriptor properties */ 00720 static PropertyDescription gBasicParamProps[] = 00721 { 00722 PropertyDescription( kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeParameter, eDescFinished ), 00723 PropertyDescription( kOfxPropName, OFX::eString, 1, eDescFinished ), 00724 PropertyDescription( kOfxPropLabel, OFX::eString, 1, eDescFinished ), 00725 PropertyDescription( kOfxPropShortLabel, OFX::eString, 1, eDescFinished ), 00726 PropertyDescription( kOfxPropLongLabel, OFX::eString, 1, eDescFinished ), 00727 PropertyDescription( kOfxParamPropType, OFX::eString, 1, eDescFinished ), 00728 PropertyDescription( kOfxParamPropSecret, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00729 PropertyDescription( kOfxParamPropCanUndo, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00730 PropertyDescription( kOfxParamPropHint, OFX::eString, 1, eDescFinished ), 00731 PropertyDescription( kOfxParamPropScriptName, OFX::eString, 1, eDescFinished ), 00732 PropertyDescription( kOfxParamPropParent, OFX::eString, 1, eDescFinished ), 00733 PropertyDescription( kOfxParamPropEnabled, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00734 PropertyDescription( kOfxParamPropDataPtr, OFX::ePointer, 1, eDescDefault, ( void* )( 0 ), eDescFinished ), 00735 }; 00736 00737 /** @brief Props for params that can have an interact override their UI */ 00738 static PropertyDescription gInteractOverideParamProps[] = 00739 { 00740 PropertyDescription( kOfxParamPropInteractV1, OFX::ePointer, 1, eDescDefault, ( void* )( 0 ), eDescFinished ), 00741 PropertyDescription( kOfxParamPropInteractSize, OFX::eDouble, 2, eDescFinished ), 00742 PropertyDescription( kOfxParamPropInteractSizeAspect, OFX::eDouble, 1, eDescDefault, 1.0, eDescFinished ), 00743 PropertyDescription( kOfxParamPropInteractMinimumSize, OFX::eInt, 2, eDescDefault, 10, 10, eDescFinished ), 00744 PropertyDescription( kOfxParamPropInteractPreferedSize, OFX::eInt, 2, eDescDefault, 10, 10, eDescFinished ), 00745 }; 00746 00747 /** @brief Props for params that can hold values. */ 00748 static PropertyDescription gValueHolderParamProps[] = 00749 { 00750 PropertyDescription( kOfxParamPropIsAnimating, OFX::eInt, 1, eDescFinished ), 00751 PropertyDescription( kOfxParamPropIsAutoKeying, OFX::eInt, 1, eDescFinished ), 00752 PropertyDescription( kOfxParamPropPersistant, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00753 PropertyDescription( kOfxParamPropEvaluateOnChange, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00754 PropertyDescription( kOfxParamPropPluginMayWrite, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00755 PropertyDescription( kOfxParamPropCacheInvalidation, OFX::eString, 1, eDescDefault, kOfxParamInvalidateValueChange, eDescFinished ), 00756 }; 00757 00758 /** @brief values for a string param */ 00759 static PropertyDescription gStringParamProps[] = 00760 { 00761 PropertyDescription( kOfxParamPropDefault, OFX::eString, 1, eDescFinished ), 00762 PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00763 PropertyDescription( kOfxParamPropStringMode, OFX::eString, 1, eDescDefault, kOfxParamStringIsSingleLine, eDescFinished ), 00764 PropertyDescription( kOfxParamPropStringFilePathExists, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00765 }; 00766 00767 /** @brief values for a string param */ 00768 static PropertyDescription gCustomParamProps[] = 00769 { 00770 PropertyDescription( kOfxParamPropDefault, OFX::eString, 1, eDescFinished ), 00771 PropertyDescription( kOfxParamPropCustomInterpCallbackV1, OFX::ePointer, 1, eDescDefault, NULLPTR, eDescFinished ), 00772 }; 00773 00774 /** @brief properties for an RGB colour param */ 00775 static PropertyDescription gRGBColourParamProps[] = 00776 { 00777 PropertyDescription( kOfxParamPropDefault, OFX::eDouble, 3, eDescFinished ), 00778 PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00779 }; 00780 00781 /** @brief properties for an RGBA colour param */ 00782 static PropertyDescription gRGBAColourParamProps[] = 00783 { 00784 PropertyDescription( kOfxParamPropDefault, OFX::eDouble, 4, eDescFinished ), 00785 PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00786 }; 00787 00788 /** @brief properties for a boolean param */ 00789 static PropertyDescription gBooleanParamProps[] = 00790 { 00791 PropertyDescription( kOfxParamPropDefault, OFX::eInt, 1, eDescFinished ), 00792 PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00793 }; 00794 00795 /** @brief properties for a boolean param */ 00796 static PropertyDescription gChoiceParamProps[] = 00797 { 00798 PropertyDescription( kOfxParamPropDefault, OFX::eInt, 1, eDescFinished ), 00799 PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00800 PropertyDescription( kOfxParamPropChoiceOption, OFX::eString, -1, eDescFinished ), 00801 }; 00802 00803 /** @brief properties for a 1D integer param */ 00804 static PropertyDescription gInt1DParamProps[] = 00805 { 00806 PropertyDescription( kOfxParamPropDefault, OFX::eInt, 1, eDescFinished ), 00807 PropertyDescription( kOfxParamPropMin, OFX::eInt, 1, eDescFinished ), 00808 PropertyDescription( kOfxParamPropMax, OFX::eInt, 1, eDescFinished ), 00809 PropertyDescription( kOfxParamPropDisplayMin, OFX::eInt, 1, eDescFinished ), 00810 PropertyDescription( kOfxParamPropDisplayMax, OFX::eInt, 1, eDescFinished ), 00811 PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00812 }; 00813 00814 /** @brief properties for a 2D integer param */ 00815 static PropertyDescription gInt2DParamProps[] = 00816 { 00817 PropertyDescription( kOfxParamPropDefault, OFX::eInt, 2, eDescFinished ), 00818 PropertyDescription( kOfxParamPropMin, OFX::eInt, 2, eDescFinished ), 00819 PropertyDescription( kOfxParamPropMax, OFX::eInt, 2, eDescFinished ), 00820 PropertyDescription( kOfxParamPropDisplayMin, OFX::eInt, 2, eDescFinished ), 00821 PropertyDescription( kOfxParamPropDisplayMax, OFX::eInt, 2, eDescFinished ), 00822 PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00823 PropertyDescription( kOfxParamPropDimensionLabel, OFX::eString, 2, eDescDefault, "x", "y", eDescFinished ), 00824 }; 00825 00826 /** @brief properties for a 3D integer param */ 00827 static PropertyDescription gInt3DParamProps[] = 00828 { 00829 PropertyDescription( kOfxParamPropDefault, OFX::eInt, 3, eDescFinished ), 00830 PropertyDescription( kOfxParamPropMin, OFX::eInt, 3, eDescFinished ), 00831 PropertyDescription( kOfxParamPropMax, OFX::eInt, 3, eDescFinished ), 00832 PropertyDescription( kOfxParamPropDisplayMin, OFX::eInt, 3, eDescFinished ), 00833 PropertyDescription( kOfxParamPropDisplayMax, OFX::eInt, 3, eDescFinished ), 00834 PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00835 PropertyDescription( kOfxParamPropDimensionLabel, OFX::eString, 3, eDescDefault, "x", "y", "z", eDescFinished ), 00836 }; 00837 00838 /** @brief Properties common to all double params */ 00839 static PropertyDescription gDoubleParamProps[] = 00840 { 00841 PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00842 PropertyDescription( kOfxParamPropIncrement, OFX::eDouble, 1, eDescFinished ), 00843 PropertyDescription( kOfxParamPropDigits, OFX::eInt, 1, eDescFinished ), 00844 PropertyDescription( kOfxParamPropDoubleType, OFX::eString, 1, eDescDefault, kOfxParamDoubleTypePlain, eDescFinished ), 00845 }; 00846 00847 /** @brief properties for a 1D double param */ 00848 static PropertyDescription gDouble1DParamProps[] = 00849 { 00850 PropertyDescription( kOfxParamPropDefault, OFX::eDouble, 1, eDescFinished ), 00851 PropertyDescription( kOfxParamPropMin, OFX::eDouble, 1, eDescFinished ), 00852 PropertyDescription( kOfxParamPropMax, OFX::eDouble, 1, eDescFinished ), 00853 PropertyDescription( kOfxParamPropDisplayMin, OFX::eDouble, 1, eDescFinished ), 00854 PropertyDescription( kOfxParamPropDisplayMax, OFX::eDouble, 1, eDescFinished ), 00855 PropertyDescription( kOfxParamPropShowTimeMarker, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00856 }; 00857 00858 /** @brief properties for a 2D double param */ 00859 static PropertyDescription gDouble2DParamProps[] = 00860 { 00861 PropertyDescription( kOfxParamPropDefault, OFX::eDouble, 2, eDescFinished ), 00862 PropertyDescription( kOfxParamPropMin, OFX::eDouble, 2, eDescFinished ), 00863 PropertyDescription( kOfxParamPropMax, OFX::eDouble, 2, eDescFinished ), 00864 PropertyDescription( kOfxParamPropDisplayMin, OFX::eDouble, 2, eDescFinished ), 00865 PropertyDescription( kOfxParamPropDisplayMax, OFX::eDouble, 2, eDescFinished ), 00866 PropertyDescription( kOfxParamPropDimensionLabel, OFX::eString, 2, eDescDefault, "x", "y", eDescFinished ), 00867 }; 00868 00869 /** @brief properties for a 3D double param */ 00870 static PropertyDescription gDouble3DParamProps[] = 00871 { 00872 PropertyDescription( kOfxParamPropDefault, OFX::eDouble, 3, eDescFinished ), 00873 PropertyDescription( kOfxParamPropMin, OFX::eDouble, 3, eDescFinished ), 00874 PropertyDescription( kOfxParamPropMax, OFX::eDouble, 3, eDescFinished ), 00875 PropertyDescription( kOfxParamPropDisplayMin, OFX::eDouble, 3, eDescFinished ), 00876 PropertyDescription( kOfxParamPropDisplayMax, OFX::eDouble, 3, eDescFinished ), 00877 PropertyDescription( kOfxParamPropDimensionLabel, OFX::eString, 3, eDescDefault, "x", "y", "z", eDescFinished ), 00878 }; 00879 00880 /** @brief properties for a group param */ 00881 static PropertyDescription gGroupParamProps[] = 00882 { 00883 PropertyDescription( kOfxParamPropGroupOpen, OFX::eInt, 2, eDescFinished ), 00884 }; 00885 00886 /** @brief properties for a page param */ 00887 static PropertyDescription gPageParamProps[] = 00888 { 00889 PropertyDescription( kOfxParamPropPageChild, OFX::eString, -1, eDescFinished ), 00890 }; 00891 00892 /** @brief properties for a parametric param */ 00893 static PropertyDescription gParametricParamProps[] = 00894 { 00895 PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00896 PropertyDescription( kOfxParamPropCanUndo, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00897 PropertyDescription( kOfxParamPropParametricDimension, OFX::eInt, 1, eDescDefault, 1, eDescFinished ), 00898 PropertyDescription( kOfxParamPropParametricUIColour, OFX::eDouble, -1, eDescFinished ), 00899 PropertyDescription( kOfxParamPropParametricInteractBackground, OFX::ePointer, 1, eDescDefault, ( void* )( 0 ), eDescFinished ), 00900 PropertyDescription( kOfxParamPropParametricRange, OFX::eDouble, 2, eDescDefault, 0.0, 1.0, eDescFinished ), 00901 }; 00902 00903 /** @brief properties for a camera param */ 00904 static PropertyDescription gCameraParamProps[] = 00905 { 00906 PropertyDescription( kOfxPropType, OFX::eString, 1, eDescDefault, "NukeCamera", eDescFinished ), 00907 PropertyDescription( kOfxPropName, OFX::eString, 1, eDescFinished ), 00908 PropertyDescription( kOfxPropLabel, OFX::eString, 1, eDescFinished ), 00909 PropertyDescription( kOfxPropShortLabel, OFX::eString, 1, eDescFinished ), 00910 PropertyDescription( kOfxPropLongLabel, OFX::eString, 1, eDescFinished ), 00911 PropertyDescription( kOfxImageClipPropOptional, OFX::eInt, 1, eDescDefault, 0, eDescFinished ), 00912 }; 00913 00914 /** @brief Property set for 1D ints */ 00915 static PropertySetDescription gInt1DParamPropSet( "1D Integer parameter", 00916 mPropDescriptionArg( gBasicParamProps ), 00917 mPropDescriptionArg( gInteractOverideParamProps ), 00918 mPropDescriptionArg( gValueHolderParamProps ), 00919 mPropDescriptionArg( gInt1DParamProps ), 00920 NULLPTR ); 00921 00922 /** @brief Property set for 2D ints */ 00923 static PropertySetDescription gInt2DParamPropSet( "2D Integer parameter", 00924 mPropDescriptionArg( gBasicParamProps ), 00925 mPropDescriptionArg( gInteractOverideParamProps ), 00926 mPropDescriptionArg( gValueHolderParamProps ), 00927 mPropDescriptionArg( gInt2DParamProps ), 00928 NULLPTR ); 00929 00930 /** @brief Property set for 3D ints */ 00931 static PropertySetDescription gInt3DParamPropSet( "3D Integer parameter", 00932 mPropDescriptionArg( gBasicParamProps ), 00933 mPropDescriptionArg( gInteractOverideParamProps ), 00934 mPropDescriptionArg( gValueHolderParamProps ), 00935 mPropDescriptionArg( gInt3DParamProps ), 00936 NULLPTR ); 00937 00938 /** @brief Property set for 1D doubles */ 00939 static PropertySetDescription gDouble1DParamPropSet( "1D Double parameter", 00940 mPropDescriptionArg( gBasicParamProps ), 00941 mPropDescriptionArg( gInteractOverideParamProps ), 00942 mPropDescriptionArg( gValueHolderParamProps ), 00943 mPropDescriptionArg( gDoubleParamProps ), 00944 mPropDescriptionArg( gDouble1DParamProps ), 00945 NULLPTR ); 00946 00947 /** @brief Property set for 2D doubles */ 00948 static PropertySetDescription gDouble2DParamPropSet( "2D Double parameter", 00949 mPropDescriptionArg( gBasicParamProps ), 00950 mPropDescriptionArg( gInteractOverideParamProps ), 00951 mPropDescriptionArg( gValueHolderParamProps ), 00952 mPropDescriptionArg( gDoubleParamProps ), 00953 mPropDescriptionArg( gDouble2DParamProps ), 00954 NULLPTR ); 00955 00956 /** @brief Property set for 3D doubles */ 00957 static PropertySetDescription gDouble3DParamPropSet( "3D Double parameter", 00958 mPropDescriptionArg( gBasicParamProps ), 00959 mPropDescriptionArg( gInteractOverideParamProps ), 00960 mPropDescriptionArg( gValueHolderParamProps ), 00961 mPropDescriptionArg( gDoubleParamProps ), 00962 mPropDescriptionArg( gDouble3DParamProps ), 00963 NULLPTR ); 00964 00965 /** @brief Property set for RGB colour params */ 00966 static PropertySetDescription gRGBParamPropSet( "RGB Colour parameter", 00967 mPropDescriptionArg( gBasicParamProps ), 00968 mPropDescriptionArg( gInteractOverideParamProps ), 00969 mPropDescriptionArg( gValueHolderParamProps ), 00970 mPropDescriptionArg( gRGBColourParamProps ), 00971 NULLPTR ); 00972 00973 /** @brief Property set for RGB colour params */ 00974 static PropertySetDescription gRGBAParamPropSet( "RGB Colour parameter", 00975 mPropDescriptionArg( gBasicParamProps ), 00976 mPropDescriptionArg( gInteractOverideParamProps ), 00977 mPropDescriptionArg( gValueHolderParamProps ), 00978 mPropDescriptionArg( gRGBAColourParamProps ), 00979 NULLPTR ); 00980 00981 /** @brief Property set for string params */ 00982 static PropertySetDescription gStringParamPropSet( "String parameter", 00983 mPropDescriptionArg( gBasicParamProps ), 00984 mPropDescriptionArg( gInteractOverideParamProps ), 00985 mPropDescriptionArg( gValueHolderParamProps ), 00986 mPropDescriptionArg( gStringParamProps ), 00987 NULLPTR ); 00988 00989 /** @brief Property set for string params */ 00990 static PropertySetDescription gCustomParamPropSet( "Custom parameter", 00991 mPropDescriptionArg( gBasicParamProps ), 00992 mPropDescriptionArg( gInteractOverideParamProps ), 00993 mPropDescriptionArg( gValueHolderParamProps ), 00994 mPropDescriptionArg( gCustomParamProps ), 00995 NULLPTR ); 00996 00997 /** @brief Property set for boolean params */ 00998 static PropertySetDescription gBooleanParamPropSet( "Boolean parameter", 00999 mPropDescriptionArg( gBasicParamProps ), 01000 mPropDescriptionArg( gInteractOverideParamProps ), 01001 mPropDescriptionArg( gValueHolderParamProps ), 01002 mPropDescriptionArg( gBooleanParamProps ), 01003 NULLPTR ); 01004 01005 /** @brief Property set for choice params */ 01006 static PropertySetDescription gChoiceParamPropSet( "Choice parameter", 01007 mPropDescriptionArg( gBasicParamProps ), 01008 mPropDescriptionArg( gInteractOverideParamProps ), 01009 mPropDescriptionArg( gValueHolderParamProps ), 01010 mPropDescriptionArg( gChoiceParamProps ), 01011 NULLPTR ); 01012 01013 /** @brief Property set for push button params */ 01014 static PropertySetDescription gPushButtonParamPropSet( "PushButton parameter", 01015 mPropDescriptionArg( gBasicParamProps ), 01016 mPropDescriptionArg( gInteractOverideParamProps ), 01017 NULLPTR ); 01018 01019 /** @brief Property set for push button params */ 01020 static PropertySetDescription gGroupParamPropSet( "Group Parameter", 01021 mPropDescriptionArg( gBasicParamProps ), 01022 mPropDescriptionArg( gGroupParamProps ), 01023 NULLPTR ); 01024 01025 /** @brief Property set for push button params */ 01026 static PropertySetDescription gPageParamPropSet( "Page Parameter", 01027 mPropDescriptionArg( gBasicParamProps ), 01028 mPropDescriptionArg( gPageParamProps ), 01029 NULLPTR ); 01030 01031 static PropertySetDescription gParametricParamPropSet( "Parametric Parameter", 01032 mPropDescriptionArg( gBasicParamProps ), 01033 mPropDescriptionArg( gInteractOverideParamProps ), 01034 mPropDescriptionArg( gValueHolderParamProps ), 01035 mPropDescriptionArg( gParametricParamProps ), 01036 NULLPTR ); 01037 01038 static PropertySetDescription gCameraParamPropSet( "Camera Parameter", 01039 mPropDescriptionArg( gCameraParamProps ), 01040 NULLPTR ); 01041 01042 #endif 01043 /** @brief Validates the host structure and property handle */ 01044 void validateHostProperties( OfxHost* host ) 01045 { 01046 #ifndef kOfxsDisableValidation 01047 // make a description set 01048 PropertySet props( host->host ); 01049 gHostPropSet.validate( props ); 01050 #endif 01051 } 01052 01053 /** @brief Validates the effect descriptor properties */ 01054 void validatePluginDescriptorProperties( PropertySet props ) 01055 { 01056 #ifndef kOfxsDisableValidation 01057 gPluginDescriptorPropSet.validate( props ); 01058 #endif 01059 } 01060 01061 /** @brief Validates the effect instance properties */ 01062 void validatePluginInstanceProperties( PropertySet props ) 01063 { 01064 #ifndef kOfxsDisableValidation 01065 gPluginInstancePropSet.validate( props ); 01066 #endif 01067 } 01068 01069 /** @brief validates a clip descriptor */ 01070 void validateClipDescriptorProperties( PropertySet props ) 01071 { 01072 #ifndef kOfxsDisableValidation 01073 gClipDescriptorPropSet.validate( props ); 01074 #endif 01075 } 01076 01077 /** @brief validates a clip instance */ 01078 void validateClipInstanceProperties( PropertySet props ) 01079 { 01080 #ifndef kOfxsDisableValidation 01081 gClipInstancePropSet.validate( props ); 01082 #endif 01083 } 01084 01085 /** @brief validates a clip descriptor */ 01086 void validateImageProperties( PropertySet props ) 01087 { 01088 #ifndef kOfxsDisableValidation 01089 gImageInstancePropSet.validate( props ); 01090 #endif 01091 } 01092 01093 /** @brief Validates action in/out arguments */ 01094 void validateActionArgumentsProperties( const std::string& action, PropertySet inArgs, PropertySet outArgs ) 01095 { 01096 #ifndef kOfxsDisableValidation 01097 if( action == kOfxActionInstanceChanged ) 01098 { 01099 gInstanceChangedInArgPropSet.validate( inArgs ); 01100 } 01101 else if( action == kOfxActionBeginInstanceChanged ) 01102 { 01103 gBeginInstanceChangedInArgPropSet.validate( inArgs ); 01104 } 01105 else if( action == kOfxActionEndInstanceChanged ) 01106 { 01107 gEndInstanceChangedInArgPropSet.validate( inArgs ); 01108 } 01109 else if( action == kOfxImageEffectActionGetRegionOfDefinition ) 01110 { 01111 gGetRegionOfDefinitionInArgPropSet.validate( inArgs ); 01112 gGetRegionOfDefinitionOutArgPropSet.validate( outArgs ); 01113 } 01114 else if( action == kOfxImageEffectActionGetRegionsOfInterest ) 01115 { 01116 gGetRegionOfInterestInArgPropSet.validate( inArgs ); 01117 } 01118 else if( action == kOfxImageEffectActionGetTimeDomain ) 01119 { 01120 gGetTimeDomainOutArgPropSet.validate( outArgs ); 01121 } 01122 else if( action == kOfxImageEffectActionGetFramesNeeded ) 01123 { 01124 gGetFramesNeededInArgPropSet.validate( inArgs ); 01125 } 01126 else if( action == kOfxImageEffectActionGetClipPreferences ) 01127 { 01128 gGetClipPreferencesOutArgPropSet.validate( outArgs ); 01129 } 01130 else if( action == kOfxImageEffectActionIsIdentity ) 01131 { 01132 gIsIdentityActionInArgPropSet.validate( inArgs ); 01133 gIsIdentityActionOutArgPropSet.validate( outArgs ); 01134 } 01135 else if( action == kOfxImageEffectActionRender ) 01136 { 01137 gRenderActionInArgPropSet.validate( inArgs ); 01138 } 01139 else if( action == kOfxImageEffectActionBeginSequenceRender ) 01140 { 01141 gBeginSequenceRenderActionInArgPropSet.validate( inArgs ); 01142 } 01143 else if( action == kOfxImageEffectActionEndSequenceRender ) 01144 { 01145 gEndSequenceRenderActionInArgPropSet.validate( inArgs ); 01146 } 01147 else if( action == kOfxImageEffectActionDescribeInContext ) 01148 { 01149 gDescribeInContextActionInArgPropSet.validate( inArgs ); 01150 } 01151 #endif 01152 } 01153 01154 /** @brief Validates parameter properties */ 01155 void validateParameterProperties( ParamTypeEnum paramType, 01156 OFX::PropertySet& paramProps, 01157 bool checkDefaults ) 01158 { 01159 #ifndef kOfxsDisableValidation 01160 // should use a map here 01161 switch( paramType ) 01162 { 01163 case eStringParam: 01164 gStringParamPropSet.validate( paramProps, checkDefaults ); 01165 break; 01166 case eIntParam: 01167 gInt1DParamPropSet.validate( paramProps, checkDefaults ); 01168 break; 01169 case eInt2DParam: 01170 gInt2DParamPropSet.validate( paramProps, checkDefaults ); 01171 break; 01172 case eInt3DParam: 01173 gInt3DParamPropSet.validate( paramProps, checkDefaults ); 01174 break; 01175 case eDoubleParam: 01176 gDouble1DParamPropSet.validate( paramProps, checkDefaults ); 01177 break; 01178 case eDouble2DParam: 01179 gDouble2DParamPropSet.validate( paramProps, checkDefaults ); 01180 break; 01181 case eDouble3DParam: 01182 gDouble3DParamPropSet.validate( paramProps, checkDefaults ); 01183 break; 01184 case eRGBParam: 01185 gRGBParamPropSet.validate( paramProps, checkDefaults ); 01186 break; 01187 case eRGBAParam: 01188 gRGBAParamPropSet.validate( paramProps, checkDefaults ); 01189 break; 01190 case eBooleanParam: 01191 gBooleanParamPropSet.validate( paramProps, checkDefaults ); 01192 break; 01193 case eChoiceParam: 01194 gChoiceParamPropSet.validate( paramProps, checkDefaults ); 01195 break; 01196 case eCustomParam: 01197 gCustomParamPropSet.validate( paramProps, checkDefaults ); 01198 break; 01199 case eGroupParam: 01200 gGroupParamPropSet.validate( paramProps, checkDefaults ); 01201 break; 01202 case ePageParam: 01203 gPageParamPropSet.validate( paramProps, checkDefaults ); 01204 break; 01205 case ePushButtonParam: 01206 gPushButtonParamPropSet.validate( paramProps, checkDefaults ); 01207 break; 01208 case eParametricParam: 01209 gParametricParamPropSet.validate( paramProps, checkDefaults ); 01210 break; 01211 case eCameraParam: 01212 gCameraParamPropSet.validate( paramProps, checkDefaults ); 01213 break; 01214 case eDummyParam: 01215 // default: 01216 break; 01217 } 01218 #endif 01219 } 01220 01221 //////////////////////////////////////////////////////////////////////////////// 01222 // 01223 01224 /** @brief Initialises validation stuff that needs to be done once we know how the host behaves, called during the onload action */ 01225 void initialise( void ) 01226 { 01227 #ifndef kOfxsDisableValidation 01228 static bool beenInitialised = false; 01229 if( !beenInitialised && getImageEffectHostDescription() ) 01230 { 01231 beenInitialised = true; 01232 01233 // create new property descriptions depending on certain host states 01234 PropertyDescription* desc; 01235 01236 // do custom params animate ? 01237 desc = new PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, 01238 eDescDefault, int(getImageEffectHostDescription()->supportsCustomAnimation), 01239 eDescFinished ); 01240 gCustomParamPropSet.addProperty( desc, true ); 01241 01242 // do strings animate ? 01243 desc = new PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, 01244 eDescDefault, int(getImageEffectHostDescription()->supportsStringAnimation), 01245 eDescFinished ); 01246 gStringParamPropSet.addProperty( desc, true ); 01247 01248 // do choice params animate 01249 desc = new PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, 01250 eDescDefault, int(getImageEffectHostDescription()->supportsChoiceAnimation), 01251 eDescFinished ); 01252 gChoiceParamPropSet.addProperty( desc, true ); 01253 01254 // do choice params animate 01255 desc = new PropertyDescription( kOfxParamPropAnimates, OFX::eInt, 1, 01256 eDescDefault, int(getImageEffectHostDescription()->supportsBooleanAnimation), 01257 eDescFinished ); 01258 gBooleanParamPropSet.addProperty( desc, true ); 01259 } 01260 #endif 01261 } 01262 01263 }; 01264 };