1 /* 2 OFX Support Library, a library that skins the OFX plug-in API with C++ classes. 3 Copyright (C) 2004-2005 The Open Effects Association Ltd 4 Author Bruno Nicoletti bruno@thefoundry.co.uk 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 9 * Redistributions of source code must retain the above copyright notice, 10 this list of conditions and the following disclaimer. 11 * Redistributions in binary form must reproduce the above copyright notice, 12 this list of conditions and the following disclaimer in the documentation 13 and/or other materials provided with the distribution. 14 * Neither the name The Open Effects Association Ltd, nor the names of its 15 contributors may be used to endorse or promote products derived from this 16 software without specific prior written permission. 17 18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29 The Open Effects Association Ltd 30 1 Wardour St 31 London W1D 6PA 32 England 33 34 35 */ 36 37 /** @file 38 39 This file contains headers for classes that are used to validate property sets and make sure they have the right members and default values. 40 41 */ 42 43 #include "ofxsSupportPrivate.h" 44 #include <stdarg.h> 45 #ifdef OFX_SUPPORTS_OPENGLRENDER 46 #include "ofxOpenGLRender.h" 47 #endif 48 49 /** @brief Null pointer definition */ 50 #define NULLPTR ((void *)(0)) 51 52 // #define kOfxsDisableValidation 53 54 // disable validation if not a debug build 55 #ifndef DEBUG 56 #define kOfxsDisableValidation 57 #endif 58 59 //#define kOfxsDisableValidation 60 /** @brief OFX namespace 61 */ 62 namespace OFX { 63 64 /** @brief The validation code has its own namespace */ 65 namespace Validation { 66 67 #ifndef kOfxsDisableValidation 68 /** @brief Set the vector by getting dimension things specified by ilk from the argp list, used by PropertyDescription ctor */ 69 static void setVectorFromVarArgs(OFX::PropertyTypeEnum ilk,int dimension,va_list & argp,std::vector<ValueHolder> & vec)70 setVectorFromVarArgs(OFX::PropertyTypeEnum ilk, 71 int dimension, 72 va_list &argp, 73 std::vector<ValueHolder> &vec) 74 { 75 char *vS; 76 int vI; 77 double vD; 78 void *vP; 79 for(int i = 0; i < dimension; i++) { 80 switch (ilk) 81 { 82 case eString : 83 vS = va_arg(argp, char *); 84 vec.push_back(vS); 85 break; 86 87 case eInt : 88 vI = va_arg(argp, int); 89 vec.push_back(vI); 90 break; 91 92 case ePointer : 93 vP = va_arg(argp, void *); 94 vec.push_back(vP); 95 break; 96 97 case eDouble : 98 vD = va_arg(argp, double); 99 vec.push_back(vD); 100 break; 101 } 102 } 103 } 104 105 106 /** @brief PropertyDescription var-args constructor */ PropertyDescription(const char * name,OFX::PropertyTypeEnum ilk,int dimension,...)107 PropertyDescription::PropertyDescription(const char *name, OFX::PropertyTypeEnum ilk, int dimension, ...) 108 : _name(name) 109 , _exists(false) // only set when we have validated it 110 , _dimension(dimension) 111 , _ilk(ilk) 112 { 113 // go through the var args to extract defaults to check against and values to set to 114 va_list argp; 115 va_start(argp, dimension); 116 117 bool going = true; 118 while(going) { 119 // what is being set ? 120 DescriptionTag tag = DescriptionTag(va_arg(argp, int)); 121 122 switch (tag) 123 { 124 case eDescDefault : // we are setting default values to check against 125 setVectorFromVarArgs(ilk, dimension, argp, _defaultValue); 126 break; 127 128 case eDescFinished : // we are finished 129 default : 130 going = false; 131 break; 132 } 133 } 134 135 va_end(argp); 136 } 137 138 139 /** @brief See if the property exists in the containing property set and has the correct dimension */ 140 void validate(bool checkDefaults,PropertySet & propSet)141 PropertyDescription::validate(bool checkDefaults, 142 PropertySet &propSet) 143 { 144 // see if it exists by fetching the dimension, 145 146 try { 147 int hostDimension = propSet.propGetDimension(_name.c_str()); 148 _exists = true; 149 150 if(_dimension != -1) // -1 implies variable dimension 151 OFX::Log::error(hostDimension != _dimension, "Host reports property '%s' has dimension %d, it should be %d;", _name.c_str(), hostDimension, _dimension); 152 // check type by getting the first element, the property getting will print any failure messages to the log 153 if(hostDimension > 0) { 154 switch(_ilk) 155 { 156 case OFX::ePointer : { void *vP = propSet.propGetPointer(_name.c_str()); (void)vP; }break; 157 case OFX::eInt : { int vI = propSet.propGetInt(_name.c_str()); (void)vI; } break; 158 case OFX::eString : { std::string vS = propSet.propGetString(_name.c_str()); (void)vS; } break; 159 case OFX::eDouble : { double vD = propSet.propGetDouble(_name.c_str()); (void)vD; } break; 160 } 161 } 162 163 // check the defaults are OK, if there are any 164 int nDefs = (int)_defaultValue.size(); 165 if(checkDefaults && nDefs > 0) { 166 OFX::Log::error(hostDimension != nDefs, "Host reports default dimension of '%s' as %d, which is different to the default dimension size of %d;", 167 _name.c_str(), hostDimension, nDefs); 168 169 int N = hostDimension < nDefs ? hostDimension : nDefs; 170 171 for(int i = 0; i < N; i++) { 172 switch(_ilk) 173 { 174 case OFX::ePointer : { 175 void *vP = propSet.propGetPointer(_name.c_str(), i); 176 OFX::Log::error(vP != (void *) _defaultValue[i], "Default value of %s[%d] = %p, it should be %p;", 177 _name.c_str(), i, vP, (void *) _defaultValue[i]); 178 } 179 break; 180 case OFX::eInt : { 181 int vI = propSet.propGetInt(_name.c_str(), i); 182 OFX::Log::error(vI != (int) _defaultValue[i], "Default value of %s[%d] = %d, it should be %d;", 183 _name.c_str(), i, vI, (int) _defaultValue[i]); 184 } 185 break; 186 case OFX::eString : { 187 std::string vS = propSet.propGetString(_name.c_str(), i); 188 OFX::Log::error(vS != _defaultValue[i].vString, "Default value of %s[%d] = '%s', it should be '%s';", 189 _name.c_str(), i, vS.c_str(), _defaultValue[i].vString.c_str()); 190 } 191 break; 192 case OFX::eDouble : { 193 double vD = propSet.propGetDouble(_name.c_str(), i); 194 OFX::Log::error(vD != (double) _defaultValue[i], "Default value of %s[%d] = %g, it should be %g;", 195 _name.c_str(), i, vD, (double) _defaultValue[i]); 196 } 197 break; 198 } 199 } 200 } 201 } 202 catch (OFX::Exception::Suite &e) 203 { 204 // just catch it, the error will be reported 205 _exists = false; 206 } 207 catch (OFX::Exception::PropertyUnknownToHost &e) 208 { 209 // just catch it, the error will be reported 210 _exists = false; 211 } 212 catch (OFX::Exception::PropertyValueIllegalToHost &e) 213 { 214 // just catch it, the error will be reported 215 _exists = false; 216 } 217 } 218 219 220 /** @brief This macro is used to short hand passing the var args to @ref OFX::Validation::PropertySetDescription::PropertySetDescription */ 221 #define mPropDescriptionArg(descs) descs, sizeof(descs)/sizeof(PropertyDescription) 222 223 /** @brief A set of property descriptions, constructor 224 225 Passed in as a zero terminated pairs of (PropertyDescription *descArray, int nDescriptions) 226 227 */ PropertySetDescription(const char * setName,...)228 PropertySetDescription::PropertySetDescription(const char *setName, ...) // PropertyDescription *v, int nV) 229 : _setName(setName) 230 { 231 232 // go through the var args to extract defaults to check against and values to set to 233 va_list argp; 234 va_start(argp, setName); 235 236 while(1) { 237 // get a pointer 238 PropertyDescription *descs = (PropertyDescription *) va_arg(argp, PropertyDescription *); 239 240 // have we finished 241 if(!descs) break; 242 243 // get the count 244 int nDescs = (int) va_arg(argp, int); 245 246 // and set it up 247 for(int i = 0; i < nDescs; i++) { 248 _descriptions.push_back(descs + i); 249 } 250 251 } 252 253 va_end(argp); 254 } 255 256 /** @brief destructor */ ~PropertySetDescription()257 PropertySetDescription::~PropertySetDescription() 258 { 259 int nToDelete = (int)_deleteThese.size(); 260 for(int i = 0; i < nToDelete; i++) { 261 delete _deleteThese[i]; 262 } 263 } 264 265 /** @brief Add more properties into the property vector */ 266 void addProperty(PropertyDescription * desc,bool deleteOnDestruction)267 PropertySetDescription::addProperty(PropertyDescription *desc, 268 bool deleteOnDestruction) 269 { 270 _descriptions.push_back(desc); 271 if(deleteOnDestruction) 272 _deleteThese.push_back(desc); 273 } 274 275 /** @brief Validate all the properties in the set */ 276 void validate(PropertySet & propSet,bool checkDefaults,bool logOrdinaryMessages)277 PropertySetDescription::validate(PropertySet &propSet, 278 bool checkDefaults, 279 bool logOrdinaryMessages) 280 { 281 OFX::Log::print("START validating properties of %s.", _setName.c_str()); 282 OFX::Log::indent(); 283 284 // don't print ordinary messages whilst we are checking them 285 if(!logOrdinaryMessages) PropertySet::propDisableLogging(); 286 287 // check each property in the description 288 int n = (int)_descriptions.size(); 289 for(int i = 0; i < n; i++) 290 _descriptions[i]->validate(checkDefaults, propSet); 291 292 if(!logOrdinaryMessages) PropertySet::propEnableLogging(); 293 294 OFX::Log::outdent(); 295 OFX::Log::print("STOP property validation of %s.", _setName.c_str()); 296 } 297 298 299 /** @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. */ 300 static PropertyDescription gHostProps[ ] = 301 { 302 // single dimensional string properties 303 PropertyDescription(kOfxPropType, OFX::eString, 1, eDescFinished), 304 PropertyDescription(kOfxPropName, OFX::eString, 1, eDescFinished), 305 PropertyDescription(kOfxPropLabel, OFX::eString, 1, eDescFinished), 306 307 // single dimensional int properties 308 PropertyDescription(kOfxImageEffectHostPropIsBackground, OFX::eInt, 1, eDescFinished), 309 PropertyDescription(kOfxImageEffectPropSupportsOverlays, OFX::eInt, 1, eDescFinished), 310 PropertyDescription(kOfxImageEffectPropSupportsMultiResolution, OFX::eInt, 1, eDescFinished), 311 PropertyDescription(kOfxImageEffectPropSupportsTiles, OFX::eInt, 1, eDescFinished), 312 PropertyDescription(kOfxImageEffectPropTemporalClipAccess, OFX::eInt, 1, eDescFinished), 313 PropertyDescription(kOfxImageEffectPropSupportsMultipleClipDepths, OFX::eInt, 1, eDescFinished), 314 PropertyDescription(kOfxImageEffectPropSupportsMultipleClipPARs, OFX::eInt, 1, eDescFinished), 315 PropertyDescription(kOfxImageEffectPropSetableFrameRate, OFX::eInt, 1, eDescFinished), 316 PropertyDescription(kOfxImageEffectPropSetableFielding, OFX::eInt, 1, eDescFinished), 317 PropertyDescription(kOfxParamHostPropSupportsStringAnimation, OFX::eInt, 1, eDescFinished), 318 PropertyDescription(kOfxParamHostPropSupportsCustomInteract, OFX::eInt, 1, eDescFinished), 319 PropertyDescription(kOfxParamHostPropSupportsChoiceAnimation, OFX::eInt, 1, eDescFinished), 320 #ifdef OFX_EXTENSIONS_RESOLVE 321 PropertyDescription(kOfxParamHostPropSupportsStrChoiceAnimation, OFX::eInt, 1, eDescFinished), 322 #endif 323 PropertyDescription(kOfxParamHostPropSupportsBooleanAnimation, OFX::eInt, 1, eDescFinished), 324 PropertyDescription(kOfxParamHostPropSupportsCustomAnimation, OFX::eInt, 1, eDescFinished), 325 PropertyDescription(kOfxParamHostPropMaxParameters, OFX::eInt, 1, eDescFinished), 326 PropertyDescription(kOfxParamHostPropMaxPages, OFX::eInt, 1, eDescFinished), 327 328 // variable multi dimensional string properties 329 PropertyDescription(kOfxImageEffectPropSupportedComponents, OFX::eString, -1, eDescFinished), 330 PropertyDescription(kOfxImageEffectPropSupportedContexts, OFX::eString, -1, eDescFinished), 331 332 // multi dimensional int properities 333 PropertyDescription(kOfxParamHostPropPageRowColumnCount, OFX::eInt, 2, eDescFinished), 334 }; 335 336 /** @brief the property set for the global host pointer */ 337 static PropertySetDescription gHostPropSet("Host Property", 338 gHostProps, sizeof(gHostProps)/sizeof(PropertyDescription), 339 NULLPTR); 340 341 342 /** @brief A list of properties to validate the effect descriptor against */ 343 static PropertyDescription gPluginDescriptorProps[ ] = 344 { 345 // string props that have no defaults that can be checked against 346 PropertyDescription(kOfxPropLabel, OFX::eString, 1, eDescFinished), 347 PropertyDescription(kOfxPropShortLabel, OFX::eString, 1, eDescFinished), 348 PropertyDescription(kOfxPropLongLabel, OFX::eString, 1, eDescFinished), 349 PropertyDescription(kOfxImageEffectPluginPropGrouping, OFX::eString, 1, eDescFinished), 350 PropertyDescription(kOfxPluginPropFilePath, OFX::eString, 1, eDescFinished), 351 352 // string props with defaults that can be checked against 353 PropertyDescription(kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeImageEffect, eDescFinished), 354 PropertyDescription(kOfxImageEffectPluginRenderThreadSafety, OFX::eString, 1, eDescDefault, kOfxImageEffectRenderFullySafe, eDescFinished), 355 356 // int props with defaults that can be checked against 357 PropertyDescription(kOfxImageEffectPluginPropSingleInstance, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 358 PropertyDescription(kOfxImageEffectPluginPropHostFrameThreading, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 359 PropertyDescription(kOfxImageEffectPropSupportsMultiResolution, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 360 PropertyDescription(kOfxImageEffectInstancePropSequentialRender, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 361 PropertyDescription(kOfxImageEffectPropSupportsTiles, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 362 PropertyDescription(kOfxImageEffectPropTemporalClipAccess, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 363 PropertyDescription(kOfxImageEffectPluginPropFieldRenderTwiceAlways, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 364 PropertyDescription(kOfxImageEffectPropSupportsMultipleClipDepths, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 365 PropertyDescription(kOfxImageEffectPropSupportsMultipleClipPARs, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 366 367 // Pointer props with defaults that can be checked against 368 PropertyDescription(kOfxImageEffectPluginPropOverlayInteractV1, OFX::ePointer, 1, eDescDefault, NULLPTR, eDescFinished), 369 370 // string props that have variable dimension, and can't be checked against for defaults 371 PropertyDescription(kOfxImageEffectPropSupportedContexts, OFX::eString, -1, eDescFinished), 372 PropertyDescription(kOfxImageEffectPropSupportedPixelDepths, OFX::eString, -1, eDescFinished), 373 PropertyDescription(kOfxImageEffectPropClipPreferencesSlaveParam, OFX::eString, -1, eDescFinished), 374 }; 375 376 /** @brief the property set for the global plugin descriptor */ 377 static PropertySetDescription gPluginDescriptorPropSet("Plugin Descriptor", 378 gPluginDescriptorProps, sizeof(gPluginDescriptorProps)/sizeof(PropertyDescription), 379 NULLPTR); 380 381 /** @brief A list of properties to validate the plugin instance */ 382 static PropertyDescription gPluginInstanceProps[ ] = 383 { 384 // string props with defaults that can be checked against 385 PropertyDescription(kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeImageEffectInstance, eDescFinished), 386 387 // int props with defaults that can be checked against 388 PropertyDescription(kOfxImageEffectInstancePropSequentialRender, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 389 PropertyDescription(kOfxImageEffectPropSupportsTiles, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 390 391 // Pointer props with defaults that can be checked against 392 PropertyDescription(kOfxPropInstanceData, OFX::ePointer, 1, eDescDefault, NULLPTR, eDescFinished), 393 PropertyDescription(kOfxImageEffectPropPluginHandle, OFX::ePointer, 1, eDescFinished), 394 395 // string props that have no defaults that can be checked against 396 PropertyDescription(kOfxImageEffectPropContext, OFX::eString, 1, eDescFinished), 397 398 // int props with not defaults that can be checked against 399 PropertyDescription(kOfxPropIsInteractive, OFX::eInt, 1, eDescFinished), 400 401 // double props that can't be checked against for defaults 402 PropertyDescription(kOfxImageEffectPropProjectSize, OFX::eDouble, 2, eDescFinished), 403 PropertyDescription(kOfxImageEffectPropProjectExtent, OFX::eDouble, 2, eDescFinished), 404 PropertyDescription(kOfxImageEffectPropProjectOffset, OFX::eDouble, 2, eDescFinished), 405 PropertyDescription(kOfxImageEffectPropProjectPixelAspectRatio, OFX::eDouble, 1, eDescFinished), 406 PropertyDescription(kOfxImageEffectInstancePropEffectDuration, OFX::eDouble, 1, eDescFinished), 407 PropertyDescription(kOfxImageEffectPropFrameRate, OFX::eDouble, 1, eDescFinished), 408 }; 409 410 /** @brief the property set for a plugin instance */ 411 static PropertySetDescription gPluginInstancePropSet("Plugin Instance", 412 gPluginInstanceProps, sizeof(gPluginInstanceProps)/sizeof(PropertyDescription), 413 NULLPTR); 414 415 /** @brief A list of properties to validate a clip descriptor */ 416 static PropertyDescription gClipDescriptorProps[ ] = 417 { 418 // string props with checkable defaults 419 PropertyDescription(kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeClip, eDescFinished), 420 PropertyDescription(kOfxImageClipPropFieldExtraction, OFX::eString, 1, eDescDefault, kOfxImageFieldDoubled, eDescFinished), 421 422 // string props with no checkable defaults 423 PropertyDescription(kOfxImageEffectPropSupportedComponents, OFX::eString,-1, eDescFinished), 424 PropertyDescription(kOfxPropName, OFX::eString, 1, eDescFinished), 425 PropertyDescription(kOfxPropLabel, OFX::eString, 1, eDescFinished), 426 PropertyDescription(kOfxPropShortLabel, OFX::eString, 1, eDescFinished), 427 PropertyDescription(kOfxPropLongLabel, OFX::eString, 1, eDescFinished), 428 429 // int props with checkable defaults 430 PropertyDescription(kOfxImageEffectPropTemporalClipAccess, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 431 PropertyDescription(kOfxImageClipPropOptional, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 432 PropertyDescription(kOfxImageClipPropIsMask, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 433 PropertyDescription(kOfxImageEffectPropSupportsTiles, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 434 }; 435 436 /** @brief the property set for a clip descriptor */ 437 static PropertySetDescription gClipDescriptorPropSet("Clip Descriptor", 438 gClipDescriptorProps, sizeof(gClipDescriptorProps)/sizeof(PropertyDescription), 439 NULLPTR); 440 441 442 /** @brief A list of properties to validate a clip instance */ 443 static PropertyDescription gClipInstanceProps[ ] = 444 { 445 // we can only validate this one against a fixed default 446 PropertyDescription(kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeClip, eDescFinished), 447 448 // the rest are set by the plugin during description or by the host 449 PropertyDescription(kOfxPropName, OFX::eString, 1, eDescFinished), 450 PropertyDescription(kOfxPropLabel, OFX::eString, 1, eDescFinished), 451 PropertyDescription(kOfxPropShortLabel, OFX::eString, 1, eDescFinished), 452 PropertyDescription(kOfxPropLongLabel, OFX::eString, 1, eDescFinished), 453 PropertyDescription(kOfxImageEffectPropSupportedComponents, OFX::eString,-1, eDescFinished), 454 PropertyDescription(kOfxImageClipPropFieldExtraction, OFX::eString, 1, eDescFinished), 455 PropertyDescription(kOfxImageEffectPropPixelDepth, OFX::eString, 1, eDescFinished), 456 PropertyDescription(kOfxImageEffectPropComponents, OFX::eString, 1, eDescFinished), 457 PropertyDescription(kOfxImageClipPropUnmappedPixelDepth, OFX::eString, 1, eDescFinished), 458 PropertyDescription(kOfxImageClipPropUnmappedComponents, OFX::eString, 1, eDescFinished), 459 PropertyDescription(kOfxImageEffectPropPreMultiplication, OFX::eString, 1, eDescFinished), 460 PropertyDescription(kOfxImageClipPropFieldOrder, OFX::eString, 1, eDescFinished), 461 462 // int props 463 PropertyDescription(kOfxImageEffectPropTemporalClipAccess, OFX::eInt, 1, eDescFinished), 464 PropertyDescription(kOfxImageClipPropOptional, OFX::eInt, 1, eDescFinished), 465 PropertyDescription(kOfxImageClipPropIsMask, OFX::eInt, 1, eDescFinished), 466 PropertyDescription(kOfxImageEffectPropSupportsTiles, OFX::eInt, 1, eDescFinished), 467 PropertyDescription(kOfxImageClipPropConnected, OFX::eInt, 1, eDescFinished), 468 PropertyDescription(kOfxImageClipPropContinuousSamples, OFX::eInt, 1, eDescFinished), 469 470 // double props 471 PropertyDescription(kOfxImagePropPixelAspectRatio, OFX::eDouble, 1, eDescFinished), 472 PropertyDescription(kOfxImageEffectPropFrameRate, OFX::eDouble, 1, eDescFinished), 473 PropertyDescription(kOfxImageEffectPropFrameRange, OFX::eDouble, 2, eDescFinished), 474 PropertyDescription(kOfxImageEffectPropUnmappedFrameRate, OFX::eDouble, 1, eDescFinished), 475 PropertyDescription(kOfxImageEffectPropUnmappedFrameRange, OFX::eDouble, 2, eDescFinished), 476 }; 477 478 /** @brief the property set for a clip instance */ 479 static PropertySetDescription gClipInstancePropSet("Clip Instance", gClipInstanceProps, sizeof(gClipInstanceProps)/sizeof(PropertyDescription), 480 NULLPTR); 481 482 #ifdef OFX_EXTENSIONS_NUKE 483 /** @brief A list of properties to validate a camera */ 484 static PropertyDescription gCameraDescriptorProps[ ] = 485 { 486 // string props with checkable defaults 487 PropertyDescription(kOfxPropType, OFX::eString, 1, eDescDefault, "NukeCamera", eDescFinished), 488 489 // string props with no checkable defaults 490 PropertyDescription(kOfxPropName, OFX::eString, 1, eDescFinished), 491 PropertyDescription(kOfxPropLabel, OFX::eString, 1, eDescFinished), 492 PropertyDescription(kOfxPropShortLabel, OFX::eString, 1, eDescFinished), 493 PropertyDescription(kOfxPropLongLabel, OFX::eString, 1, eDescFinished), 494 495 // int props with checkable defaults 496 PropertyDescription(kOfxImageClipPropOptional, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 497 }; 498 499 /** @brief the property set for a clip descriptor */ 500 static PropertySetDescription gCameraDescriptorPropSet("Camera Descriptor", 501 gCameraDescriptorProps, sizeof(gCameraDescriptorProps)/sizeof(PropertyDescription), 502 NULLPTR); 503 504 /** @brief A list of properties to validate a camera instance */ 505 static PropertyDescription gCameraInstanceProps[ ] = 506 { 507 // string props with checkable defaults 508 PropertyDescription(kOfxPropType, OFX::eString, 1, eDescDefault, "NukeCamera", eDescFinished), 509 510 // string props with no checkable defaults 511 PropertyDescription(kOfxPropName, OFX::eString, 1, eDescFinished), 512 PropertyDescription(kOfxPropLabel, OFX::eString, 1, eDescFinished), 513 PropertyDescription(kOfxPropShortLabel, OFX::eString, 1, eDescFinished), 514 PropertyDescription(kOfxPropLongLabel, OFX::eString, 1, eDescFinished), 515 516 // int props with checkable defaults 517 PropertyDescription(kOfxImageClipPropOptional, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 518 PropertyDescription(kOfxImageClipPropConnected, OFX::eInt, 1, eDescFinished), 519 }; 520 521 /** @brief the property set for a clip instance */ 522 static PropertySetDescription gCameraInstancePropSet("Camera Instance", gCameraInstanceProps, sizeof(gCameraInstanceProps)/sizeof(PropertyDescription), 523 NULLPTR); 524 #endif 525 526 /** @brief List of properties to validate an image or texture instance */ 527 static PropertyDescription gImageBaseInstanceProps[ ] = 528 { 529 // this is the only property with a checkable default 530 PropertyDescription(kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeImage, eDescFinished), 531 532 // all other properties are set by the host 533 PropertyDescription(kOfxImageEffectPropPixelDepth, OFX::eString, 1, eDescFinished), 534 PropertyDescription(kOfxImageEffectPropComponents, OFX::eString, 1, eDescFinished), 535 PropertyDescription(kOfxImageEffectPropPreMultiplication, OFX::eString, 1, eDescFinished), 536 PropertyDescription(kOfxImagePropField, OFX::eString, 1, eDescFinished), 537 PropertyDescription(kOfxImagePropUniqueIdentifier, OFX::eString, 1, eDescFinished), 538 539 // double props 540 PropertyDescription(kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished), 541 PropertyDescription(kOfxImagePropPixelAspectRatio, OFX::eDouble, 1, eDescFinished), 542 543 // int props 544 PropertyDescription(kOfxImagePropBounds, OFX::eInt, 4, eDescFinished), 545 PropertyDescription(kOfxImagePropRegionOfDefinition, OFX::eInt, 4, eDescFinished), 546 PropertyDescription(kOfxImagePropRowBytes, OFX::eInt, 1, eDescFinished), 547 }; 548 549 /** @brief the property set for an image instance */ 550 static PropertySetDescription gImageBaseInstancePropSet("Image or Texture Instance", 551 gImageBaseInstanceProps, sizeof(gImageBaseInstanceProps)/sizeof(PropertyDescription), 552 NULLPTR); 553 554 /** @brief List of properties to validate an image or texture instance */ 555 static PropertyDescription gImageInstanceProps[ ] = 556 { 557 // pointer props 558 PropertyDescription(kOfxImagePropData, OFX::ePointer, 1, eDescFinished), 559 }; 560 561 /** @brief the property set for an image instance */ 562 static PropertySetDescription gImageInstancePropSet("Image Instance", 563 gImageInstanceProps, sizeof(gImageInstanceProps)/sizeof(PropertyDescription), 564 NULLPTR); 565 566 #ifdef OFX_SUPPORTS_OPENGLRENDER 567 /** @brief List of properties to validate an image or texture instance */ 568 static PropertyDescription gTextureInstanceProps[ ] = 569 { 570 // pointer props 571 PropertyDescription(kOfxImageEffectPropOpenGLTextureIndex, OFX::eInt, 1, eDescFinished), 572 PropertyDescription(kOfxImageEffectPropOpenGLTextureTarget, OFX::eInt, 1, eDescFinished), 573 }; 574 575 /** @brief the property set for an image instance */ 576 static PropertySetDescription gTextureInstancePropSet("Texture Instance", 577 gTextureInstanceProps, sizeof(gTextureInstanceProps)/sizeof(PropertyDescription), 578 NULLPTR); 579 #endif 580 581 //////////////////////////////////////////////////////////////////////////////// 582 // Action in/out args properties 583 //////////////////////////////////////////////////////////////////////////////// 584 585 /** @brief kOfxImageEffectActionDescribeInContext actions's inargs properties */ 586 static PropertyDescription gDescribeInContextActionInArgProps[ ] = 587 { 588 PropertyDescription(kOfxImageEffectPropContext, OFX::eString, 1, eDescFinished), 589 }; 590 591 /** @brief the property set for describe in context action */ 592 static PropertySetDescription gDescribeInContextActionInArgPropSet(kOfxImageEffectActionDescribeInContext " in argument", 593 gDescribeInContextActionInArgProps, sizeof(gDescribeInContextActionInArgProps)/sizeof(PropertyDescription), 594 NULLPTR); 595 596 /** @brief kOfxImageEffectActionRender action's inargs properties */ 597 static PropertyDescription gRenderActionInArgProps[ ] = 598 { 599 PropertyDescription(kOfxPropTime, OFX::eDouble, 1, eDescFinished), 600 PropertyDescription(kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished), 601 PropertyDescription(kOfxImageEffectPropRenderWindow, OFX::eInt, 4, eDescFinished), 602 PropertyDescription(kOfxImageEffectPropFieldToRender, OFX::eString, 1, eDescFinished), 603 // The following appeared in OFX 1.2, and are thus not mandatory 604 //PropertyDescription(kOfxImageEffectPropSequentialRenderStatus, OFX::eInt, 1, eDescFinished), 605 //PropertyDescription(kOfxImageEffectPropInteractiveRenderStatus, OFX::eInt, 1, eDescFinished), 606 // The following appeared in OFX 1.4, and is thus not mandatory 607 //PropertyDescription(kOfxImageEffectPropRenderQualityDraft, OFX::eInt, 1, eDescFinished), 608 }; 609 610 /** @brief kOfxImageEffectActionRender property set */ 611 static PropertySetDescription gRenderActionInArgPropSet(kOfxImageEffectActionRender " in argument", 612 gRenderActionInArgProps, sizeof(gRenderActionInArgProps)/sizeof(PropertyDescription), 613 NULLPTR); 614 615 /** @brief kOfxImageEffectActionBeginSequenceRender action's inargs properties */ 616 static PropertyDescription gBeginSequenceRenderActionInArgProps[ ] = 617 { 618 PropertyDescription(kOfxImageEffectPropFrameRange, OFX::eDouble, 2, eDescFinished), 619 PropertyDescription(kOfxImageEffectPropFrameStep, OFX::eDouble, 1, eDescFinished), 620 PropertyDescription(kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished), 621 PropertyDescription(kOfxPropIsInteractive, OFX::eInt, 1, eDescFinished), 622 // The following appeared in OFX 1.2, and are thus not mandatory 623 //PropertyDescription(kOfxImageEffectPropSequentialRenderStatus, OFX::eInt, 1, eDescFinished), 624 //PropertyDescription(kOfxImageEffectPropInteractiveRenderStatus, OFX::eInt, 1, eDescFinished), 625 }; 626 627 /** @brief kOfxImageEffectActionBeginSequenceRender property set */ 628 static PropertySetDescription gBeginSequenceRenderActionInArgPropSet(kOfxImageEffectActionBeginSequenceRender " in argument", 629 gBeginSequenceRenderActionInArgProps, sizeof(gBeginSequenceRenderActionInArgProps)/sizeof(PropertyDescription), 630 NULLPTR); 631 632 /** @brief kOfxImageEffectActionEndSequenceRender action's inargs properties */ 633 static PropertyDescription gEndSequenceRenderActionInArgProps[ ] = 634 { 635 PropertyDescription(kOfxImageEffectPropFrameRange, OFX::eDouble, 2, eDescFinished), 636 PropertyDescription(kOfxImageEffectPropFrameStep, OFX::eDouble, 1, eDescFinished), 637 PropertyDescription(kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished), 638 PropertyDescription(kOfxPropIsInteractive, OFX::eInt, 1, eDescFinished), 639 // The following appeared in OFX 1.2, and are thus not mandatory 640 //PropertyDescription(kOfxImageEffectPropSequentialRenderStatus, OFX::eInt, 1, eDescFinished), 641 //PropertyDescription(kOfxImageEffectPropInteractiveRenderStatus, OFX::eInt, 1, eDescFinished), 642 }; 643 644 /** @brief kOfxImageEffectActionEndSequenceRender property set */ 645 static PropertySetDescription gEndSequenceRenderActionInArgPropSet(kOfxImageEffectActionEndSequenceRender " in argument", 646 gEndSequenceRenderActionInArgProps, sizeof(gEndSequenceRenderActionInArgProps)/sizeof(PropertyDescription), 647 NULLPTR); 648 649 /** @brief kOfxImageEffectActionIsIdentity action's inargs properties */ 650 static PropertyDescription gIsIdentityActionInArgProps[ ] = 651 { 652 PropertyDescription(kOfxPropTime, OFX::eDouble, 1, eDescFinished), 653 PropertyDescription(kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished), 654 PropertyDescription(kOfxImageEffectPropRenderWindow, OFX::eInt, 4, eDescFinished), 655 PropertyDescription(kOfxImageEffectPropFieldToRender, OFX::eString, 1, eDescFinished), 656 }; 657 658 /** @brief kOfxImageEffectActionIsIdentity property set */ 659 static PropertySetDescription gIsIdentityActionInArgPropSet(kOfxImageEffectActionIsIdentity " in argument", 660 gIsIdentityActionInArgProps, sizeof(gIsIdentityActionInArgProps)/sizeof(PropertyDescription), 661 NULLPTR); 662 663 /** @brief kOfxImageEffectActionIsIdentity action's outargs properties */ 664 static PropertyDescription gIsIdentityActionOutArgProps[ ] = 665 { 666 PropertyDescription(kOfxPropTime, OFX::eDouble, 1, eDescFinished), 667 PropertyDescription(kOfxPropName, OFX::eString, 1, eDescFinished), 668 }; 669 670 /** @brief kOfxImageEffectActionIsIdentity property set */ 671 static PropertySetDescription gIsIdentityActionOutArgPropSet(kOfxImageEffectActionIsIdentity " out argument", 672 gIsIdentityActionOutArgProps, sizeof(gIsIdentityActionOutArgProps)/sizeof(PropertyDescription), 673 NULLPTR); 674 675 /** @brief kOfxImageEffectActionGetRegionOfDefinition action's inargs properties */ 676 static PropertyDescription gGetRegionOfDefinitionInArgProps[ ] = 677 { 678 PropertyDescription(kOfxPropTime, OFX::eDouble, 1, eDescFinished), 679 PropertyDescription(kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished), 680 }; 681 682 /** @brief kOfxImageEffectActionGetRegionOfDefinition property set */ 683 static PropertySetDescription gGetRegionOfDefinitionInArgPropSet(kOfxImageEffectActionGetRegionOfDefinition " in argument", 684 gGetRegionOfDefinitionInArgProps, sizeof(gGetRegionOfDefinitionInArgProps)/sizeof(PropertyDescription), 685 NULLPTR); 686 687 /** @brief kOfxImageEffectActionGetRegionOfDefinition action's outargs properties */ 688 static PropertyDescription gGetRegionOfDefinitionOutArgProps[ ] = 689 { 690 PropertyDescription(kOfxImageEffectPropRegionOfDefinition, OFX::eDouble, 4, eDescFinished), 691 }; 692 693 /** @brief kOfxImageEffectActionGetRegionOfDefinition property set */ 694 static PropertySetDescription gGetRegionOfDefinitionOutArgPropSet(kOfxImageEffectActionGetRegionOfDefinition " out argument", 695 gGetRegionOfDefinitionOutArgProps, sizeof(gGetRegionOfDefinitionOutArgProps)/sizeof(PropertyDescription), 696 NULLPTR); 697 698 /** @brief kOfxImageEffectActionGetRegionsOfInterest action's inargs properties */ 699 static PropertyDescription gGetRegionOfInterestInArgProps[ ] = 700 { 701 PropertyDescription(kOfxPropTime, OFX::eDouble, 1, eDescFinished), 702 PropertyDescription(kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished), 703 PropertyDescription(kOfxImageEffectPropRegionOfInterest, OFX::eDouble, 4, eDescFinished), 704 }; 705 706 /** @brief kOfxImageEffectActionGetRegionsOfInterest property set */ 707 static PropertySetDescription gGetRegionOfInterestInArgPropSet(kOfxImageEffectActionGetRegionsOfInterest "in argument", 708 gGetRegionOfInterestInArgProps, sizeof(gGetRegionOfInterestInArgProps)/sizeof(PropertyDescription), 709 NULLPTR); 710 711 /** @brief kOfxImageEffectActionGetTimeDomain action's outargs properties */ 712 static PropertyDescription gGetTimeDomainOutArgProps[ ] = 713 { 714 PropertyDescription(kOfxImageEffectPropFrameRange, OFX::eDouble, 2, eDescFinished), 715 }; 716 717 /** @brief kOfxImageEffectActionGetTimeDomain property set */ 718 static PropertySetDescription gGetTimeDomainOutArgPropSet(kOfxImageEffectActionGetTimeDomain " out argument", 719 gGetTimeDomainOutArgProps, sizeof(gGetTimeDomainOutArgProps)/sizeof(PropertyDescription), 720 NULLPTR); 721 722 /** @brief kOfxImageEffectActionGetFramesNeeded action's inargs properties */ 723 static PropertyDescription gGetFramesNeededInArgProps[ ] = 724 { 725 PropertyDescription(kOfxPropTime, OFX::eDouble, 1, eDescFinished), 726 }; 727 728 /** @brief kOfxImageEffectActionGetFramesNeeded property set */ 729 static PropertySetDescription gGetFramesNeededInArgPropSet(kOfxImageEffectActionGetFramesNeeded " in argument", 730 gGetFramesNeededInArgProps, sizeof(gGetFramesNeededInArgProps)/sizeof(PropertyDescription), 731 NULLPTR); 732 733 /** @brief kOfxImageEffectActionGetClipPreferences action's outargs properties */ 734 static PropertyDescription gGetClipPreferencesOutArgProps[ ] = 735 { 736 PropertyDescription(kOfxImageEffectPropFrameRate, OFX::eDouble, 1, eDescFinished), 737 PropertyDescription(kOfxImageClipPropFieldOrder, OFX::eString, 1, eDescFinished), 738 PropertyDescription(kOfxImageClipPropContinuousSamples, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 739 PropertyDescription(kOfxImageEffectFrameVarying, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 740 PropertyDescription(kOfxImageEffectPropPreMultiplication, OFX::eString, 1, eDescFinished), 741 }; 742 743 /** @brief kOfxImageEffectActionGetClipPreferences property set */ 744 static PropertySetDescription gGetClipPreferencesOutArgPropSet(kOfxImageEffectActionGetClipPreferences " out argument", 745 gGetClipPreferencesOutArgProps, sizeof(gGetClipPreferencesOutArgProps)/sizeof(PropertyDescription), 746 NULLPTR); 747 748 /** @brief kOfxActionInstanceChanged action's inargs properties */ 749 static PropertyDescription gInstanceChangedInArgProps[ ] = 750 { 751 PropertyDescription(kOfxPropType, OFX::eString, 1, eDescFinished), 752 PropertyDescription(kOfxPropName, OFX::eString, 1, eDescFinished), 753 PropertyDescription(kOfxPropChangeReason, OFX::eString, 1, eDescFinished), 754 PropertyDescription(kOfxPropTime, OFX::eDouble, 1, eDescFinished), 755 PropertyDescription(kOfxImageEffectPropRenderScale, OFX::eDouble, 2, eDescFinished), 756 }; 757 758 /** @brief kOfxActionInstanceChanged property set */ 759 static PropertySetDescription gInstanceChangedInArgPropSet(kOfxActionInstanceChanged " in argument", 760 gInstanceChangedInArgProps, sizeof(gInstanceChangedInArgProps)/sizeof(PropertyDescription), 761 NULLPTR); 762 763 /** @brief kOfxActionBeginInstanceChanged and kOfxActionEndInstanceChanged actions' inargs properties */ 764 static PropertyDescription gBeginEndInstanceChangedInArgProps[ ] = 765 { 766 PropertyDescription(kOfxPropChangeReason, OFX::eString, 1, eDescFinished), 767 }; 768 769 /** @brief kOfxActionBeginInstanceChanged property set */ 770 static PropertySetDescription gBeginInstanceChangedInArgPropSet(kOfxActionBeginInstanceChanged " in argument", 771 gBeginEndInstanceChangedInArgProps, sizeof(gBeginEndInstanceChangedInArgProps)/sizeof(PropertyDescription), 772 NULLPTR); 773 /** @brief kOfxActionEndInstanceChanged property set */ 774 static PropertySetDescription gEndInstanceChangedInArgPropSet(kOfxActionEndInstanceChanged " in argument", 775 gBeginEndInstanceChangedInArgProps, sizeof(gBeginEndInstanceChangedInArgProps)/sizeof(PropertyDescription), 776 NULLPTR); 777 778 779 //////////////////////////////////////////////////////////////////////////////// 780 // parameter properties 781 //////////////////////////////////////////////////////////////////////////////// 782 783 /** @brief Basic parameter descriptor properties */ 784 static PropertyDescription gBasicParamProps[ ] = 785 { 786 PropertyDescription(kOfxPropType, OFX::eString, 1, eDescDefault, kOfxTypeParameter, eDescFinished), 787 PropertyDescription(kOfxPropName, OFX::eString, 1, eDescFinished), 788 PropertyDescription(kOfxPropLabel, OFX::eString, 1, eDescFinished), 789 PropertyDescription(kOfxPropShortLabel, OFX::eString, 1, eDescFinished), 790 PropertyDescription(kOfxPropLongLabel, OFX::eString, 1, eDescFinished), 791 PropertyDescription(kOfxParamPropType, OFX::eString, 1, eDescFinished), 792 PropertyDescription(kOfxParamPropSecret, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 793 PropertyDescription(kOfxParamPropHint, OFX::eString, 1, eDescFinished), 794 PropertyDescription(kOfxParamPropScriptName, OFX::eString, 1, eDescFinished), 795 PropertyDescription(kOfxParamPropParent, OFX::eString, 1, eDescFinished), 796 PropertyDescription(kOfxParamPropEnabled, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 797 PropertyDescription(kOfxParamPropDataPtr, OFX::ePointer,1, eDescDefault, NULLPTR, eDescFinished), 798 }; 799 800 801 /** @brief Props for params that can have an interact override their UI */ 802 static PropertyDescription gInteractOverideParamProps[ ] = 803 { 804 PropertyDescription(kOfxParamPropInteractV1, OFX::ePointer,1, eDescFinished), 805 PropertyDescription(kOfxParamPropInteractSize, OFX::eDouble, 2, eDescFinished), 806 PropertyDescription(kOfxParamPropInteractSizeAspect, OFX::eDouble, 1, eDescDefault, 1.0, eDescFinished), 807 PropertyDescription(kOfxParamPropInteractMinimumSize, OFX::eDouble, 2, eDescDefault, 10., 10., eDescFinished), 808 PropertyDescription(kOfxParamPropInteractPreferedSize, OFX::eInt, 2, eDescDefault, 10, 10, eDescFinished), 809 }; 810 811 /** @brief Props for params that can hold values. */ 812 static PropertyDescription gValueHolderParamProps[ ] = 813 { 814 PropertyDescription(kOfxParamPropIsAnimating, OFX::eInt, 1, eDescFinished), 815 PropertyDescription(kOfxParamPropIsAutoKeying, OFX::eInt, 1, eDescFinished), 816 PropertyDescription(kOfxParamPropPersistent, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 817 PropertyDescription(kOfxParamPropEvaluateOnChange, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 818 # ifdef kOfxParamPropPluginMayWrite 819 PropertyDescription(kOfxParamPropPluginMayWrite, OFX::eInt, 1, eDescDefault, 0, eDescFinished), // removed in OFX 1.4 820 # endif 821 PropertyDescription(kOfxParamPropCacheInvalidation, OFX::eString, 1, eDescDefault, kOfxParamInvalidateValueChange, eDescFinished), 822 PropertyDescription(kOfxParamPropCanUndo, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 823 }; 824 825 /** @brief values for a string param */ 826 static PropertyDescription gStringParamProps[ ] = 827 { 828 PropertyDescription(kOfxParamPropDefault, OFX::eString, 1, eDescFinished), 829 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 830 PropertyDescription(kOfxParamPropStringMode, OFX::eString, 1, eDescDefault, kOfxParamStringIsSingleLine, eDescFinished), 831 PropertyDescription(kOfxParamPropStringFilePathExists, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 832 }; 833 834 /** @brief values for a string param */ 835 static PropertyDescription gCustomParamProps[ ] = 836 { 837 PropertyDescription(kOfxParamPropDefault, OFX::eString, 1, eDescFinished), 838 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 839 PropertyDescription(kOfxParamPropCustomInterpCallbackV1, OFX::ePointer, 1, eDescDefault, NULLPTR, eDescFinished), 840 }; 841 842 /** @brief properties for an RGB colour param */ 843 static PropertyDescription gRGBColourParamProps[ ] = 844 { 845 PropertyDescription(kOfxParamPropDefault, OFX::eDouble, 3, eDescFinished), 846 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 847 PropertyDescription(kOfxParamPropMin, OFX::eDouble, 3, eDescDefault, 0., 0., 0., eDescFinished), 848 PropertyDescription(kOfxParamPropMax, OFX::eDouble, 3, eDescDefault, 1., 1., 1., eDescFinished), 849 PropertyDescription(kOfxParamPropDisplayMin, OFX::eDouble, 3, eDescDefault, 0., 0., 0., eDescFinished), 850 PropertyDescription(kOfxParamPropDisplayMax, OFX::eDouble, 3, eDescDefault, 1., 1., 1., eDescFinished), 851 PropertyDescription(kOfxParamPropDimensionLabel, OFX::eString, 3, eDescDefault, "r", "g", "b", eDescFinished), 852 }; 853 854 /** @brief properties for an RGBA colour param */ 855 static PropertyDescription gRGBAColourParamProps[ ] = 856 { 857 PropertyDescription(kOfxParamPropDefault, OFX::eDouble, 4, eDescFinished), 858 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 859 PropertyDescription(kOfxParamPropMin, OFX::eDouble, 4, eDescDefault, 0., 0., 0., 0., eDescFinished), 860 PropertyDescription(kOfxParamPropMax, OFX::eDouble, 4, eDescDefault, 1., 1., 1., 1., eDescFinished), 861 PropertyDescription(kOfxParamPropDisplayMin, OFX::eDouble, 4, eDescDefault, 0., 0., 0., 0., eDescFinished), 862 PropertyDescription(kOfxParamPropDisplayMax, OFX::eDouble, 4, eDescDefault, 1., 1., 1., 1., eDescFinished), 863 PropertyDescription(kOfxParamPropDimensionLabel, OFX::eString, 4, eDescDefault, "r", "g", "b", "a", eDescFinished), 864 }; 865 866 /** @brief properties for a boolean param */ 867 static PropertyDescription gBooleanParamProps[ ] = 868 { 869 PropertyDescription(kOfxParamPropDefault, OFX::eInt, 1, eDescFinished), 870 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 871 }; 872 873 874 /** @brief properties for a boolean param */ 875 static PropertyDescription gChoiceParamProps[ ] = 876 { 877 PropertyDescription(kOfxParamPropDefault, OFX::eInt, 1, eDescFinished), 878 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 879 PropertyDescription(kOfxParamPropChoiceOption, OFX::eString, -1, eDescFinished), 880 }; 881 882 #ifdef OFX_EXTENSIONS_RESOLVE 883 /** @brief properties for a string choice param */ 884 static PropertyDescription gStrChoiceParamProps[ ] = 885 { 886 PropertyDescription(kOfxParamPropDefault, OFX::eString, 1, eDescFinished), 887 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 888 PropertyDescription(kOfxParamPropChoiceEnum, OFX::eString, -1, eDescFinished), 889 PropertyDescription(kOfxParamPropChoiceOption, OFX::eString, -1, eDescFinished), 890 }; 891 #endif 892 893 /** @brief properties for a 1D integer param */ 894 static PropertyDescription gInt1DParamProps[ ] = 895 { 896 PropertyDescription(kOfxParamPropDefault, OFX::eInt, 1, eDescFinished), 897 PropertyDescription(kOfxParamPropMin, OFX::eInt, 1, eDescFinished), 898 PropertyDescription(kOfxParamPropMax, OFX::eInt, 1, eDescFinished), 899 PropertyDescription(kOfxParamPropDisplayMin, OFX::eInt, 1, eDescFinished), 900 PropertyDescription(kOfxParamPropDisplayMax, OFX::eInt, 1, eDescFinished), 901 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 902 }; 903 904 /** @brief properties for a 2D integer param */ 905 static PropertyDescription gInt2DParamProps[ ] = 906 { 907 PropertyDescription(kOfxParamPropDefault, OFX::eInt, 2, eDescFinished), 908 PropertyDescription(kOfxParamPropMin, OFX::eInt, 2, eDescFinished), 909 PropertyDescription(kOfxParamPropMax, OFX::eInt, 2, eDescFinished), 910 PropertyDescription(kOfxParamPropDisplayMin, OFX::eInt, 2, eDescFinished), 911 PropertyDescription(kOfxParamPropDisplayMax, OFX::eInt, 2, eDescFinished), 912 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 913 PropertyDescription(kOfxParamPropDimensionLabel, OFX::eString, 2, eDescDefault, "x", "y", eDescFinished), 914 }; 915 916 /** @brief properties for a 3D integer param */ 917 static PropertyDescription gInt3DParamProps[ ] = 918 { 919 PropertyDescription(kOfxParamPropDefault, OFX::eInt, 3, eDescFinished), 920 PropertyDescription(kOfxParamPropMin, OFX::eInt, 3, eDescFinished), 921 PropertyDescription(kOfxParamPropMax, OFX::eInt, 3, eDescFinished), 922 PropertyDescription(kOfxParamPropDisplayMin, OFX::eInt, 3, eDescFinished), 923 PropertyDescription(kOfxParamPropDisplayMax, OFX::eInt, 3, eDescFinished), 924 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 925 PropertyDescription(kOfxParamPropDimensionLabel, OFX::eString, 3, eDescDefault, "x", "y", "z", eDescFinished), 926 }; 927 928 /** @brief Properties common to all double params */ 929 static PropertyDescription gDoubleParamProps[ ] = 930 { 931 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 932 PropertyDescription(kOfxParamPropIncrement, OFX::eDouble, 1, eDescFinished), 933 PropertyDescription(kOfxParamPropDigits, OFX::eInt, 1, eDescFinished), 934 PropertyDescription(kOfxParamPropDoubleType, OFX::eString, 1, eDescDefault, kOfxParamDoubleTypePlain, eDescFinished), 935 }; 936 937 938 /** @brief properties for a 1D double param */ 939 static PropertyDescription gDouble1DParamProps[ ] = 940 { 941 PropertyDescription(kOfxParamPropDefault, OFX::eDouble, 1, eDescFinished), 942 PropertyDescription(kOfxParamPropMin, OFX::eDouble, 1, eDescFinished), 943 PropertyDescription(kOfxParamPropMax, OFX::eDouble, 1, eDescFinished), 944 PropertyDescription(kOfxParamPropDisplayMin, OFX::eDouble, 1, eDescFinished), 945 PropertyDescription(kOfxParamPropDisplayMax, OFX::eDouble, 1, eDescFinished), 946 PropertyDescription(kOfxParamPropShowTimeMarker, OFX::eInt, 1, eDescDefault, 0, eDescFinished), 947 }; 948 949 /** @brief properties for a 2D double param */ 950 static PropertyDescription gDouble2DParamProps[ ] = 951 { 952 PropertyDescription(kOfxParamPropDefault, OFX::eDouble, 2, eDescFinished), 953 PropertyDescription(kOfxParamPropMin, OFX::eDouble, 2, eDescFinished), 954 PropertyDescription(kOfxParamPropMax, OFX::eDouble, 2, eDescFinished), 955 PropertyDescription(kOfxParamPropDisplayMin, OFX::eDouble, 2, eDescFinished), 956 PropertyDescription(kOfxParamPropDisplayMax, OFX::eDouble, 2, eDescFinished), 957 PropertyDescription(kOfxParamPropDimensionLabel, OFX::eString, 2, eDescDefault, "x", "y", eDescFinished), 958 }; 959 960 /** @brief properties for a 3D double param */ 961 static PropertyDescription gDouble3DParamProps[ ] = 962 { 963 PropertyDescription(kOfxParamPropDefault, OFX::eDouble, 3, eDescFinished), 964 PropertyDescription(kOfxParamPropMin, OFX::eDouble, 3, eDescFinished), 965 PropertyDescription(kOfxParamPropMax, OFX::eDouble, 3, eDescFinished), 966 PropertyDescription(kOfxParamPropDisplayMin, OFX::eDouble, 3, eDescFinished), 967 PropertyDescription(kOfxParamPropDisplayMax, OFX::eDouble, 3, eDescFinished), 968 PropertyDescription(kOfxParamPropDimensionLabel, OFX::eString, 3, eDescDefault, "x", "y", "z", eDescFinished), 969 }; 970 971 /** @brief properties for a group param */ 972 static PropertyDescription gGroupParamProps[ ] = 973 { 974 PropertyDescription(kOfxParamPropGroupOpen, OFX::eInt, 1, eDescFinished), 975 }; 976 977 /** @brief properties for a page param */ 978 static PropertyDescription gPageParamProps[ ] = 979 { 980 PropertyDescription(kOfxParamPropPageChild, OFX::eString, -1, eDescFinished), 981 }; 982 983 /** @brief properties for a parametric param */ 984 static PropertyDescription gParametricParamProps[ ] = 985 { 986 PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 987 PropertyDescription(kOfxParamPropCanUndo, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 988 PropertyDescription(kOfxParamPropParametricDimension, OFX::eInt, 1, eDescDefault, 1, eDescFinished), 989 PropertyDescription(kOfxParamPropParametricUIColour, OFX::eDouble, -1, eDescFinished), 990 PropertyDescription(kOfxParamPropParametricInteractBackground, OFX::ePointer, 1, eDescDefault, NULLPTR, eDescFinished), 991 PropertyDescription(kOfxParamPropParametricRange, OFX::eDouble, 2, eDescDefault, 0.0, 1.0, eDescFinished), 992 }; 993 994 /** @brief Property set for 1D ints */ 995 static PropertySetDescription gInt1DParamPropSet("1D Integer parameter", 996 mPropDescriptionArg(gBasicParamProps), 997 mPropDescriptionArg(gInteractOverideParamProps), 998 mPropDescriptionArg(gValueHolderParamProps), 999 mPropDescriptionArg(gInt1DParamProps), 1000 NULLPTR); 1001 1002 1003 /** @brief Property set for 2D ints */ 1004 static PropertySetDescription gInt2DParamPropSet("2D Integer parameter", 1005 mPropDescriptionArg(gBasicParamProps), 1006 mPropDescriptionArg(gInteractOverideParamProps), 1007 mPropDescriptionArg(gValueHolderParamProps), 1008 mPropDescriptionArg(gInt2DParamProps), 1009 NULLPTR); 1010 1011 /** @brief Property set for 3D ints */ 1012 static PropertySetDescription gInt3DParamPropSet("3D Integer parameter", 1013 mPropDescriptionArg(gBasicParamProps), 1014 mPropDescriptionArg(gInteractOverideParamProps), 1015 mPropDescriptionArg(gValueHolderParamProps), 1016 mPropDescriptionArg(gInt3DParamProps), 1017 NULLPTR); 1018 1019 /** @brief Property set for 1D doubles */ 1020 static PropertySetDescription gDouble1DParamPropSet("1D Double parameter", 1021 mPropDescriptionArg(gBasicParamProps), 1022 mPropDescriptionArg(gInteractOverideParamProps), 1023 mPropDescriptionArg(gValueHolderParamProps), 1024 mPropDescriptionArg(gDoubleParamProps), 1025 mPropDescriptionArg(gDouble1DParamProps), 1026 NULLPTR); 1027 1028 1029 /** @brief Property set for 2D doubles */ 1030 static PropertySetDescription gDouble2DParamPropSet("2D Double parameter", 1031 mPropDescriptionArg(gBasicParamProps), 1032 mPropDescriptionArg(gInteractOverideParamProps), 1033 mPropDescriptionArg(gValueHolderParamProps), 1034 mPropDescriptionArg(gDoubleParamProps), 1035 mPropDescriptionArg(gDouble2DParamProps), 1036 NULLPTR); 1037 1038 /** @brief Property set for 3D doubles */ 1039 static PropertySetDescription gDouble3DParamPropSet("3D Double parameter", 1040 mPropDescriptionArg(gBasicParamProps), 1041 mPropDescriptionArg(gInteractOverideParamProps), 1042 mPropDescriptionArg(gValueHolderParamProps), 1043 mPropDescriptionArg(gDoubleParamProps), 1044 mPropDescriptionArg(gDouble3DParamProps), 1045 NULLPTR); 1046 1047 /** @brief Property set for RGB colour params */ 1048 static PropertySetDescription gRGBParamPropSet("RGB Colour parameter", 1049 mPropDescriptionArg(gBasicParamProps), 1050 mPropDescriptionArg(gInteractOverideParamProps), 1051 mPropDescriptionArg(gValueHolderParamProps), 1052 mPropDescriptionArg(gRGBColourParamProps), 1053 NULLPTR); 1054 1055 /** @brief Property set for RGB colour params */ 1056 static PropertySetDescription gRGBAParamPropSet("RGB Colour parameter", 1057 mPropDescriptionArg(gBasicParamProps), 1058 mPropDescriptionArg(gInteractOverideParamProps), 1059 mPropDescriptionArg(gValueHolderParamProps), 1060 mPropDescriptionArg(gRGBAColourParamProps), 1061 NULLPTR); 1062 1063 /** @brief Property set for string params */ 1064 static PropertySetDescription gStringParamPropSet("String parameter", 1065 mPropDescriptionArg(gBasicParamProps), 1066 mPropDescriptionArg(gInteractOverideParamProps), 1067 mPropDescriptionArg(gValueHolderParamProps), 1068 mPropDescriptionArg(gStringParamProps), 1069 NULLPTR); 1070 1071 /** @brief Property set for string params */ 1072 static PropertySetDescription gCustomParamPropSet("Custom parameter", 1073 mPropDescriptionArg(gBasicParamProps), 1074 mPropDescriptionArg(gInteractOverideParamProps), 1075 mPropDescriptionArg(gValueHolderParamProps), 1076 mPropDescriptionArg(gCustomParamProps), 1077 NULLPTR); 1078 1079 /** @brief Property set for boolean params */ 1080 static PropertySetDescription gBooleanParamPropSet("Boolean parameter", 1081 mPropDescriptionArg(gBasicParamProps), 1082 mPropDescriptionArg(gInteractOverideParamProps), 1083 mPropDescriptionArg(gValueHolderParamProps), 1084 mPropDescriptionArg(gBooleanParamProps), 1085 NULLPTR); 1086 1087 /** @brief Property set for choice params */ 1088 static PropertySetDescription gChoiceParamPropSet("Choice parameter", 1089 mPropDescriptionArg(gBasicParamProps), 1090 mPropDescriptionArg(gInteractOverideParamProps), 1091 mPropDescriptionArg(gValueHolderParamProps), 1092 mPropDescriptionArg(gChoiceParamProps), 1093 NULLPTR); 1094 1095 #ifdef OFX_EXTENSIONS_RESOLVE 1096 /** @brief Property set for string choice params */ 1097 static PropertySetDescription gStrChoiceParamPropSet("String Choice parameter", 1098 mPropDescriptionArg(gBasicParamProps), 1099 mPropDescriptionArg(gInteractOverideParamProps), 1100 mPropDescriptionArg(gValueHolderParamProps), 1101 mPropDescriptionArg(gStrChoiceParamProps), 1102 NULLPTR); 1103 #endif 1104 1105 /** @brief Property set for push button params */ 1106 static PropertySetDescription gPushButtonParamPropSet("PushButton parameter", 1107 mPropDescriptionArg(gBasicParamProps), 1108 mPropDescriptionArg(gInteractOverideParamProps), 1109 NULLPTR); 1110 1111 /** @brief Property set for group params */ 1112 static PropertySetDescription gGroupParamPropSet("Group Parameter", 1113 mPropDescriptionArg(gBasicParamProps), 1114 mPropDescriptionArg(gGroupParamProps), 1115 NULLPTR); 1116 1117 /** @brief Property set for page params */ 1118 static PropertySetDescription gPageParamPropSet("Page Parameter", 1119 mPropDescriptionArg(gBasicParamProps), 1120 mPropDescriptionArg(gPageParamProps), 1121 NULLPTR); 1122 1123 static PropertySetDescription gParametricParamPropSet("Parametric Parameter", 1124 mPropDescriptionArg(gBasicParamProps), 1125 mPropDescriptionArg(gInteractOverideParamProps), 1126 mPropDescriptionArg(gValueHolderParamProps), 1127 mPropDescriptionArg(gParametricParamProps), 1128 NULLPTR); 1129 #endif 1130 /** @brief Validates the host structure and property handle */ 1131 void validateHostProperties(OfxHost * host)1132 validateHostProperties(OfxHost *host) 1133 { 1134 #ifdef kOfxsDisableValidation 1135 (void)host; 1136 #else 1137 // make a description set 1138 PropertySet props(host->host); 1139 gHostPropSet.validate(props); 1140 #endif 1141 } 1142 1143 /** @brief Validates the effect descriptor properties */ 1144 void validatePluginDescriptorProperties(PropertySet props)1145 validatePluginDescriptorProperties(PropertySet props) 1146 { 1147 #ifdef kOfxsDisableValidation 1148 (void)props; 1149 #else 1150 gPluginDescriptorPropSet.validate(props); 1151 #endif 1152 } 1153 1154 /** @brief Validates the effect instance properties */ 1155 void validatePluginInstanceProperties(PropertySet props)1156 validatePluginInstanceProperties(PropertySet props) 1157 { 1158 #ifdef kOfxsDisableValidation 1159 (void)props; 1160 #else 1161 gPluginInstancePropSet.validate(props); 1162 #endif 1163 } 1164 1165 /** @brief validates a clip descriptor */ 1166 void validateClipDescriptorProperties(PropertySet props)1167 validateClipDescriptorProperties(PropertySet props) 1168 { 1169 #ifdef kOfxsDisableValidation 1170 (void)props; 1171 #else 1172 gClipDescriptorPropSet.validate(props); 1173 #endif 1174 } 1175 1176 /** @brief validates a clip instance */ 1177 void validateClipInstanceProperties(PropertySet props)1178 validateClipInstanceProperties(PropertySet props) 1179 { 1180 #ifdef kOfxsDisableValidation 1181 (void)props; 1182 #else 1183 gClipInstancePropSet.validate(props); 1184 #endif 1185 } 1186 1187 #ifdef OFX_EXTENSIONS_NUKE 1188 /** @brief validates a camera descriptor */ 1189 void validateCameraDescriptorProperties(PropertySet props)1190 validateCameraDescriptorProperties(PropertySet props) 1191 { 1192 #ifdef kOfxsDisableValidation 1193 (void)props; 1194 #else 1195 gCameraDescriptorPropSet.validate(props); 1196 #endif 1197 } 1198 1199 /** @brief validates a camera instance */ 1200 void validateCameraInstanceProperties(PropertySet props)1201 validateCameraInstanceProperties(PropertySet props) 1202 { 1203 #ifdef kOfxsDisableValidation 1204 (void)props; 1205 #else 1206 gCameraInstancePropSet.validate(props); 1207 #endif 1208 } 1209 #endif 1210 1211 /** @brief validates an image or texture instance */ 1212 void validateImageBaseProperties(PropertySet props)1213 validateImageBaseProperties(PropertySet props) 1214 { 1215 #ifdef kOfxsDisableValidation 1216 (void)props; 1217 #else 1218 gImageBaseInstancePropSet.validate(props); 1219 #endif 1220 } 1221 1222 /** @brief validates an image instance */ 1223 void validateImageProperties(PropertySet props)1224 validateImageProperties(PropertySet props) 1225 { 1226 #ifdef kOfxsDisableValidation 1227 (void)props; 1228 #else 1229 gImageInstancePropSet.validate(props); 1230 #endif 1231 } 1232 1233 #ifdef OFX_SUPPORTS_OPENGLRENDER 1234 /** @brief validates an OpenGL texture instance */ 1235 void validateTextureProperties(PropertySet props)1236 validateTextureProperties(PropertySet props) 1237 { 1238 #ifdef kOfxsDisableValidation 1239 (void)props; 1240 #else 1241 gTextureInstancePropSet.validate(props); 1242 #endif 1243 } 1244 #endif 1245 1246 /** @brief Validates action in/out arguments */ 1247 void validateActionArgumentsProperties(const std::string & action,PropertySet inArgs,PropertySet outArgs)1248 validateActionArgumentsProperties(const std::string &action, PropertySet inArgs, PropertySet outArgs) 1249 { 1250 #ifdef kOfxsDisableValidation 1251 (void)action; 1252 (void)inArgs; 1253 (void)outArgs; 1254 #else 1255 if(action == kOfxActionInstanceChanged) { 1256 gInstanceChangedInArgPropSet.validate(inArgs); 1257 } 1258 else if(action == kOfxActionBeginInstanceChanged) { 1259 gBeginInstanceChangedInArgPropSet.validate(inArgs); 1260 } 1261 else if(action == kOfxActionEndInstanceChanged) { 1262 gEndInstanceChangedInArgPropSet.validate(inArgs); 1263 } 1264 else if(action == kOfxImageEffectActionGetRegionOfDefinition) { 1265 gGetRegionOfDefinitionInArgPropSet.validate(inArgs); 1266 gGetRegionOfDefinitionOutArgPropSet.validate(outArgs); 1267 } 1268 else if(action == kOfxImageEffectActionGetRegionsOfInterest) { 1269 gGetRegionOfInterestInArgPropSet.validate(inArgs); 1270 } 1271 else if(action == kOfxImageEffectActionGetTimeDomain) { 1272 gGetTimeDomainOutArgPropSet.validate(outArgs); 1273 } 1274 else if(action == kOfxImageEffectActionGetFramesNeeded) { 1275 gGetFramesNeededInArgPropSet.validate(inArgs); 1276 } 1277 else if(action == kOfxImageEffectActionGetClipPreferences) { 1278 gGetClipPreferencesOutArgPropSet.validate(outArgs); 1279 } 1280 else if(action == kOfxImageEffectActionIsIdentity) { 1281 gIsIdentityActionInArgPropSet.validate(inArgs); 1282 gIsIdentityActionOutArgPropSet.validate(outArgs); 1283 } 1284 else if(action == kOfxImageEffectActionRender) { 1285 gRenderActionInArgPropSet.validate(inArgs); 1286 } 1287 else if(action == kOfxImageEffectActionBeginSequenceRender) { 1288 gBeginSequenceRenderActionInArgPropSet.validate(inArgs); 1289 } 1290 else if(action == kOfxImageEffectActionEndSequenceRender) { 1291 gEndSequenceRenderActionInArgPropSet.validate(inArgs); 1292 } 1293 else if(action == kOfxImageEffectActionDescribeInContext) { 1294 gDescribeInContextActionInArgPropSet.validate(inArgs); 1295 } 1296 #endif 1297 } 1298 1299 /** @brief Validates parameter properties */ 1300 void validateParameterProperties(ParamTypeEnum paramType,OFX::PropertySet paramProps,bool checkDefaults)1301 validateParameterProperties(ParamTypeEnum paramType, 1302 OFX::PropertySet paramProps, 1303 bool checkDefaults) 1304 { 1305 #ifdef kOfxsDisableValidation 1306 (void)paramType; 1307 (void)paramProps; 1308 (void)checkDefaults; 1309 #else 1310 // should use a map here 1311 switch(paramType) 1312 { 1313 case eStringParam : 1314 gStringParamPropSet.validate(paramProps, checkDefaults); 1315 break; 1316 case eIntParam : 1317 gInt1DParamPropSet.validate(paramProps, checkDefaults); 1318 break; 1319 case eInt2DParam : 1320 gInt2DParamPropSet.validate(paramProps, checkDefaults); 1321 break; 1322 case eInt3DParam : 1323 gInt3DParamPropSet.validate(paramProps, checkDefaults); 1324 break; 1325 case eDoubleParam : 1326 gDouble1DParamPropSet.validate(paramProps, checkDefaults); 1327 break; 1328 case eDouble2DParam : 1329 gDouble2DParamPropSet.validate(paramProps, checkDefaults); 1330 break; 1331 case eDouble3DParam : 1332 gDouble3DParamPropSet.validate(paramProps, checkDefaults); 1333 break; 1334 case eRGBParam : 1335 gRGBParamPropSet.validate(paramProps, checkDefaults); 1336 break; 1337 case eRGBAParam : 1338 gRGBAParamPropSet.validate(paramProps, checkDefaults); 1339 break; 1340 case eBooleanParam : 1341 gBooleanParamPropSet.validate(paramProps, checkDefaults); 1342 break; 1343 case eChoiceParam : 1344 gChoiceParamPropSet.validate(paramProps, checkDefaults); 1345 break; 1346 #ifdef OFX_EXTENSIONS_RESOLVE 1347 case eStrChoiceParam : 1348 gStrChoiceParamPropSet.validate(paramProps, checkDefaults); 1349 break; 1350 #endif 1351 case eCustomParam : 1352 gCustomParamPropSet.validate(paramProps, checkDefaults); 1353 break; 1354 case eGroupParam : 1355 gGroupParamPropSet.validate(paramProps, checkDefaults); 1356 break; 1357 case ePageParam : 1358 gPageParamPropSet.validate(paramProps, checkDefaults); 1359 break; 1360 case ePushButtonParam : 1361 gPushButtonParamPropSet.validate(paramProps, checkDefaults); 1362 break; 1363 case eParametricParam: 1364 gParametricParamPropSet.validate(paramProps, checkDefaults); 1365 break; 1366 case eDummyParam: 1367 //default: 1368 break; 1369 } 1370 #endif 1371 } 1372 1373 //////////////////////////////////////////////////////////////////////////////// 1374 // 1375 1376 /** @brief Initialises validation stuff that needs to be done once we know how the host behaves, called during the onload action */ 1377 void initialise(void)1378 initialise(void) 1379 { 1380 #ifndef kOfxsDisableValidation 1381 static bool beenInitialised = false; 1382 if(!beenInitialised && getImageEffectHostDescription()) { 1383 beenInitialised = true; 1384 1385 // create new property descriptions depending on certain host states 1386 PropertyDescription *desc; 1387 1388 // do custom params animate ? 1389 desc = new PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, 1390 eDescDefault, int(getImageEffectHostDescription()->supportsCustomAnimation), 1391 eDescFinished); 1392 gCustomParamPropSet.addProperty(desc, true); 1393 1394 // do strings animate ? 1395 desc = new PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, 1396 eDescDefault, int(getImageEffectHostDescription()->supportsStringAnimation), 1397 eDescFinished); 1398 gStringParamPropSet.addProperty(desc, true); 1399 1400 // do choice params animate 1401 desc = new PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, 1402 eDescDefault, int(getImageEffectHostDescription()->supportsChoiceAnimation), 1403 eDescFinished); 1404 gChoiceParamPropSet.addProperty(desc, true); 1405 1406 #ifdef OFX_EXTENSIONS_RESOLVE 1407 // do string choice params animate 1408 desc = new PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, 1409 eDescDefault, int(getImageEffectHostDescription()->supportsStrChoiceAnimation), 1410 eDescFinished); 1411 gStrChoiceParamPropSet.addProperty(desc, true); 1412 #endif 1413 1414 // do choice params animate 1415 desc = new PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1, 1416 eDescDefault, int(getImageEffectHostDescription()->supportsBooleanAnimation), 1417 eDescFinished); 1418 gBooleanParamPropSet.addProperty(desc, true); 1419 } 1420 #endif 1421 } 1422 }; 1423 }; 1424