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 /** @brief This file contains code that skins the ofx param suite */ 00038 00039 #include "ofxsSupportPrivate.h" 00040 #include "ofxsUtilities.h" 00041 #include "ofxParametricParam.h" 00042 #include "extensions/nuke/camera.h" 00043 #include "extensions/tuttle/ofxParam.h" 00044 00045 #include <cstring> 00046 00047 /** @brief The core 'OFX Support' namespace, used by plugin implementations. All code for these are defined in the common support libraries. */ 00048 namespace OFX { 00049 00050 /** @brief dummy page positioning parameter to be passed to @ref OFX::PageParamDescriptor::addChild */ 00051 DummyParamDescriptor PageParamDescriptor::gSkipRow( kOfxParamPageSkipRow ); 00052 00053 /** @brief dummy page positioning parameter to be passed to @ref OFX::PageParamDescriptor::addChild */ 00054 DummyParamDescriptor PageParamDescriptor::gSkipColumn( kOfxParamPageSkipColumn ); 00055 00056 /** @brief turns a ParamTypeEnum into the char * that raw OFX uses */ 00057 const char* mapParamTypeEnumToString( ParamTypeEnum v ) 00058 { 00059 switch( v ) 00060 { 00061 case eStringParam: return kOfxParamTypeString ; 00062 case eIntParam: return kOfxParamTypeInteger ; 00063 case eInt2DParam: return kOfxParamTypeInteger2D ; 00064 case eInt3DParam: return kOfxParamTypeInteger3D ; 00065 case eDoubleParam: return kOfxParamTypeDouble ; 00066 case eDouble2DParam: return kOfxParamTypeDouble2D ; 00067 case eDouble3DParam: return kOfxParamTypeDouble3D ; 00068 case eRGBParam: return kOfxParamTypeRGB ; 00069 case eRGBAParam: return kOfxParamTypeRGBA ; 00070 case eBooleanParam: return kOfxParamTypeBoolean ; 00071 case eChoiceParam: return kOfxParamTypeChoice ; 00072 case eCustomParam: return kOfxParamTypeCustom ; 00073 case eGroupParam: return kOfxParamTypeGroup ; 00074 case ePageParam: return kOfxParamTypePage ; 00075 case ePushButtonParam: return kOfxParamTypePushButton ; 00076 case eParametricParam: return kOfxParamTypeParametric ; 00077 default: assert( false ); 00078 } 00079 return kOfxParamTypeInteger; 00080 } 00081 00082 bool isEqual( const char* t1, const char* t2 ) 00083 { 00084 return strcmp( t1, t2 ) == 0; 00085 } 00086 00087 ParamTypeEnum mapParamTypeStringToEnum( const char* v ) 00088 { 00089 if( isEqual( kOfxParamTypeString, v ) ) 00090 return eStringParam ; 00091 else if( isEqual( kOfxParamTypeInteger, v ) ) 00092 return eIntParam ; 00093 else if( isEqual( kOfxParamTypeInteger2D, v ) ) 00094 return eInt2DParam ; 00095 else if( isEqual( kOfxParamTypeInteger3D, v ) ) 00096 return eInt3DParam ; 00097 else if( isEqual( kOfxParamTypeDouble, v ) ) 00098 return eDoubleParam ; 00099 else if( isEqual( kOfxParamTypeDouble2D, v ) ) 00100 return eDouble2DParam ; 00101 else if( isEqual( kOfxParamTypeDouble3D, v ) ) 00102 return eDouble3DParam ; 00103 else if( isEqual( kOfxParamTypeRGB, v ) ) 00104 return eRGBParam ; 00105 else if( isEqual( kOfxParamTypeRGBA, v ) ) 00106 return eRGBAParam ; 00107 else if( isEqual( kOfxParamTypeBoolean, v ) ) 00108 return eBooleanParam ; 00109 else if( isEqual( kOfxParamTypeChoice, v ) ) 00110 return eChoiceParam ; 00111 else if( isEqual( kOfxParamTypeCustom, v ) ) 00112 return eCustomParam ; 00113 else if( isEqual( kOfxParamTypeGroup, v ) ) 00114 return eGroupParam ; 00115 else if( isEqual( kOfxParamTypePage, v ) ) 00116 return ePageParam ; 00117 else if( isEqual( kOfxParamTypePushButton, v ) ) 00118 return ePushButtonParam ; 00119 else if( isEqual( kOfxParamTypeParametric, v ) ) 00120 return eParametricParam ; 00121 else 00122 assert( false ); 00123 return ePushButtonParam ; 00124 } 00125 00126 //////////////////////////////////////////////////////////////////////////////// 00127 // the base class for all param descriptors 00128 00129 /** @brief ctor */ 00130 ParamDescriptor::ParamDescriptor( const std::string& name, ParamTypeEnum type, OfxPropertySetHandle props ) 00131 : _paramName( name ), 00132 _paramType( type ), 00133 _paramProps( props ) 00134 { 00135 // validate the properities on this descriptor 00136 if( type != eDummyParam ) 00137 OFX::Validation::validateParameterProperties( type, getProps(), true ); 00138 } 00139 00140 ParamDescriptor::~ParamDescriptor() 00141 {} 00142 00143 /** @brief set the label properties */ 00144 void ParamDescriptor::setLabels( const std::string& label, const std::string& shortLabel, const std::string& longLabel ) 00145 { 00146 getProps().propSetString( kOfxPropLabel, label ); 00147 getProps().propSetString( kOfxPropShortLabel, shortLabel, false ); 00148 getProps().propSetString( kOfxPropLongLabel, longLabel, false ); 00149 } 00150 00151 /** @brief set the param hint */ 00152 void ParamDescriptor::setHint( const std::string& v ) 00153 { 00154 getProps().propSetString( kOfxParamPropHint, v, false ); 00155 } 00156 00157 /** @brief set the script name, default is the name it was defined with */ 00158 void ParamDescriptor::setScriptName( const std::string& v ) 00159 { 00160 getProps().propSetString( kOfxParamPropScriptName, v, false ); 00161 } 00162 00163 /** @brief set the secretness of the param, defaults to false */ 00164 void ParamDescriptor::setIsSecret( bool v ) 00165 { 00166 getProps().propSetInt( kOfxParamPropSecret, v ); 00167 } 00168 00169 /** @brief set the secretness of the param, defaults to false */ 00170 void ParamDescriptor::setEnabled( bool v ) 00171 { 00172 getProps().propSetInt( kOfxParamPropEnabled, v ); 00173 } 00174 00175 void ParamDescriptor::setLayoutHint( const ELayoutHint layoutHint ) 00176 { 00177 getProps().propSetInt( kOfxParamPropLayoutHint, static_cast<int>(layoutHint) ); 00178 } 00179 00180 00181 /** @brief set the group param that is the parent of this one, default is to be ungrouped at the root level */ 00182 void ParamDescriptor::setParent( const GroupParamDescriptor& v ) 00183 { 00184 getProps().propSetString( kOfxParamPropParent, v.getName() ); 00185 } 00186 00187 //////////////////////////////////////////////////////////////////////////////// 00188 // the base class for all params that can hold a value 00189 00190 /** @brief ctor */ 00191 ValueParamDescriptor::ValueParamDescriptor( const std::string& name, ParamTypeEnum type, OfxPropertySetHandle props ) 00192 : ParamDescriptor( name, type, props ) 00193 {} 00194 00195 /** @brief dtor */ 00196 ValueParamDescriptor::~ValueParamDescriptor() 00197 {} 00198 00199 /** @brief set whether the param can animate, defaults to true in most cases */ 00200 void ValueParamDescriptor::setAnimates( bool v ) 00201 { 00202 getProps().propSetInt( kOfxParamPropAnimates, v ); 00203 } 00204 00205 /** @brief set whether the param is persistant, defaults to true */ 00206 void ValueParamDescriptor::setIsPersistant( bool v ) 00207 { 00208 getProps().propSetInt( kOfxParamPropPersistant, v ); 00209 } 00210 00211 /** @brief Set's whether the value of the param is significant (ie: affects the rendered image), defaults to true */ 00212 void ValueParamDescriptor::setEvaluateOnChange( bool v ) 00213 { 00214 getProps().propSetInt( kOfxParamPropEvaluateOnChange, v ); 00215 } 00216 00217 /** @brief Set's whether the value of the param is significant (ie: affects the rendered image), defaults to true */ 00218 void ValueParamDescriptor::setCanUndo( bool v ) 00219 { 00220 getProps().propSetInt( kOfxParamPropCanUndo, v, 0, false ); 00221 } 00222 00223 /** @brief Set's how any cache should be invalidated if the parameter is changed, defaults to eCacheInvalidateValueChange */ 00224 void ValueParamDescriptor::setCacheInvalidation( CacheInvalidationEnum v ) 00225 { 00226 switch( v ) 00227 { 00228 case eCacheInvalidateValueChange: 00229 getProps().propSetString( kOfxParamPropCacheInvalidation, kOfxParamInvalidateValueChange ); 00230 break; 00231 00232 case eCacheInvalidateValueChangeToEnd: 00233 getProps().propSetString( kOfxParamPropCacheInvalidation, kOfxParamInvalidateValueChangeToEnd ); 00234 break; 00235 00236 case eCacheInvalidateValueAll: 00237 getProps().propSetString( kOfxParamPropCacheInvalidation, kOfxParamInvalidateAll ); 00238 break; 00239 } 00240 } 00241 00242 void ValueParamDescriptor::setInteractDescriptor( ParamInteractWrap* desc) 00243 { 00244 _interact.reset( desc ); 00245 getProps().propSetPointer( kOfxParamPropInteractV1, (void*)desc->getMainEntry() ); 00246 desc->getDescriptor().setParamName(getName()); 00247 } 00248 00249 //////////////////////////////////////////////////////////////////////////////// 00250 // int param descriptor 00251 00252 /** @brief ctor */ 00253 IntParamDescriptor::IntParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00254 : ValueParamDescriptor( name, eIntParam, props ) 00255 {} 00256 00257 /** @brief set the default value, default is 0 */ 00258 void IntParamDescriptor::setDefault( int v ) 00259 { 00260 getProps().propSetInt( kOfxParamPropDefault, v ); 00261 } 00262 00263 /** @brief set the hard min/max range, default is INT_MIN, INT_MAX */ 00264 void IntParamDescriptor::setRange( int min, int max ) 00265 { 00266 getProps().propSetInt( kOfxParamPropMin, min ); 00267 getProps().propSetInt( kOfxParamPropMax, max ); 00268 } 00269 00270 /** @brief set the display min and max, default is to be the same as the range param */ 00271 void IntParamDescriptor::setDisplayRange( int min, int max ) 00272 { 00273 getProps().propSetInt( kOfxParamPropDisplayMin, min ); 00274 getProps().propSetInt( kOfxParamPropDisplayMax, max ); 00275 } 00276 00277 //////////////////////////////////////////////////////////////////////////////// 00278 // 2D int param descriptor 00279 00280 /** @brief ctor */ 00281 Int2DParamDescriptor::Int2DParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00282 : ValueParamDescriptor( name, eInt2DParam, props ) 00283 {} 00284 00285 /** @brief set the default value, default is 0 */ 00286 void Int2DParamDescriptor::setDefault( int x, int y ) 00287 { 00288 getProps().propSetInt( kOfxParamPropDefault, x, 0 ); 00289 getProps().propSetInt( kOfxParamPropDefault, y, 1 ); 00290 } 00291 00292 /** @brief set the hard min/max range, default is INT_MIN, INT_MAX */ 00293 void Int2DParamDescriptor::setRange( int xmin, int ymin, 00294 int xmax, int ymax ) 00295 { 00296 getProps().propSetInt( kOfxParamPropMin, xmin, 0 ); 00297 getProps().propSetInt( kOfxParamPropMin, ymin, 1 ); 00298 getProps().propSetInt( kOfxParamPropMax, xmax, 0 ); 00299 getProps().propSetInt( kOfxParamPropMax, ymax, 1 ); 00300 } 00301 00302 /** @brief set the display min and max, default is to be the same as the range param */ 00303 void Int2DParamDescriptor::setDisplayRange( int xmin, int ymin, 00304 int xmax, int ymax ) 00305 { 00306 getProps().propSetInt( kOfxParamPropDisplayMin, xmin, 0 ); 00307 getProps().propSetInt( kOfxParamPropDisplayMin, ymin, 1 ); 00308 getProps().propSetInt( kOfxParamPropDisplayMax, xmax, 0 ); 00309 getProps().propSetInt( kOfxParamPropDisplayMax, ymax, 1 ); 00310 } 00311 00312 void Int2DParamDescriptor::setDimensionLabels( const std::string& x, const std::string& y ) 00313 { 00314 getProps().propSetString( kOfxParamPropDimensionLabel, x, 0 ); 00315 getProps().propSetString( kOfxParamPropDimensionLabel, y, 1 ); 00316 } 00317 00318 //////////////////////////////////////////////////////////////////////////////// 00319 // 3D int param descriptor 00320 00321 /** @brief ctor */ 00322 Int3DParamDescriptor::Int3DParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00323 : ValueParamDescriptor( name, eInt3DParam, props ) 00324 {} 00325 00326 /** @brief set the default value, default is 0 */ 00327 void Int3DParamDescriptor::setDefault( int x, int y, int z ) 00328 { 00329 getProps().propSetInt( kOfxParamPropDefault, x, 0 ); 00330 getProps().propSetInt( kOfxParamPropDefault, y, 1 ); 00331 getProps().propSetInt( kOfxParamPropDefault, z, 2 ); 00332 } 00333 00334 /** @brief set the hard min/max range, default is INT_MIN, INT_MAX */ 00335 void Int3DParamDescriptor::setRange( int xmin, int ymin, int zmin, 00336 int xmax, int ymax, int zmax ) 00337 { 00338 getProps().propSetInt( kOfxParamPropMin, xmin, 0 ); 00339 getProps().propSetInt( kOfxParamPropMin, ymin, 1 ); 00340 getProps().propSetInt( kOfxParamPropMin, zmin, 2 ); 00341 getProps().propSetInt( kOfxParamPropMax, xmax, 0 ); 00342 getProps().propSetInt( kOfxParamPropMax, ymax, 1 ); 00343 getProps().propSetInt( kOfxParamPropMax, zmax, 2 ); 00344 } 00345 00346 /** @brief set the display min and max, default is to be the same as the range param */ 00347 void Int3DParamDescriptor::setDisplayRange( int xmin, int ymin, int zmin, 00348 int xmax, int ymax, int zmax ) 00349 { 00350 getProps().propSetInt( kOfxParamPropDisplayMin, xmin, 0 ); 00351 getProps().propSetInt( kOfxParamPropDisplayMin, ymin, 1 ); 00352 getProps().propSetInt( kOfxParamPropDisplayMin, zmin, 2 ); 00353 getProps().propSetInt( kOfxParamPropDisplayMax, xmax, 0 ); 00354 getProps().propSetInt( kOfxParamPropDisplayMax, ymax, 1 ); 00355 getProps().propSetInt( kOfxParamPropDisplayMax, zmax, 2 ); 00356 } 00357 00358 void Int3DParamDescriptor::setDimensionLabels( const std::string& x, const std::string& y, const std::string& z ) 00359 { 00360 getProps().propSetString( kOfxParamPropDimensionLabel, x, 0 ); 00361 getProps().propSetString( kOfxParamPropDimensionLabel, y, 1 ); 00362 getProps().propSetString( kOfxParamPropDimensionLabel, z, 2 ); 00363 } 00364 00365 //////////////////////////////////////////////////////////////////////////////// 00366 // base class for all double param descriptors 00367 00368 /** @brief hidden constructor */ 00369 BaseDoubleParamDescriptor::BaseDoubleParamDescriptor( const std::string& name, ParamTypeEnum type, OfxPropertySetHandle props ) 00370 : ValueParamDescriptor( name, type, props ) 00371 {} 00372 00373 /** @brief set the type of the double param, defaults to eDoubleTypePlain */ 00374 void BaseDoubleParamDescriptor::setDoubleType( DoubleTypeEnum v ) 00375 { 00376 switch( v ) 00377 { 00378 case eDoubleTypePlain: 00379 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypePlain ); 00380 break; 00381 case eDoubleTypeAngle: 00382 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypeAngle ); 00383 break; 00384 case eDoubleTypeScale: 00385 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypeScale ); 00386 break; 00387 case eDoubleTypeTime: 00388 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypeTime ); 00389 break; 00390 case eDoubleTypeAbsoluteTime: 00391 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypeAbsoluteTime ); 00392 break; 00393 case eDoubleTypeNormalisedX: 00394 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypeNormalisedX ); 00395 break; 00396 case eDoubleTypeNormalisedY: 00397 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypeNormalisedY ); 00398 break; 00399 case eDoubleTypeNormalisedXAbsolute: 00400 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypeNormalisedXAbsolute ); 00401 break; 00402 case eDoubleTypeNormalisedYAbsolute: 00403 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypeNormalisedYAbsolute ); 00404 break; 00405 case eDoubleTypeNormalisedXY: 00406 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypeNormalisedXY ); 00407 break; 00408 case eDoubleTypeNormalisedXYAbsolute: 00409 getProps().propSetString( kOfxParamPropDoubleType, kOfxParamDoubleTypeNormalisedXYAbsolute ); 00410 break; 00411 } 00412 } 00413 00414 /** @brief set the sensitivity of any gui slider */ 00415 void BaseDoubleParamDescriptor::setIncrement( double v ) 00416 { 00417 getProps().propSetDouble( kOfxParamPropIncrement, v ); 00418 } 00419 00420 /** @brief set the number of digits printed after a decimal point in any gui */ 00421 void BaseDoubleParamDescriptor::setDigits( int v ) 00422 { 00423 getProps().propSetInt( kOfxParamPropDigits, v ); 00424 } 00425 00426 //////////////////////////////////////////////////////////////////////////////// 00427 // double param descriptor 00428 00429 /** @brief ctor */ 00430 DoubleParamDescriptor::DoubleParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00431 : BaseDoubleParamDescriptor( name, eDoubleParam, props ) 00432 {} 00433 00434 /** @brief set the default value, default is 0 */ 00435 void DoubleParamDescriptor::setDefault( double v ) 00436 { 00437 getProps().propSetDouble( kOfxParamPropDefault, v ); 00438 } 00439 00440 /** @brief set the hard min/max range, default is DOUBLE_MIN, DOUBLE_MAX */ 00441 void DoubleParamDescriptor::setRange( double min, double max ) 00442 { 00443 getProps().propSetDouble( kOfxParamPropMin, min ); 00444 getProps().propSetDouble( kOfxParamPropMax, max ); 00445 } 00446 00447 /** @brief set the display min and max, default is to be the same as the range param */ 00448 void DoubleParamDescriptor::setDisplayRange( double min, double max ) 00449 { 00450 getProps().propSetDouble( kOfxParamPropDisplayMin, min ); 00451 getProps().propSetDouble( kOfxParamPropDisplayMax, max ); 00452 } 00453 00454 //////////////////////////////////////////////////////////////////////////////// 00455 // 2D double param descriptor 00456 00457 /** @brief ctor */ 00458 Double2DParamDescriptor::Double2DParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00459 : BaseDoubleParamDescriptor( name, eDouble2DParam, props ) 00460 {} 00461 00462 /** @brief set the default value, default is 0 */ 00463 void Double2DParamDescriptor::setDefault( double x, double y ) 00464 { 00465 getProps().propSetDouble( kOfxParamPropDefault, x, 0 ); 00466 getProps().propSetDouble( kOfxParamPropDefault, y, 1 ); 00467 } 00468 00469 /** @brief set the hard min/max range, default is DOUBLE_MIN, DOUBLE_MAX */ 00470 void Double2DParamDescriptor::setRange( double xmin, double ymin, 00471 double xmax, double ymax ) 00472 { 00473 getProps().propSetDouble( kOfxParamPropMin, xmin, 0 ); 00474 getProps().propSetDouble( kOfxParamPropMin, ymin, 1 ); 00475 getProps().propSetDouble( kOfxParamPropMax, xmax, 0 ); 00476 getProps().propSetDouble( kOfxParamPropMax, ymax, 1 ); 00477 } 00478 00479 /** @brief set the display min and max, default is to be the same as the range param */ 00480 void Double2DParamDescriptor::setDisplayRange( double xmin, double ymin, 00481 double xmax, double ymax ) 00482 { 00483 getProps().propSetDouble( kOfxParamPropDisplayMin, xmin, 0 ); 00484 getProps().propSetDouble( kOfxParamPropDisplayMin, ymin, 1 ); 00485 getProps().propSetDouble( kOfxParamPropDisplayMax, xmax, 0 ); 00486 getProps().propSetDouble( kOfxParamPropDisplayMax, ymax, 1 ); 00487 } 00488 00489 void Double2DParamDescriptor::setDimensionLabels( const std::string& x, const std::string& y ) 00490 { 00491 getProps().propSetString( kOfxParamPropDimensionLabel, x, 0 ); 00492 getProps().propSetString( kOfxParamPropDimensionLabel, y, 1 ); 00493 } 00494 00495 //////////////////////////////////////////////////////////////////////////////// 00496 // 3D double param descriptor 00497 00498 /** @brief ctor */ 00499 Double3DParamDescriptor::Double3DParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00500 : BaseDoubleParamDescriptor( name, eDouble3DParam, props ) 00501 {} 00502 00503 /** @brief set the default value, default is 0 */ 00504 void Double3DParamDescriptor::setDefault( double x, double y, double z ) 00505 { 00506 getProps().propSetDouble( kOfxParamPropDefault, x, 0 ); 00507 getProps().propSetDouble( kOfxParamPropDefault, y, 1 ); 00508 getProps().propSetDouble( kOfxParamPropDefault, z, 2 ); 00509 } 00510 00511 /** @brief set the hard min/max range, default is DOUBLE_MIN, DOUBLE_MAX */ 00512 void Double3DParamDescriptor::setRange( double xmin, double ymin, double zmin, 00513 double xmax, double ymax, double zmax ) 00514 { 00515 getProps().propSetDouble( kOfxParamPropMin, xmin, 0 ); 00516 getProps().propSetDouble( kOfxParamPropMin, ymin, 1 ); 00517 getProps().propSetDouble( kOfxParamPropMin, zmin, 2 ); 00518 getProps().propSetDouble( kOfxParamPropMax, xmax, 0 ); 00519 getProps().propSetDouble( kOfxParamPropMax, ymax, 1 ); 00520 getProps().propSetDouble( kOfxParamPropMax, zmax, 2 ); 00521 } 00522 00523 /** @brief set the display min and max, default is to be the same as the range param */ 00524 void Double3DParamDescriptor::setDisplayRange( double xmin, double ymin, double zmin, 00525 double xmax, double ymax, double zmax ) 00526 { 00527 getProps().propSetDouble( kOfxParamPropDisplayMin, xmin, 0 ); 00528 getProps().propSetDouble( kOfxParamPropDisplayMin, ymin, 1 ); 00529 getProps().propSetDouble( kOfxParamPropDisplayMin, zmin, 2 ); 00530 getProps().propSetDouble( kOfxParamPropDisplayMax, xmax, 0 ); 00531 getProps().propSetDouble( kOfxParamPropDisplayMax, ymax, 1 ); 00532 getProps().propSetDouble( kOfxParamPropDisplayMax, zmax, 2 ); 00533 } 00534 00535 void Double3DParamDescriptor::setDimensionLabels( const std::string& x, const std::string& y, const std::string& z ) 00536 { 00537 getProps().propSetString( kOfxParamPropDimensionLabel, x, 0 ); 00538 getProps().propSetString( kOfxParamPropDimensionLabel, y, 1 ); 00539 getProps().propSetString( kOfxParamPropDimensionLabel, z, 2 ); 00540 } 00541 00542 //////////////////////////////////////////////////////////////////////////////// 00543 // RGB param descriptor 00544 00545 /** @brief hidden constructor */ 00546 RGBParamDescriptor::RGBParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00547 : ValueParamDescriptor( name, eRGBParam, props ) 00548 {} 00549 00550 /** @brief set the default value */ 00551 void RGBParamDescriptor::setDefault( double r, double g, double b ) 00552 { 00553 getProps().propSetDouble( kOfxParamPropDefault, r, 0 ); 00554 getProps().propSetDouble( kOfxParamPropDefault, g, 1 ); 00555 getProps().propSetDouble( kOfxParamPropDefault, b, 2 ); 00556 } 00557 00558 //////////////////////////////////////////////////////////////////////////////// 00559 // RGBA param descriptor 00560 00561 /** @brief hidden constructor */ 00562 RGBAParamDescriptor::RGBAParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00563 : ValueParamDescriptor( name, eRGBAParam, props ) 00564 {} 00565 00566 /** @brief set the default value */ 00567 void RGBAParamDescriptor::setDefault( double r, double g, double b, double a ) 00568 { 00569 getProps().propSetDouble( kOfxParamPropDefault, r, 0 ); 00570 getProps().propSetDouble( kOfxParamPropDefault, g, 1 ); 00571 getProps().propSetDouble( kOfxParamPropDefault, b, 2 ); 00572 getProps().propSetDouble( kOfxParamPropDefault, a, 3 ); 00573 } 00574 00575 //////////////////////////////////////////////////////////////////////////////// 00576 // bool param descriptor 00577 00578 /** @brief hidden constructor */ 00579 BooleanParamDescriptor::BooleanParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00580 : ValueParamDescriptor( name, eBooleanParam, props ) 00581 {} 00582 00583 /** @brief set the default value */ 00584 void BooleanParamDescriptor::setDefault( bool v ) 00585 { 00586 getProps().propSetInt( kOfxParamPropDefault, int(v) ); 00587 } 00588 00589 //////////////////////////////////////////////////////////////////////////////// 00590 // choice param descriptor 00591 00592 /** @brief hidden constructor */ 00593 ChoiceParamDescriptor::ChoiceParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00594 : ValueParamDescriptor( name, eChoiceParam, props ) 00595 {} 00596 00597 /** @brief set the default value */ 00598 void ChoiceParamDescriptor::setDefault( int v ) 00599 { 00600 getProps().propSetInt( kOfxParamPropDefault, v ); 00601 } 00602 00603 /** @brief how many options do we have */ 00604 int ChoiceParamDescriptor::getNOptions( void ) const 00605 { 00606 int nCurrentValues = getProps().propGetDimension( kOfxParamPropChoiceOption ); 00607 00608 return nCurrentValues; 00609 } 00610 00611 /** @brief set the default value */ 00612 void ChoiceParamDescriptor::appendOption( const std::string& shortName, const std::string& label ) 00613 { 00614 const int nCurrentValues = getProps().propGetDimension( kOfxParamPropChoiceOption ); 00615 00616 getProps().propSetString( kOfxParamPropChoiceOption, shortName, nCurrentValues ); 00617 getProps().propSetString( kOfxParamPropChoiceLabelOption, label, nCurrentValues, false ); // this option is optional extension, don't throw if not present. 00618 } 00619 00620 /** @brief set the default value */ 00621 void ChoiceParamDescriptor::resetOptions( void ) 00622 { 00623 getProps().propReset( kOfxParamPropChoiceOption ); 00624 } 00625 00626 //////////////////////////////////////////////////////////////////////////////// 00627 // string param descriptor 00628 00629 /** @brief hidden ctor */ 00630 StringParamDescriptor::StringParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00631 : ValueParamDescriptor( name, eStringParam, props ) 00632 {} 00633 00634 /** @brief set the default value, default is 0 */ 00635 void StringParamDescriptor::setDefault( const std::string& v ) 00636 { 00637 getProps().propSetString( kOfxParamPropDefault, v ); 00638 } 00639 00640 /** @brief sets the kind of the string param, defaults to eStringSingleLine */ 00641 void StringParamDescriptor::setStringType( StringTypeEnum v ) 00642 { 00643 switch( v ) 00644 { 00645 case eStringTypeSingleLine: 00646 getProps().propSetString( kOfxParamPropStringMode, kOfxParamStringIsSingleLine ); 00647 break; 00648 case eStringTypeMultiLine: 00649 getProps().propSetString( kOfxParamPropStringMode, kOfxParamStringIsMultiLine ); 00650 break; 00651 case eStringTypeFilePath: 00652 getProps().propSetString( kOfxParamPropStringMode, kOfxParamStringIsFilePath ); 00653 break; 00654 case eStringTypeDirectoryPath: 00655 getProps().propSetString( kOfxParamPropStringMode, kOfxParamStringIsDirectoryPath ); 00656 break; 00657 case eStringTypeLabel: 00658 getProps().propSetString( kOfxParamPropStringMode, kOfxParamStringIsLabel ); 00659 break; 00660 } 00661 } 00662 00663 /** @brief if the string param is a file path, say that we are picking an existing file, defaults to true */ 00664 void StringParamDescriptor::setFilePathExists( bool v ) 00665 { 00666 getProps().propSetInt( kOfxParamPropStringFilePathExists, int(v) ); 00667 } 00668 00669 //////////////////////////////////////////////////////////////////////////////// 00670 // custom param descriptor 00671 00672 /** @brief hidden ctor */ 00673 CustomParamDescriptor::CustomParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00674 : ValueParamDescriptor( name, eCustomParam, props ) 00675 {} 00676 00677 /** @brief set the default value, default is 0 */ 00678 void CustomParamDescriptor::setDefault( const std::string& v ) 00679 { 00680 getProps().propSetString( kOfxParamPropDefault, v ); 00681 } 00682 00683 //////////////////////////////////////////////////////////////////////////////// 00684 // group param descriptor 00685 00686 /** @brief hidden constructor */ 00687 GroupParamDescriptor::GroupParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00688 : ParamDescriptor( name, eGroupParam, props ) 00689 {} 00690 00691 void GroupParamDescriptor::setOpen( const bool open ) 00692 { 00693 getProps().propSetInt( kOfxParamPropGroupOpen, open ); 00694 } 00695 00696 void GroupParamDescriptor::setAsTab() 00697 { 00698 // only anable on supported Nuke 00699 if( OFX::getImageEffectHostDescription()->hostName == "uk.co.thefoundry.nuke" ) 00700 { 00701 getProps().propSetInt( kFnOfxParamPropGroupIsTab, 1 ); 00702 } 00703 } 00704 00705 //////////////////////////////////////////////////////////////////////////////// 00706 // page param descriptor 00707 00708 /** @brief hidden constructor */ 00709 PageParamDescriptor::PageParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00710 : ParamDescriptor( name, ePageParam, props ) 00711 {} 00712 00713 /** @brief adds a child parameter. Note the two existing pseudo params, gColumnSkip and gRowSkip */ 00714 void PageParamDescriptor::addChild( const ParamDescriptor& p ) 00715 { 00716 int nKids = getProps().propGetDimension( kOfxParamPropPageChild ); 00717 00718 getProps().propSetString( kOfxParamPropPageChild, p.getName(), nKids ); 00719 } 00720 00721 //////////////////////////////////////////////////////////////////////////////// 00722 // pushbutton param descriptor 00723 00724 /** @brief hidden constructor */ 00725 PushButtonParamDescriptor::PushButtonParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00726 : ParamDescriptor( name, ePushButtonParam, props ) 00727 {} 00728 00729 //////////////////////////////////////////////////////////////////////////////// 00730 // parametric param descriptor 00731 00732 /** @brief hidden constructor */ 00733 ParametricParamDescriptor::ParametricParamDescriptor( const std::string& name, OfxPropertySetHandle props ) 00734 : ParamDescriptor( name, eParametricParam, props ) 00735 { 00736 } 00737 00738 void ParametricParamDescriptor::setParamSet( ParamSetDescriptor& paramSet ) 00739 { 00740 _paramSet = ¶mSet; 00741 OFX::Private::gParamSuite->paramGetHandle( _paramSet->getOfxParamSetHandle(), getName().c_str(), &_ofxParamHandle, NULL ); 00742 } 00743 00744 void ParametricParamDescriptor::setRange( const double min, const double max ) 00745 { 00746 getProps().propSetDouble( kOfxParamPropParametricRange, min, 0 ); 00747 getProps().propSetDouble( kOfxParamPropParametricRange, max, 1 ); 00748 } 00749 00750 void ParametricParamDescriptor::setDimension( const int dimension ) 00751 { 00752 getProps().propSetInt( kOfxParamPropParametricDimension, dimension ); 00753 } 00754 00755 void ParametricParamDescriptor::setLabel( const std::string& label ) 00756 { 00757 getProps().propSetString( kOfxPropLabel, label ); 00758 } 00759 00760 void ParametricParamDescriptor::setDimensionLabel( const std::string& label, const int id ) 00761 { 00762 getProps().propSetString( kOfxParamPropDimensionLabel, label, id ); 00763 } 00764 00765 void ParametricParamDescriptor::setUIColour( const int id, const OfxRGBColourD& color ) 00766 { 00767 getProps().propSetDouble( kOfxParamPropParametricUIColour, color.r, id*3 + 0 ); 00768 getProps().propSetDouble( kOfxParamPropParametricUIColour, color.g, id*3 + 1 ); 00769 getProps().propSetDouble( kOfxParamPropParametricUIColour, color.b, id*3 + 2 ); 00770 } 00771 00772 void ParametricParamDescriptor::addControlPoint( const int id, const OfxTime time, const double x, const double y, const bool addKey ) 00773 { 00774 OFX::Private::gParametricParameterSuite->parametricParamAddControlPoint( 00775 _ofxParamHandle, 00776 id, 00777 time, 00778 x, 00779 y, 00780 addKey ); 00781 } 00782 00783 void ParametricParamDescriptor::setIdentity( const int id ) 00784 { 00785 addControlPoint( id, 0, 0, 0, false ); 00786 addControlPoint( id, 0, 1, 1, false ); 00787 } 00788 00789 void ParametricParamDescriptor::setIdentity() 00790 { 00791 const int nbCurves = getProps().propGetInt( kOfxParamPropParametricDimension ); 00792 for( int i = 0; i < nbCurves; ++i ) 00793 { 00794 setIdentity( i ); 00795 } 00796 } 00797 00798 void ParametricParamDescriptor::setInteractDescriptor( ParamInteractWrap* desc ) 00799 { 00800 _interact.reset( desc ); 00801 getProps().propSetPointer( kOfxParamPropParametricInteractBackground, (void*)desc->getMainEntry() ); 00802 desc->getDescriptor().setParamName( getName() ); 00803 } 00804 00805 //////////////////////////////////////////////////////////////////////////////// 00806 // Descriptor for a set of parameters 00807 /** @brief hidden ctor */ 00808 ParamSetDescriptor::ParamSetDescriptor( void ) 00809 : _paramSetHandle( 0 ) 00810 {} 00811 00812 ParamDescriptor* ParamSetDescriptor::getParamDescriptor( const std::string& name ) const 00813 { 00814 std::map<std::string, ParamDescriptor*>::const_iterator it = _definedParams.find( name ); 00815 if( it != _definedParams.end() ) 00816 return it->second; 00817 return 0; 00818 } 00819 00820 /** @brief set the param set handle */ 00821 void ParamSetDescriptor::setOfxParamSetHandle( OfxParamSetHandle h ) 00822 { 00823 // set me handle 00824 _paramSetHandle = h; 00825 00826 if( h ) 00827 { 00828 // fetch me props 00829 OfxPropertySetHandle props; 00830 OfxStatus stat = OFX::Private::gParamSuite->paramSetGetPropertySet( h, &props ); 00831 _paramSetProps.propSetHandle( props ); 00832 throwSuiteStatusException( stat ); 00833 } 00834 else 00835 { 00836 _paramSetProps.propSetHandle( 0 ); 00837 } 00838 } 00839 00840 /** @brief dtor */ 00841 ParamSetDescriptor::~ParamSetDescriptor() 00842 { 00843 // delete any descriptor we may have constructed 00844 std::map<std::string, ParamDescriptor*>::iterator iter; 00845 for( iter = _definedParams.begin(); iter != _definedParams.end(); ++iter ) 00846 { 00847 if( iter->second ) 00848 { 00849 delete iter->second; 00850 iter->second = NULL; 00851 } 00852 } 00853 } 00854 00855 /** @brief estabilishes the order of page params. Do it by calling it in turn for each page */ 00856 void ParamSetDescriptor::setPageParamOrder( PageParamDescriptor& p ) 00857 { 00858 int nPages = _paramSetProps.propGetDimension( kOfxPluginPropParamPageOrder ); 00859 00860 _paramSetProps.propSetString( kOfxPluginPropParamPageOrder, p.getName().c_str(), nPages ); 00861 } 00862 00863 /** @brief calls the raw OFX routine to define a param */ 00864 void ParamSetDescriptor::defineRawParam( const std::string& name, ParamTypeEnum paramType, OfxPropertySetHandle& props ) 00865 { 00866 OfxStatus stat = OFX::Private::gParamSuite->paramDefine( _paramSetHandle, mapParamTypeEnumToString( paramType ), name.c_str(), &props ); 00867 00868 throwSuiteStatusException( stat ); 00869 } 00870 00871 /** @brief if a param has been defined in this set, go find it */ 00872 ParamDescriptor* ParamSetDescriptor::findPreviouslyDefinedParam( const std::string& name ) 00873 { 00874 // search 00875 std::map<std::string, ParamDescriptor*>::const_iterator search; 00876 search = _definedParams.find( name ); 00877 if( search == _definedParams.end() ) 00878 return NULL; 00879 return search->second; 00880 } 00881 00882 /** @brief Define an integer param, only callable from describe in context */ 00883 IntParamDescriptor* ParamSetDescriptor::defineIntParam( const std::string& name ) 00884 { 00885 IntParamDescriptor* param = NULL; 00886 00887 defineParamDescriptor( name, eIntParam, param ); 00888 return param; 00889 } 00890 00891 /** @brief Define a 2D integer param */ 00892 Int2DParamDescriptor* ParamSetDescriptor::defineInt2DParam( const std::string& name ) 00893 { 00894 Int2DParamDescriptor* param = NULL; 00895 00896 defineParamDescriptor( name, eInt2DParam, param ); 00897 return param; 00898 } 00899 00900 /** @brief Define a 3D integer param */ 00901 Int3DParamDescriptor* ParamSetDescriptor::defineInt3DParam( const std::string& name ) 00902 { 00903 Int3DParamDescriptor* param = NULL; 00904 00905 defineParamDescriptor( name, eInt3DParam, param ); 00906 return param; 00907 } 00908 00909 /** @brief Define an double param, only callable from describe in context */ 00910 DoubleParamDescriptor* ParamSetDescriptor::defineDoubleParam( const std::string& name ) 00911 { 00912 DoubleParamDescriptor* param = NULL; 00913 00914 defineParamDescriptor( name, eDoubleParam, param ); 00915 return param; 00916 } 00917 00918 /** @brief Define a 2D double param */ 00919 Double2DParamDescriptor* ParamSetDescriptor::defineDouble2DParam( const std::string& name ) 00920 { 00921 Double2DParamDescriptor* param = NULL; 00922 00923 defineParamDescriptor( name, eDouble2DParam, param ); 00924 return param; 00925 } 00926 00927 /** @brief Define a 3D double param */ 00928 Double3DParamDescriptor* ParamSetDescriptor::defineDouble3DParam( const std::string& name ) 00929 { 00930 Double3DParamDescriptor* param = NULL; 00931 00932 defineParamDescriptor( name, eDouble3DParam, param ); 00933 return param; 00934 } 00935 00936 /** @brief Define a string param */ 00937 StringParamDescriptor* ParamSetDescriptor::defineStringParam( const std::string& name ) 00938 { 00939 StringParamDescriptor* param = NULL; 00940 00941 defineParamDescriptor( name, eStringParam, param ); 00942 return param; 00943 } 00944 00945 /** @brief Define a RGBA param */ 00946 RGBAParamDescriptor* ParamSetDescriptor::defineRGBAParam( const std::string& name ) 00947 { 00948 RGBAParamDescriptor* param = NULL; 00949 00950 defineParamDescriptor( name, eRGBAParam, param ); 00951 return param; 00952 } 00953 00954 /** @brief Define an RGB param */ 00955 RGBParamDescriptor* ParamSetDescriptor::defineRGBParam( const std::string& name ) 00956 { 00957 RGBParamDescriptor* param = NULL; 00958 00959 defineParamDescriptor( name, eRGBParam, param ); 00960 return param; 00961 } 00962 00963 /** @brief Define a Boolean param */ 00964 BooleanParamDescriptor* ParamSetDescriptor::defineBooleanParam( const std::string& name ) 00965 { 00966 BooleanParamDescriptor* param = NULL; 00967 00968 defineParamDescriptor( name, eBooleanParam, param ); 00969 return param; 00970 } 00971 00972 /** @brief Define a Choice param */ 00973 ChoiceParamDescriptor* ParamSetDescriptor::defineChoiceParam( const std::string& name ) 00974 { 00975 ChoiceParamDescriptor* param = NULL; 00976 00977 defineParamDescriptor( name, eChoiceParam, param ); 00978 return param; 00979 } 00980 00981 /** @brief Define a group param */ 00982 GroupParamDescriptor* ParamSetDescriptor::defineGroupParam( const std::string& name ) 00983 { 00984 GroupParamDescriptor* param = NULL; 00985 00986 defineParamDescriptor( name, eGroupParam, param ); 00987 return param; 00988 } 00989 00990 /** @brief Define a Page param */ 00991 PageParamDescriptor* ParamSetDescriptor::definePageParam( const std::string& name ) 00992 { 00993 PageParamDescriptor* param = NULL; 00994 00995 defineParamDescriptor( name, ePageParam, param ); 00996 return param; 00997 } 00998 00999 /** @brief Define a push button param */ 01000 PushButtonParamDescriptor* ParamSetDescriptor::definePushButtonParam( const std::string& name ) 01001 { 01002 PushButtonParamDescriptor* param = NULL; 01003 01004 defineParamDescriptor( name, ePushButtonParam, param ); 01005 return param; 01006 } 01007 01008 /** @brief Define a parametric param */ 01009 ParametricParamDescriptor* ParamSetDescriptor::defineParametricParam( const std::string& name ) 01010 { 01011 ParametricParamDescriptor* param = NULL; 01012 01013 defineParamDescriptor( name, eParametricParam, param ); 01014 01015 // Parametric parameters need the ParamSet ! 01016 param->setParamSet( *this ); ///< @todo tuttle: more generic way for all param types ? 01017 01018 return param; 01019 } 01020 01021 /** @brief Define a custom param */ 01022 CustomParamDescriptor* ParamSetDescriptor::defineCustomParam( const std::string& name ) 01023 { 01024 CustomParamDescriptor* param = NULL; 01025 01026 defineParamDescriptor( name, eCustomParam, param ); 01027 return param; 01028 } 01029 01030 //////////////////////////////////////////////////////////////////////////////// 01031 /** @brief Base class for all param instances */ 01032 Param::Param( const ParamSet* paramSet, const std::string& name, ParamTypeEnum type, OfxParamHandle handle ) 01033 : Attribute( name ), 01034 _paramType( type ), 01035 _paramHandle( handle ), 01036 _paramSet( paramSet ) 01037 { 01038 // fetch our property handle 01039 OfxPropertySetHandle propHandle; 01040 OfxStatus stat = OFX::Private::gParamSuite->paramGetPropertySet( handle, &propHandle ); 01041 01042 throwSuiteStatusException( stat ); 01043 getProps().propSetHandle( propHandle ); 01044 01045 // and validate the properties 01046 OFX::Validation::validateParameterProperties( type, getProps(), false ); 01047 } 01048 01049 /** @brief dtor */ 01050 Param::~Param() 01051 {} 01052 01053 /** @brief, set the label properties in a plugin */ 01054 void Param::setLabels( const std::string& label, const std::string& shortLabel, const std::string& longLabel ) 01055 { 01056 getProps().propSetString( kOfxPropLabel, label ); 01057 getProps().propSetString( kOfxPropShortLabel, shortLabel, false ); 01058 getProps().propSetString( kOfxPropLongLabel, longLabel, false ); 01059 } 01060 01061 /** @brief set the secretness of the param, defaults to false */ 01062 void Param::setIsSecret( bool v ) 01063 { 01064 getProps().propSetInt( kOfxParamPropSecret, v ); 01065 } 01066 01067 /** @brief set the param hint */ 01068 void Param::setHint( const std::string& v ) 01069 { 01070 getProps().propSetString( kOfxParamPropHint, v, false ); 01071 } 01072 01073 /** @brief whether the param is enabled */ 01074 void Param::setEnabled( bool v ) 01075 { 01076 getProps().propSetInt( kOfxParamPropEnabled, v ); 01077 } 01078 01079 /** @brief fetch the labels */ 01080 void Param::getLabels( std::string& label, std::string& shortLabel, std::string& longLabel ) const 01081 { 01082 label = getProps().propGetString( kOfxPropLabel ); 01083 shortLabel = getProps().propGetString( kOfxPropShortLabel, false ); 01084 longLabel = getProps().propGetString( kOfxPropLongLabel, false ); 01085 } 01086 01087 /** @brief get whether the param is secret */ 01088 bool Param::getIsSecret( void ) const 01089 { 01090 bool v = getProps().propGetInt( kOfxParamPropSecret ) != 0; 01091 01092 return v; 01093 } 01094 01095 /** @brief whether the param is enabled */ 01096 bool Param::getIsEnable( void ) const 01097 { 01098 bool v = getProps().propGetInt( kOfxParamPropEnabled ) != 0; 01099 01100 return v; 01101 } 01102 01103 /** @brief get the param hint */ 01104 std::string Param::getHint( void ) const 01105 { 01106 std::string v = getProps().propGetString( kOfxParamPropHint, false ); 01107 01108 return v; 01109 } 01110 01111 /** @brief get the script name */ 01112 std::string Param::getScriptName( void ) const 01113 { 01114 std::string v = getProps().propGetString( kOfxParamPropScriptName, false ); 01115 01116 return v; 01117 } 01118 01119 /** @brief get the group param that is the parent of this one */ 01120 const GroupParam* Param::getParent( void ) const 01121 { 01122 std::string v = getProps().propGetString( kOfxParamPropParent ); 01123 01124 if( v == "" ) 01125 return NULL; 01126 return _paramSet->fetchGroupParam( v ); 01127 } 01128 01129 //////////////////////////////////////////////////////////////////////////////// 01130 /** @brief Wraps up a value holding param */ 01131 01132 /** @brief hidden constructor */ 01133 ValueParam::ValueParam( const ParamSet* paramSet, const std::string& name, ParamTypeEnum type, OfxParamHandle handle ) 01134 : Param( paramSet, name, type, handle ) 01135 {} 01136 01137 /** @brief dtor */ 01138 ValueParam::~ValueParam() 01139 {} 01140 01141 /** @brief Set's whether the value of the param is significant (ie: affects the rendered image) */ 01142 void ValueParam::setEvaluateOnChange( bool v ) 01143 { 01144 getProps().propSetInt( kOfxParamPropEvaluateOnChange, v ); 01145 } 01146 01147 /** @brief is the param animating */ 01148 bool ValueParam::getIsAnimating( void ) const 01149 { 01150 return getProps().propGetInt( kOfxParamPropIsAnimating ) != 0; 01151 } 01152 01153 /** @brief is the param animating */ 01154 bool ValueParam::getIsAutoKeying( void ) const 01155 { 01156 return getProps().propGetInt( kOfxParamPropIsAutoKeying ) != 0; 01157 } 01158 01159 /** @brief is the param animating */ 01160 bool ValueParam::getIsPersistant( void ) const 01161 { 01162 return getProps().propGetInt( kOfxParamPropPersistant ) != 0; 01163 } 01164 01165 /** @brief Get's whether the value of the param is significant (ie: affects the rendered image) */ 01166 bool ValueParam::getEvaluateOnChange( void ) const 01167 { 01168 return getProps().propGetInt( kOfxParamPropEvaluateOnChange ) != 0; 01169 } 01170 01171 /** @brief Get's whether the value of the param is significant (ie: affects the rendered image) */ 01172 CacheInvalidationEnum ValueParam::getCacheInvalidation( void ) const 01173 { 01174 std::string v = getProps().propGetString( kOfxParamPropCacheInvalidation ); 01175 01176 if( v == kOfxParamInvalidateValueChange ) 01177 return eCacheInvalidateValueChange; 01178 else if( v == kOfxParamInvalidateValueChangeToEnd ) 01179 return eCacheInvalidateValueChangeToEnd; 01180 else // if(v == kOfxParamInvalidateAll) 01181 return eCacheInvalidateValueAll; 01182 } 01183 01184 /** @brief if the param is animating, the number of keys in it, otherwise 0 */ 01185 unsigned int ValueParam::getNumKeys( void ) const 01186 { 01187 if( !OFX::Private::gParamSuite->paramGetNumKeys ) 01188 throwHostMissingSuiteException( "paramGetNumKeys" ); 01189 unsigned int v = 0; 01190 OfxStatus stat = OFX::Private::gParamSuite->paramGetNumKeys( _paramHandle, &v ); 01191 throwSuiteStatusException( stat ); 01192 return v; 01193 } 01194 01195 /** @brief get the time of the nth key, nth must be between 0 and getNumKeys-1 */ 01196 double ValueParam::getKeyTime( int nthKey ) const 01197 { 01198 if( !OFX::Private::gParamSuite->paramGetKeyTime ) 01199 throwHostMissingSuiteException( "paramGetKeyTime" ); 01200 double v = 0; 01201 OfxStatus stat = OFX::Private::gParamSuite->paramGetKeyTime( _paramHandle, nthKey, &v ); 01202 01203 // oops? 01204 if( stat == kOfxStatFailed ) 01205 BOOST_THROW_EXCEPTION( std::out_of_range( "ValueParam::getKeyTime key index out of range" ) ); 01206 throwSuiteStatusException( stat ); 01207 return v; 01208 } 01209 01210 /** @brief find the index of a key by a time */ 01211 int ValueParam::getKeyIndex( double time, 01212 KeySearchEnum searchDir ) const 01213 { 01214 if( !OFX::Private::gParamSuite->paramGetKeyIndex ) 01215 throwHostMissingSuiteException( "paramGetKeyIndex" ); 01216 int v = 0; 01217 01218 // turn enum into -1,0,1 01219 int dir = searchDir == eKeySearchBackwards ? -1 : ( searchDir == eKeySearchNear ? 0 : 1 ); 01220 01221 // call raw param function 01222 OfxStatus stat = OFX::Private::gParamSuite->paramGetKeyIndex( _paramHandle, time, dir, &v ); 01223 01224 // oops? 01225 if( stat == kOfxStatFailed ) 01226 return -1; // if search failed, return -1 01227 throwSuiteStatusException( stat ); 01228 return v; 01229 } 01230 01231 /** @brief deletes a key at the given time */ 01232 void ValueParam::deleteKeyAtTime( double time ) 01233 { 01234 if( !OFX::Private::gParamSuite->paramDeleteKey ) 01235 throwHostMissingSuiteException( "paramDeleteKey" ); 01236 OfxStatus stat = OFX::Private::gParamSuite->paramDeleteKey( _paramHandle, time ); 01237 if( stat == kOfxStatFailed ) 01238 return; // if no key at time, fail quietly 01239 throwSuiteStatusException( stat ); 01240 } 01241 01242 /** @brief delete all the keys */ 01243 void ValueParam::deleteAllKeys( void ) 01244 { 01245 if( !OFX::Private::gParamSuite->paramDeleteAllKeys ) 01246 throwHostMissingSuiteException( "paramDeleteAllKeys" ); 01247 OfxStatus stat = OFX::Private::gParamSuite->paramDeleteAllKeys( _paramHandle ); 01248 throwSuiteStatusException( stat ); 01249 } 01250 01251 //////////////////////////////////////////////////////////////////////////////// 01252 // Wraps up an integer param */ 01253 01254 /** @brief hidden constructor */ 01255 IntParam::IntParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 01256 : ValueParam( paramSet, name, eIntParam, handle ) 01257 {} 01258 01259 /** @brief set the default value */ 01260 void IntParam::setDefault( int v ) 01261 { 01262 getProps().propSetInt( kOfxParamPropDefault, v ); 01263 } 01264 01265 /** @brief set the hard min/max range, default is INT_MIN, INT_MAX */ 01266 void IntParam::setRange( int min, int max ) 01267 { 01268 getProps().propSetInt( kOfxParamPropMin, min ); 01269 getProps().propSetInt( kOfxParamPropMax, max ); 01270 } 01271 01272 /** @brief set the display min and max, default is to be the same as the range param */ 01273 void IntParam::setDisplayRange( int min, int max ) 01274 { 01275 getProps().propSetInt( kOfxParamPropDisplayMin, min ); 01276 getProps().propSetInt( kOfxParamPropDisplayMax, max ); 01277 } 01278 01279 /** @brief het the default value */ 01280 void IntParam::getDefault( int& v ) const 01281 { 01282 v = getProps().propGetInt( kOfxParamPropDefault ); 01283 } 01284 01285 /** @brief set the hard min/max range, default is INT_MIN, INT_MAX */ 01286 void IntParam::getRange( int& min, int& max ) const 01287 { 01288 min = getProps().propGetInt( kOfxParamPropMin ); 01289 max = getProps().propGetInt( kOfxParamPropMax ); 01290 } 01291 01292 /** @brief set the display min and max, default is to be the same as the range param */ 01293 void IntParam::getDisplayRange( int& min, int& max ) const 01294 { 01295 min = getProps().propGetInt( kOfxParamPropDisplayMin ); 01296 max = getProps().propGetInt( kOfxParamPropDisplayMax ); 01297 } 01298 01299 /** @brief get value */ 01300 void IntParam::getValue( int& v ) const 01301 { 01302 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &v ); 01303 01304 throwSuiteStatusException( stat ); 01305 } 01306 01307 /** @brief get the value at a time */ 01308 void IntParam::getValueAtTime( double t, int& v ) const 01309 { 01310 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &v ); 01311 01312 throwSuiteStatusException( stat ); 01313 } 01314 01315 /** @brief set value */ 01316 void IntParam::setValue( int v ) 01317 { 01318 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, v ); 01319 01320 throwSuiteStatusException( stat ); 01321 } 01322 01323 /** @brief set the value at a time, implicitly adds a keyframe */ 01324 void IntParam::setValueAtTime( double t, int v ) 01325 { 01326 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 01327 throwHostMissingSuiteException( "paramSetValueAtTime" ); 01328 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, v ); 01329 throwSuiteStatusException( stat ); 01330 } 01331 01332 //////////////////////////////////////////////////////////////////////////////// 01333 // 2D Int params 01334 01335 /** @brief hidden constructor */ 01336 Int2DParam::Int2DParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 01337 : ValueParam( paramSet, name, eInt2DParam, handle ) 01338 {} 01339 01340 /** @brief set the default value */ 01341 void Int2DParam::setDefault( int x, int y ) 01342 { 01343 getProps().propSetInt( kOfxParamPropDefault, x, 0 ); 01344 getProps().propSetInt( kOfxParamPropDefault, y, 1 ); 01345 } 01346 01347 /** @brief set the hard min/max range, default is INT_MIN, INT_MAX */ 01348 void Int2DParam::setRange( int xmin, int ymin, 01349 int xmax, int ymax ) 01350 { 01351 getProps().propSetInt( kOfxParamPropMin, xmin, 0 ); 01352 getProps().propSetInt( kOfxParamPropMin, ymin, 1 ); 01353 getProps().propSetInt( kOfxParamPropMax, xmax, 0 ); 01354 getProps().propSetInt( kOfxParamPropMax, ymax, 1 ); 01355 } 01356 01357 /** @brief set the display min and max, default is to be the same as the range param */ 01358 void Int2DParam::setDisplayRange( int xmin, int ymin, 01359 int xmax, int ymax ) 01360 { 01361 getProps().propSetInt( kOfxParamPropDisplayMin, xmin, 0 ); 01362 getProps().propSetInt( kOfxParamPropDisplayMin, ymin, 1 ); 01363 getProps().propSetInt( kOfxParamPropDisplayMax, xmax, 0 ); 01364 getProps().propSetInt( kOfxParamPropDisplayMax, ymax, 1 ); 01365 } 01366 01367 /** @brief het the default value */ 01368 void Int2DParam::getDefault( int& x, int& y ) const 01369 { 01370 x = getProps().propGetInt( kOfxParamPropDefault, 0 ); 01371 y = getProps().propGetInt( kOfxParamPropDefault, 1 ); 01372 } 01373 01374 /** @brief set the hard min/max range, default is INT_MIN, INT_MAX */ 01375 void Int2DParam::getRange( int& xmin, int& ymin, 01376 int& xmax, int& ymax ) const 01377 { 01378 xmin = getProps().propGetInt( kOfxParamPropMin, 0 ); 01379 ymin = getProps().propGetInt( kOfxParamPropMin, 1 ); 01380 xmax = getProps().propGetInt( kOfxParamPropMax, 0 ); 01381 ymax = getProps().propGetInt( kOfxParamPropMax, 1 ); 01382 } 01383 01384 /** @brief set the display min and max, default is to be the same as the range param */ 01385 void Int2DParam::getDisplayRange( int& xmin, int& ymin, 01386 int& xmax, int& ymax ) const 01387 { 01388 xmin = getProps().propGetInt( kOfxParamPropDisplayMin, 0 ); 01389 ymin = getProps().propGetInt( kOfxParamPropDisplayMin, 1 ); 01390 xmax = getProps().propGetInt( kOfxParamPropDisplayMax, 0 ); 01391 ymax = getProps().propGetInt( kOfxParamPropDisplayMax, 1 ); 01392 } 01393 01394 /** @brief get value */ 01395 void Int2DParam::getValue( int& x, int& y ) const 01396 { 01397 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &x, &y ); 01398 01399 throwSuiteStatusException( stat ); 01400 } 01401 01402 /** @brief get the value at a time */ 01403 void Int2DParam::getValueAtTime( double t, int& x, int& y ) const 01404 { 01405 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &x, &y ); 01406 01407 throwSuiteStatusException( stat ); 01408 } 01409 01410 /** @brief set value */ 01411 void Int2DParam::setValue( int x, int y ) 01412 { 01413 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, x, y ); 01414 01415 throwSuiteStatusException( stat ); 01416 } 01417 01418 /** @brief set the value at a time, implicitly adds a keyframe */ 01419 void Int2DParam::setValueAtTime( double t, int x, int y ) 01420 { 01421 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 01422 throwHostMissingSuiteException( "paramSetValueAtTime" ); 01423 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, x, y ); 01424 throwSuiteStatusException( stat ); 01425 } 01426 01427 //////////////////////////////////////////////////////////////////////////////// 01428 // 3D Int params 01429 01430 /** @brief hidden constructor */ 01431 Int3DParam::Int3DParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 01432 : ValueParam( paramSet, name, eInt3DParam, handle ) 01433 {} 01434 01435 /** @brief set the default value */ 01436 void Int3DParam::setDefault( int x, int y, int z ) 01437 { 01438 getProps().propSetInt( kOfxParamPropDefault, x, 0 ); 01439 getProps().propSetInt( kOfxParamPropDefault, y, 1 ); 01440 getProps().propSetInt( kOfxParamPropDefault, z, 2 ); 01441 } 01442 01443 /** @brief set the hard min/max range, default is INT_MIN, INT_MAX */ 01444 void Int3DParam::setRange( int xmin, int ymin, int zmin, 01445 int xmax, int ymax, int zmax ) 01446 { 01447 getProps().propSetInt( kOfxParamPropMin, xmin, 0 ); 01448 getProps().propSetInt( kOfxParamPropMin, ymin, 1 ); 01449 getProps().propSetInt( kOfxParamPropMin, zmin, 2 ); 01450 getProps().propSetInt( kOfxParamPropMax, xmax, 0 ); 01451 getProps().propSetInt( kOfxParamPropMax, ymax, 1 ); 01452 getProps().propSetInt( kOfxParamPropMin, zmax, 2 ); 01453 } 01454 01455 /** @brief set the display min and max, default is to be the same as the range param */ 01456 void Int3DParam::setDisplayRange( int xmin, int ymin, int zmin, 01457 int xmax, int ymax, int zmax ) 01458 { 01459 getProps().propSetInt( kOfxParamPropDisplayMin, xmin, 0 ); 01460 getProps().propSetInt( kOfxParamPropDisplayMin, ymin, 1 ); 01461 getProps().propSetInt( kOfxParamPropDisplayMin, zmin, 2 ); 01462 getProps().propSetInt( kOfxParamPropDisplayMax, xmax, 0 ); 01463 getProps().propSetInt( kOfxParamPropDisplayMax, ymax, 1 ); 01464 getProps().propSetInt( kOfxParamPropDisplayMax, zmax, 2 ); 01465 } 01466 01467 /** @brief het the default value */ 01468 void Int3DParam::getDefault( int& x, int& y, int& z ) const 01469 { 01470 x = getProps().propGetInt( kOfxParamPropDefault, 0 ); 01471 y = getProps().propGetInt( kOfxParamPropDefault, 1 ); 01472 z = getProps().propGetInt( kOfxParamPropDefault, 2 ); 01473 } 01474 01475 /** @brief set the hard min/max range, default is INT_MIN, INT_MAX */ 01476 void Int3DParam::getRange( int& xmin, int& ymin, int& zmin, 01477 int& xmax, int& ymax, int& zmax ) const 01478 { 01479 xmin = getProps().propGetInt( kOfxParamPropMin, 0 ); 01480 ymin = getProps().propGetInt( kOfxParamPropMin, 1 ); 01481 zmin = getProps().propGetInt( kOfxParamPropMin, 2 ); 01482 xmax = getProps().propGetInt( kOfxParamPropMax, 0 ); 01483 ymax = getProps().propGetInt( kOfxParamPropMax, 1 ); 01484 zmax = getProps().propGetInt( kOfxParamPropMax, 2 ); 01485 } 01486 01487 /** @brief set the display min and max, default is to be the same as the range param */ 01488 void Int3DParam::getDisplayRange( int& xmin, int& ymin, int& zmin, 01489 int& xmax, int& ymax, int& zmax ) const 01490 { 01491 xmin = getProps().propGetInt( kOfxParamPropDisplayMin, 0 ); 01492 ymin = getProps().propGetInt( kOfxParamPropDisplayMin, 1 ); 01493 zmin = getProps().propGetInt( kOfxParamPropDisplayMin, 2 ); 01494 xmax = getProps().propGetInt( kOfxParamPropDisplayMax, 0 ); 01495 ymax = getProps().propGetInt( kOfxParamPropDisplayMax, 1 ); 01496 zmax = getProps().propGetInt( kOfxParamPropDisplayMax, 2 ); 01497 } 01498 01499 /** @brief get value */ 01500 void Int3DParam::getValue( int& x, int& y, int& z ) const 01501 { 01502 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &x, &y, &z ); 01503 01504 throwSuiteStatusException( stat ); 01505 } 01506 01507 /** @brief get the value at a time */ 01508 void Int3DParam::getValueAtTime( double t, int& x, int& y, int& z ) const 01509 { 01510 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &x, &y, &z ); 01511 01512 throwSuiteStatusException( stat ); 01513 } 01514 01515 /** @brief set value */ 01516 void Int3DParam::setValue( int x, int y, int z ) 01517 { 01518 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, x, y, z ); 01519 01520 throwSuiteStatusException( stat ); 01521 } 01522 01523 /** @brief set the value at a time, implicitly adds a keyframe */ 01524 void Int3DParam::setValueAtTime( double t, int x, int y, int z ) 01525 { 01526 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 01527 throwHostMissingSuiteException( "paramSetValueAtTime" ); 01528 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, x, y, z ); 01529 throwSuiteStatusException( stat ); 01530 } 01531 01532 //////////////////////////////////////////////////////////////////////////////// 01533 // common base to all double params 01534 01535 /** @brief hidden constructor */ 01536 BaseDoubleParam::BaseDoubleParam( const ParamSet* paramSet, const std::string& name, ParamTypeEnum type, OfxParamHandle handle ) 01537 : ValueParam( paramSet, name, type, handle ) 01538 {} 01539 01540 BaseDoubleParam::~BaseDoubleParam() 01541 {} 01542 01543 /** @brief set the sensitivity of any gui slider */ 01544 void BaseDoubleParam::setIncrement( double v ) 01545 { 01546 getProps().propSetDouble( kOfxParamPropIncrement, v ); 01547 } 01548 01549 /** @brief set the number of digits printed after a decimal point in any gui */ 01550 void BaseDoubleParam::setDigits( int v ) 01551 { 01552 getProps().propSetInt( kOfxParamPropDigits, v ); 01553 } 01554 01555 /** @brief set the sensitivity of any gui slider */ 01556 void BaseDoubleParam::getIncrement( double& v ) const 01557 { 01558 v = getProps().propGetDouble( kOfxParamPropIncrement ); 01559 } 01560 01561 /** @brief set the number of digits printed after a decimal point in any gui */ 01562 void BaseDoubleParam::getDigits( int& v ) const 01563 { 01564 v = getProps().propGetInt( kOfxParamPropDigits ); 01565 } 01566 01567 /** @brief set the number of digits printed after a decimal point in any gui */ 01568 void BaseDoubleParam::getDoubleType( DoubleTypeEnum& v ) const 01569 { 01570 std::string str = getProps().propGetString( kOfxParamPropDoubleType ); 01571 01572 if( str == kOfxParamDoubleTypePlain ) 01573 v = eDoubleTypePlain; 01574 else if( str == kOfxParamDoubleTypeAngle ) 01575 v = eDoubleTypeAngle; 01576 else if( str == kOfxParamDoubleTypeScale ) 01577 v = eDoubleTypeScale; 01578 else if( str == kOfxParamDoubleTypeTime ) 01579 v = eDoubleTypeTime; 01580 else if( str == kOfxParamDoubleTypeAbsoluteTime ) 01581 v = eDoubleTypeAbsoluteTime; 01582 else if( str == kOfxParamDoubleTypeNormalisedX ) 01583 v = eDoubleTypeNormalisedX; 01584 else if( str == kOfxParamDoubleTypeNormalisedY ) 01585 v = eDoubleTypeNormalisedY; 01586 else if( str == kOfxParamDoubleTypeNormalisedXAbsolute ) 01587 v = eDoubleTypeNormalisedXAbsolute; 01588 else if( str == kOfxParamDoubleTypeNormalisedYAbsolute ) 01589 v = eDoubleTypeNormalisedYAbsolute; 01590 else if( str == kOfxParamDoubleTypeNormalisedXY ) 01591 v = eDoubleTypeNormalisedXY; 01592 else if( str == kOfxParamDoubleTypeNormalisedXYAbsolute ) 01593 v = eDoubleTypeNormalisedXYAbsolute; 01594 else 01595 v = eDoubleTypePlain; 01596 } 01597 01598 //////////////////////////////////////////////////////////////////////////////// 01599 // Wraps up an double param */ 01600 01601 /** @brief hidden constructor */ 01602 DoubleParam::DoubleParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 01603 : BaseDoubleParam( paramSet, name, eDoubleParam, handle ) 01604 {} 01605 01606 /** @brief set the default value */ 01607 void DoubleParam::setDefault( double v ) 01608 { 01609 getProps().propSetDouble( kOfxParamPropDefault, v ); 01610 } 01611 01612 /** @brief set the hard min/max range, default is DOUBLE_MIN, DOUBLE_MAX */ 01613 void DoubleParam::setRange( double min, double max ) 01614 { 01615 getProps().propSetDouble( kOfxParamPropMin, min ); 01616 getProps().propSetDouble( kOfxParamPropMax, max ); 01617 } 01618 01619 /** @brief set the display min and max, default is to be the same as the range param */ 01620 void DoubleParam::setDisplayRange( double min, double max ) 01621 { 01622 getProps().propSetDouble( kOfxParamPropDisplayMin, min ); 01623 getProps().propSetDouble( kOfxParamPropDisplayMax, max ); 01624 } 01625 01626 /** @brief het the default value */ 01627 void DoubleParam::getDefault( double& v ) const 01628 { 01629 v = getProps().propGetDouble( kOfxParamPropDefault ); 01630 } 01631 01632 /** @brief set the hard min/max range, default is DOUBLE_MIN, DOUBLE_MAX */ 01633 void DoubleParam::getRange( double& min, double& max ) const 01634 { 01635 min = getProps().propGetDouble( kOfxParamPropMin ); 01636 max = getProps().propGetDouble( kOfxParamPropMax ); 01637 } 01638 01639 /** @brief set the display min and max, default is to be the same as the range param */ 01640 void DoubleParam::getDisplayRange( double& min, double& max ) const 01641 { 01642 min = getProps().propGetDouble( kOfxParamPropDisplayMin ); 01643 max = getProps().propGetDouble( kOfxParamPropDisplayMax ); 01644 } 01645 01646 /** @brief get value */ 01647 void DoubleParam::getValue( double& v ) const 01648 { 01649 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &v ); 01650 01651 throwSuiteStatusException( stat ); 01652 } 01653 01654 /** @brief get the value at a time */ 01655 void DoubleParam::getValueAtTime( double t, double& v ) const 01656 { 01657 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &v ); 01658 01659 throwSuiteStatusException( stat ); 01660 } 01661 01662 /** @brief set value */ 01663 void DoubleParam::setValue( double v ) 01664 { 01665 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, v ); 01666 01667 throwSuiteStatusException( stat ); 01668 } 01669 01670 /** @brief set the value at a time, implicitly adds a keyframe */ 01671 void DoubleParam::setValueAtTime( double t, double v ) 01672 { 01673 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 01674 throwHostMissingSuiteException( "paramSetValueAtTime" ); 01675 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, v ); 01676 throwSuiteStatusException( stat ); 01677 } 01678 01679 /** @brief get the value at a time */ 01680 void DoubleParam::differentiate( double t, double& v ) const 01681 { 01682 if( !OFX::Private::gParamSuite->paramGetDerivative ) 01683 throwHostMissingSuiteException( "paramGetDerivative" ); 01684 OfxStatus stat = OFX::Private::gParamSuite->paramGetDerivative( _paramHandle, t, &v ); 01685 throwSuiteStatusException( stat ); 01686 } 01687 01688 /** @brief get the value at a time */ 01689 void DoubleParam::integrate( double t1, double t2, double& v ) const 01690 { 01691 if( !OFX::Private::gParamSuite->paramGetIntegral ) 01692 throwHostMissingSuiteException( "paramGetIntegral" ); 01693 OfxStatus stat = OFX::Private::gParamSuite->paramGetIntegral( _paramHandle, t1, t2, &v ); 01694 throwSuiteStatusException( stat ); 01695 } 01696 01697 //////////////////////////////////////////////////////////////////////////////// 01698 // 2D Double params 01699 01700 /** @brief hidden constructor */ 01701 Double2DParam::Double2DParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 01702 : BaseDoubleParam( paramSet, name, eDouble2DParam, handle ) 01703 {} 01704 01705 /** @brief set the default value */ 01706 void Double2DParam::setDefault( double x, double y ) 01707 { 01708 getProps().propSetDouble( kOfxParamPropDefault, x, 0 ); 01709 getProps().propSetDouble( kOfxParamPropDefault, y, 1 ); 01710 } 01711 01712 /** @brief set the hard min/max range, default is DOUBLE_MIN, DOUBLE_MAX */ 01713 void Double2DParam::setRange( double xmin, double ymin, 01714 double xmax, double ymax ) 01715 { 01716 getProps().propSetDouble( kOfxParamPropMin, xmin, 0 ); 01717 getProps().propSetDouble( kOfxParamPropMin, ymin, 1 ); 01718 getProps().propSetDouble( kOfxParamPropMax, xmax, 0 ); 01719 getProps().propSetDouble( kOfxParamPropMax, ymax, 1 ); 01720 } 01721 01722 /** @brief set the display min and max, default is to be the same as the range param */ 01723 void Double2DParam::setDisplayRange( double xmin, double ymin, 01724 double xmax, double ymax ) 01725 { 01726 getProps().propSetDouble( kOfxParamPropDisplayMin, xmin, 0 ); 01727 getProps().propSetDouble( kOfxParamPropDisplayMin, ymin, 1 ); 01728 getProps().propSetDouble( kOfxParamPropDisplayMax, xmax, 0 ); 01729 getProps().propSetDouble( kOfxParamPropDisplayMax, ymax, 1 ); 01730 } 01731 01732 /** @brief het the default value */ 01733 void Double2DParam::getDefault( double& x, double& y ) const 01734 { 01735 x = getProps().propGetDouble( kOfxParamPropDefault, 0 ); 01736 y = getProps().propGetDouble( kOfxParamPropDefault, 1 ); 01737 } 01738 01739 /** @brief set the hard min/max range, default is DOUBLE_MIN, DOUBLE_MAX */ 01740 void Double2DParam::getRange( double& xmin, double& ymin, 01741 double& xmax, double& ymax ) const 01742 { 01743 xmin = getProps().propGetDouble( kOfxParamPropMin, 0 ); 01744 ymin = getProps().propGetDouble( kOfxParamPropMin, 1 ); 01745 xmax = getProps().propGetDouble( kOfxParamPropMax, 0 ); 01746 ymax = getProps().propGetDouble( kOfxParamPropMax, 1 ); 01747 } 01748 01749 /** @brief set the display min and max, default is to be the same as the range param */ 01750 void Double2DParam::getDisplayRange( double& xmin, double& ymin, 01751 double& xmax, double& ymax ) const 01752 { 01753 xmin = getProps().propGetDouble( kOfxParamPropDisplayMin, 0 ); 01754 ymin = getProps().propGetDouble( kOfxParamPropDisplayMin, 1 ); 01755 xmax = getProps().propGetDouble( kOfxParamPropDisplayMax, 0 ); 01756 ymax = getProps().propGetDouble( kOfxParamPropDisplayMax, 1 ); 01757 } 01758 01759 /** @brief get value */ 01760 void Double2DParam::getValue( double& x, double& y ) const 01761 { 01762 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &x, &y ); 01763 01764 throwSuiteStatusException( stat ); 01765 } 01766 01767 /** @brief get the value at a time */ 01768 void Double2DParam::getValueAtTime( double t, double& x, double& y ) const 01769 { 01770 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &x, &y ); 01771 01772 throwSuiteStatusException( stat ); 01773 } 01774 01775 /** @brief set value */ 01776 void Double2DParam::setValue( double x, double y ) 01777 { 01778 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, x, y ); 01779 01780 throwSuiteStatusException( stat ); 01781 } 01782 01783 /** @brief set the value at a time, implicitly adds a keyframe */ 01784 void Double2DParam::setValueAtTime( double t, double x, double y ) 01785 { 01786 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 01787 throwHostMissingSuiteException( "paramSetValueAtTime" ); 01788 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, x, y ); 01789 throwSuiteStatusException( stat ); 01790 } 01791 01792 /** @brief get the value at a time */ 01793 void Double2DParam::differentiate( double t, double& x, double& y ) const 01794 { 01795 if( !OFX::Private::gParamSuite->paramGetDerivative ) 01796 throwHostMissingSuiteException( "paramGetDerivative" ); 01797 OfxStatus stat = OFX::Private::gParamSuite->paramGetDerivative( _paramHandle, t, &x, &y ); 01798 throwSuiteStatusException( stat ); 01799 } 01800 01801 /** @brief get the value at a time */ 01802 void Double2DParam::integrate( double t1, double t2, double& x, double& y ) const 01803 { 01804 if( !OFX::Private::gParamSuite->paramGetIntegral ) 01805 throwHostMissingSuiteException( "paramGetIntegral" ); 01806 OfxStatus stat = OFX::Private::gParamSuite->paramGetIntegral( _paramHandle, t1, t2, &x, &y ); 01807 throwSuiteStatusException( stat ); 01808 } 01809 01810 //////////////////////////////////////////////////////////////////////////////// 01811 // 3D Double params 01812 01813 /** @brief hidden constructor */ 01814 Double3DParam::Double3DParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 01815 : BaseDoubleParam( paramSet, name, eDouble3DParam, handle ) 01816 {} 01817 01818 /** @brief set the default value */ 01819 void Double3DParam::setDefault( double x, double y, double z ) 01820 { 01821 getProps().propSetDouble( kOfxParamPropDefault, x, 0 ); 01822 getProps().propSetDouble( kOfxParamPropDefault, y, 1 ); 01823 getProps().propSetDouble( kOfxParamPropDefault, z, 2 ); 01824 } 01825 01826 /** @brief set the hard min/max range, default is DOUBLE_MIN, DOUBLE_MAX */ 01827 void Double3DParam::setRange( double xmin, double ymin, double zmin, 01828 double xmax, double ymax, double zmax ) 01829 { 01830 getProps().propSetDouble( kOfxParamPropMin, xmin, 0 ); 01831 getProps().propSetDouble( kOfxParamPropMin, ymin, 1 ); 01832 getProps().propSetDouble( kOfxParamPropMin, zmin, 2 ); 01833 getProps().propSetDouble( kOfxParamPropMax, xmax, 0 ); 01834 getProps().propSetDouble( kOfxParamPropMax, ymax, 1 ); 01835 getProps().propSetDouble( kOfxParamPropMin, zmax, 2 ); 01836 } 01837 01838 /** @brief set the display min and max, default is to be the same as the range param */ 01839 void Double3DParam::setDisplayRange( double xmin, double ymin, double zmin, 01840 double xmax, double ymax, double zmax ) 01841 { 01842 getProps().propSetDouble( kOfxParamPropDisplayMin, xmin, 0 ); 01843 getProps().propSetDouble( kOfxParamPropDisplayMin, ymin, 1 ); 01844 getProps().propSetDouble( kOfxParamPropDisplayMin, zmin, 2 ); 01845 getProps().propSetDouble( kOfxParamPropDisplayMax, xmax, 0 ); 01846 getProps().propSetDouble( kOfxParamPropDisplayMax, ymax, 1 ); 01847 getProps().propSetDouble( kOfxParamPropDisplayMax, zmax, 2 ); 01848 } 01849 01850 /** @brief het the default value */ 01851 void Double3DParam::getDefault( double& x, double& y, double& z ) const 01852 { 01853 x = getProps().propGetDouble( kOfxParamPropDefault, 0 ); 01854 y = getProps().propGetDouble( kOfxParamPropDefault, 1 ); 01855 z = getProps().propGetDouble( kOfxParamPropDefault, 2 ); 01856 } 01857 01858 /** @brief set the hard min/max range, default is DOUBLE_MIN, DOUBLE_MAX */ 01859 void Double3DParam::getRange( double& xmin, double& ymin, double& zmin, 01860 double& xmax, double& ymax, double& zmax ) const 01861 { 01862 xmin = getProps().propGetDouble( kOfxParamPropMin, 0 ); 01863 ymin = getProps().propGetDouble( kOfxParamPropMin, 1 ); 01864 zmin = getProps().propGetDouble( kOfxParamPropMin, 2 ); 01865 xmax = getProps().propGetDouble( kOfxParamPropMax, 0 ); 01866 ymax = getProps().propGetDouble( kOfxParamPropMax, 1 ); 01867 zmax = getProps().propGetDouble( kOfxParamPropMax, 2 ); 01868 } 01869 01870 /** @brief set the display min and max, default is to be the same as the range param */ 01871 void Double3DParam::getDisplayRange( double& xmin, double& ymin, double& zmin, 01872 double& xmax, double& ymax, double& zmax ) const 01873 { 01874 xmin = getProps().propGetDouble( kOfxParamPropDisplayMin, 0 ); 01875 ymin = getProps().propGetDouble( kOfxParamPropDisplayMin, 1 ); 01876 zmin = getProps().propGetDouble( kOfxParamPropDisplayMin, 2 ); 01877 xmax = getProps().propGetDouble( kOfxParamPropDisplayMax, 0 ); 01878 ymax = getProps().propGetDouble( kOfxParamPropDisplayMax, 1 ); 01879 zmax = getProps().propGetDouble( kOfxParamPropDisplayMax, 2 ); 01880 } 01881 01882 /** @brief get value */ 01883 void Double3DParam::getValue( double& x, double& y, double& z ) const 01884 { 01885 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &x, &y, &z ); 01886 01887 throwSuiteStatusException( stat ); 01888 } 01889 01890 /** @brief get the value at a time */ 01891 void Double3DParam::getValueAtTime( double t, double& x, double& y, double& z ) const 01892 { 01893 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &x, &y, &z ); 01894 01895 throwSuiteStatusException( stat ); 01896 } 01897 01898 /** @brief set value */ 01899 void Double3DParam::setValue( double x, double y, double z ) 01900 { 01901 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, x, y, z ); 01902 01903 throwSuiteStatusException( stat ); 01904 } 01905 01906 /** @brief set the value at a time, implicitly adds a keyframe */ 01907 void Double3DParam::setValueAtTime( double t, double x, double y, double z ) 01908 { 01909 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 01910 throwHostMissingSuiteException( "paramSetValueAtTime" ); 01911 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, x, y, z ); 01912 throwSuiteStatusException( stat ); 01913 } 01914 01915 /** @brief get the value at a time */ 01916 void Double3DParam::differentiate( double t, double& x, double& y, double& z ) const 01917 { 01918 if( !OFX::Private::gParamSuite->paramGetDerivative ) 01919 throwHostMissingSuiteException( "paramGetDerivative" ); 01920 OfxStatus stat = OFX::Private::gParamSuite->paramGetDerivative( _paramHandle, t, &x, &y, &z ); 01921 throwSuiteStatusException( stat ); 01922 } 01923 01924 /** @brief get the value at a time */ 01925 void Double3DParam::integrate( double t1, double t2, double& x, double& y, double& z ) const 01926 { 01927 if( !OFX::Private::gParamSuite->paramGetIntegral ) 01928 throwHostMissingSuiteException( "paramGetIntegral" ); 01929 OfxStatus stat = OFX::Private::gParamSuite->paramGetIntegral( _paramHandle, t1, t2, &x, &y, &z ); 01930 throwSuiteStatusException( stat ); 01931 } 01932 01933 //////////////////////////////////////////////////////////////////////////////// 01934 // RGB colour param 01935 /** @brief hidden constructor */ 01936 RGBParam::RGBParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 01937 : ValueParam( paramSet, name, eRGBParam, handle ) 01938 {} 01939 01940 /** @brief set the default value */ 01941 void RGBParam::setDefault( double r, double g, double b ) 01942 { 01943 getProps().propSetDouble( kOfxParamPropDefault, r, 0 ); 01944 getProps().propSetDouble( kOfxParamPropDefault, g, 1 ); 01945 getProps().propSetDouble( kOfxParamPropDefault, b, 2 ); 01946 } 01947 01948 /** @brief het the default value */ 01949 void RGBParam::getDefault( double& r, double& g, double& b ) const 01950 { 01951 r = getProps().propGetDouble( kOfxParamPropDefault, 0 ); 01952 g = getProps().propGetDouble( kOfxParamPropDefault, 1 ); 01953 b = getProps().propGetDouble( kOfxParamPropDefault, 2 ); 01954 } 01955 01956 /** @brief get value */ 01957 void RGBParam::getValue( double& r, double& g, double& b ) const 01958 { 01959 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &r, &g, &b ); 01960 01961 throwSuiteStatusException( stat ); 01962 } 01963 01964 /** @brief get the value at a time */ 01965 void RGBParam::getValueAtTime( double t, double& r, double& g, double& b ) const 01966 { 01967 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &r, &g, &b ); 01968 01969 throwSuiteStatusException( stat ); 01970 } 01971 01972 /** @brief set value */ 01973 void RGBParam::setValue( double r, double g, double b ) 01974 { 01975 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, r, g, b ); 01976 01977 throwSuiteStatusException( stat ); 01978 } 01979 01980 /** @brief set the value at a time, implicitly adds a keyframe */ 01981 void RGBParam::setValueAtTime( double t, double r, double g, double b ) 01982 { 01983 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 01984 throwHostMissingSuiteException( "paramSetValueAtTime" ); 01985 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, r, g, b ); 01986 throwSuiteStatusException( stat ); 01987 } 01988 01989 //////////////////////////////////////////////////////////////////////////////// 01990 // RGBA colour param 01991 /** @brief hidden constructor */ 01992 RGBAParam::RGBAParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 01993 : ValueParam( paramSet, name, eRGBAParam, handle ) 01994 {} 01995 01996 /** @brief set the default value */ 01997 void RGBAParam::setDefault( double r, double g, double b, double a ) 01998 { 01999 getProps().propSetDouble( kOfxParamPropDefault, r, 0 ); 02000 getProps().propSetDouble( kOfxParamPropDefault, g, 1 ); 02001 getProps().propSetDouble( kOfxParamPropDefault, b, 2 ); 02002 getProps().propSetDouble( kOfxParamPropDefault, a, 3 ); 02003 } 02004 02005 /** @brief het the default value */ 02006 void RGBAParam::getDefault( double& r, double& g, double& b, double& a ) const 02007 { 02008 r = getProps().propGetDouble( kOfxParamPropDefault, 0 ); 02009 g = getProps().propGetDouble( kOfxParamPropDefault, 1 ); 02010 b = getProps().propGetDouble( kOfxParamPropDefault, 2 ); 02011 a = getProps().propGetDouble( kOfxParamPropDefault, 3 ); 02012 } 02013 02014 /** @brief get value */ 02015 void RGBAParam::getValue( double& r, double& g, double& b, double& a ) const 02016 { 02017 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &r, &g, &b, &a ); 02018 02019 throwSuiteStatusException( stat ); 02020 } 02021 02022 /** @brief get the value at a time */ 02023 void RGBAParam::getValueAtTime( double t, double& r, double& g, double& b, double& a ) const 02024 { 02025 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &r, &g, &b, &a ); 02026 02027 throwSuiteStatusException( stat ); 02028 } 02029 02030 /** @brief set value */ 02031 void RGBAParam::setValue( double r, double g, double b, double a ) 02032 { 02033 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, r, g, b, a ); 02034 02035 throwSuiteStatusException( stat ); 02036 } 02037 02038 /** @brief set the value at a time, implicitly adds a keyframe */ 02039 void RGBAParam::setValueAtTime( double t, double r, double g, double b, double a ) 02040 { 02041 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 02042 throwHostMissingSuiteException( "paramSetValueAtTime" ); 02043 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, r, g, b, a ); 02044 throwSuiteStatusException( stat ); 02045 } 02046 02047 //////////////////////////////////////////////////////////////////////////////// 02048 // Wraps up a string param */ 02049 02050 /** @brief hidden constructor */ 02051 StringParam::StringParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 02052 : ValueParam( paramSet, name, eStringParam, handle ) 02053 {} 02054 02055 /** @brief het the default value */ 02056 void StringParam::getDefault( std::string& v ) const 02057 { 02058 v = getProps().propGetString( kOfxParamPropDefault ); 02059 } 02060 02061 /** @brief set the default value */ 02062 void StringParam::setDefault( const std::string& v ) 02063 { 02064 getProps().propSetString( kOfxParamPropDefault, v ); 02065 } 02066 02067 /** @brief get value */ 02068 void StringParam::getPointerValue( char** cStr ) const 02069 { 02070 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, cStr ); 02071 throwSuiteStatusException( stat ); 02072 } 02073 02074 void StringParam::getValue( std::string& v ) const 02075 { 02076 char* cStr = NULL; 02077 getPointerValue( &cStr ); 02078 v = cStr; 02079 } 02080 02081 /** @brief set value */ 02082 void StringParam::setValue( const std::string& v ) 02083 { 02084 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, v.c_str() ); 02085 02086 throwSuiteStatusException( stat ); 02087 } 02088 02089 /** @brief get the value at a time */ 02090 void StringParam::getPointerValueAtTime( OfxTime time, char** cStr ) const 02091 { 02092 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, time, cStr ); 02093 throwSuiteStatusException( stat ); 02094 } 02095 02096 /** @brief get the value at a time */ 02097 void StringParam::getValueAtTime( OfxTime time, std::string& v ) const 02098 { 02099 char* cStr = NULL; 02100 getPointerValueAtTime( time, &cStr ); 02101 v = cStr; 02102 } 02103 02104 /** @brief set the value at a time, implicitly adds a keyframe */ 02105 void StringParam::setValueAtTime( OfxTime time, const std::string& v ) 02106 { 02107 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 02108 throwHostMissingSuiteException( "paramSetValueAtTime" ); 02109 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, time, v.c_str() ); 02110 throwSuiteStatusException( stat ); 02111 } 02112 02113 02114 StringTypeEnum StringParam::getStringType() const 02115 { 02116 const std::string stringType = getProps().propGetString( kOfxParamPropStringMode ); 02117 02118 if( stringType == kOfxParamStringIsSingleLine ) 02119 return eStringTypeSingleLine; 02120 else if( stringType == kOfxParamStringIsMultiLine ) 02121 return eStringTypeMultiLine; 02122 else if( stringType == kOfxParamStringIsFilePath ) 02123 return eStringTypeFilePath; 02124 else if( stringType == kOfxParamStringIsDirectoryPath ) 02125 return eStringTypeDirectoryPath; 02126 // else if( stringType == kOfxParamStringIsLabel ) 02127 return eStringTypeLabel; 02128 } 02129 02130 02131 //////////////////////////////////////////////////////////////////////////////// 02132 // Wraps up a Boolean integer param */ 02133 02134 /** @brief hidden constructor */ 02135 BooleanParam::BooleanParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 02136 : ValueParam( paramSet, name, eBooleanParam, handle ) 02137 {} 02138 02139 /** @brief set the default value */ 02140 void BooleanParam::setDefault( bool v ) 02141 { 02142 getProps().propSetInt( kOfxParamPropDefault, v ); 02143 } 02144 02145 /** @brief het the default value */ 02146 void BooleanParam::getDefault( bool& v ) const 02147 { 02148 v = getProps().propGetInt( kOfxParamPropDefault ) != 0; 02149 } 02150 02151 /** @brief get value */ 02152 void BooleanParam::getValue( bool& v ) const 02153 { 02154 int iVal; 02155 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &iVal ); 02156 02157 throwSuiteStatusException( stat ); 02158 v = iVal != 0; 02159 } 02160 02161 /** @brief get the value at a time */ 02162 void BooleanParam::getValueAtTime( double t, bool& v ) const 02163 { 02164 int iVal; 02165 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &iVal ); 02166 02167 throwSuiteStatusException( stat ); 02168 v = iVal != 0; 02169 } 02170 02171 /** @brief set value */ 02172 void BooleanParam::setValue( bool v ) 02173 { 02174 int iVal = v; 02175 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, iVal ); 02176 02177 throwSuiteStatusException( stat ); 02178 } 02179 02180 /** @brief set the value at a time, implicitly adds a keyframe */ 02181 void BooleanParam::setValueAtTime( double t, bool v ) 02182 { 02183 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 02184 throwHostMissingSuiteException( "paramSetValueAtTime" ); 02185 int iVal = v; 02186 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, iVal ); 02187 throwSuiteStatusException( stat ); 02188 } 02189 02190 //////////////////////////////////////////////////////////////////////////////// 02191 // Wraps up a choice integer param */ 02192 02193 /** @brief hidden constructor */ 02194 ChoiceParam::ChoiceParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 02195 : ValueParam( paramSet, name, eChoiceParam, handle ) 02196 {} 02197 02198 /** @brief set the default value */ 02199 void ChoiceParam::setDefault( int v ) 02200 { 02201 getProps().propSetInt( kOfxParamPropDefault, v ); 02202 } 02203 02204 /** @brief het the default value */ 02205 void ChoiceParam::getDefault( int& v ) const 02206 { 02207 v = getProps().propGetInt( kOfxParamPropDefault ); 02208 } 02209 02210 /** @brief get value */ 02211 void ChoiceParam::getValue( int& v ) const 02212 { 02213 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &v ); 02214 02215 throwSuiteStatusException( stat ); 02216 } 02217 02218 /** @brief get the value at a time */ 02219 void ChoiceParam::getValueAtTime( double t, int& v ) const 02220 { 02221 const OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &v ); 02222 02223 throwSuiteStatusException( stat ); 02224 } 02225 02226 /** @brief set value */ 02227 void ChoiceParam::setValue( int v ) 02228 { 02229 const OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, v ); 02230 02231 throwSuiteStatusException( stat ); 02232 } 02233 02234 /** @brief set the value at a time, implicitly adds a keyframe */ 02235 void ChoiceParam::setValueAtTime( double t, int v ) 02236 { 02237 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 02238 throwHostMissingSuiteException( "paramSetValueAtTime" ); 02239 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, v ); 02240 throwSuiteStatusException( stat ); 02241 } 02242 02243 /** @brief how many options do we have */ 02244 int ChoiceParam::getNOptions( void ) const 02245 { 02246 const int nCurrentValues = getProps().propGetDimension( kOfxParamPropChoiceOption ); 02247 return nCurrentValues; 02248 } 02249 02250 /** @brief set the default value */ 02251 void ChoiceParam::appendOption( const std::string& shortName, const std::string& label ) 02252 { 02253 const int nCurrentValues = getProps().propGetDimension( kOfxParamPropChoiceOption ); 02254 02255 getProps().propSetString( kOfxParamPropChoiceOption, shortName, nCurrentValues ); 02256 getProps().propSetString( kOfxParamPropChoiceLabelOption, label, nCurrentValues, false ); // this option is optional extension, don't throw if not present. 02257 } 02258 02259 /** @brief set the default value */ 02260 void ChoiceParam::resetOptions( void ) 02261 { 02262 getProps().propReset( kOfxParamPropChoiceOption ); 02263 } 02264 02265 //////////////////////////////////////////////////////////////////////////////// 02266 // Wraps up a custom param */ 02267 02268 /** @brief hidden constructor */ 02269 CustomParam::CustomParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 02270 : ValueParam( paramSet, name, eCustomParam, handle ) 02271 {} 02272 02273 /** @brief set the default value */ 02274 void CustomParam::setDefault( const std::string& v ) 02275 { 02276 getProps().propSetString( kOfxParamPropDefault, v ); 02277 } 02278 02279 /** @brief het the default value */ 02280 void CustomParam::getDefault( std::string& v ) const 02281 { 02282 v = getProps().propGetString( kOfxParamPropDefault ); 02283 } 02284 02285 /** @brief get value */ 02286 void CustomParam::getValue( std::string& v ) const 02287 { 02288 char* cStr; 02289 OfxStatus stat = OFX::Private::gParamSuite->paramGetValue( _paramHandle, &cStr ); 02290 02291 throwSuiteStatusException( stat ); 02292 v = cStr; 02293 } 02294 02295 /** @brief get the value at a time */ 02296 void CustomParam::getValueAtTime( double t, std::string& v ) const 02297 { 02298 char* cStr; 02299 OfxStatus stat = OFX::Private::gParamSuite->paramGetValueAtTime( _paramHandle, t, &cStr ); 02300 02301 throwSuiteStatusException( stat ); 02302 v = cStr; 02303 } 02304 02305 /** @brief set value */ 02306 void CustomParam::setValue( const std::string& v ) 02307 { 02308 OfxStatus stat = OFX::Private::gParamSuite->paramSetValue( _paramHandle, v.c_str() ); 02309 02310 throwSuiteStatusException( stat ); 02311 } 02312 02313 /** @brief set the value at a time, implicitly adds a keyframe */ 02314 void CustomParam::setValueAtTime( double t, const std::string& v ) 02315 { 02316 if( !OFX::Private::gParamSuite->paramSetValueAtTime ) 02317 throwHostMissingSuiteException( "paramSetValueAtTime" ); 02318 OfxStatus stat = OFX::Private::gParamSuite->paramSetValueAtTime( _paramHandle, t, v.c_str() ); 02319 throwSuiteStatusException( stat ); 02320 } 02321 02322 //////////////////////////////////////////////////////////////////////////////// 02323 // Wraps up a group param 02324 /** @brief hidden constructor */ 02325 GroupParam::GroupParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 02326 : Param( paramSet, name, eGroupParam, handle ) 02327 {} 02328 02329 02330 //////////////////////////////////////////////////////////////////////////////// 02331 // Wraps up a page param 02332 02333 /** @brief hidden constructor */ 02334 PageParam::PageParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 02335 : Param( paramSet, name, ePageParam, handle ) 02336 {} 02337 02338 //////////////////////////////////////////////////////////////////////////////// 02339 // Wraps up a PushButton param 02340 02341 /** @brief hidden constructor */ 02342 PushButtonParam::PushButtonParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 02343 : Param( paramSet, name, ePushButtonParam, handle ) 02344 {} 02345 02346 //////////////////////////////////////////////////////////////////////////////// 02347 // Wraps up a Parametric param 02348 02349 /** @brief hidden constructor */ 02350 ParametricParam::ParametricParam( const ParamSet* paramSet, const std::string& name, OfxParamHandle handle ) 02351 : Param( paramSet, name, eParametricParam, handle ) 02352 {} 02353 02354 /** @brief Evaluates a parametric parameter 02355 02356 \arg curveIndex which dimension to evaluate 02357 \arg time the time to evaluate to the parametric param at 02358 \arg parametricPosition the position to evaluate the parametric param at 02359 02360 @returns the double value is returned 02361 */ 02362 double ParametricParam::getValue( const int curveIndex, 02363 const OfxTime time, 02364 const double parametricPosition ) 02365 { 02366 double returnValue = 0.0; 02367 OfxStatus stat = OFX::Private::gParametricParameterSuite->parametricParamGetValue( getOfxHandle(), 02368 curveIndex, 02369 time, 02370 parametricPosition, 02371 &returnValue ); 02372 throwSuiteStatusException( stat ); 02373 return returnValue; 02374 } 02375 02376 /** @brief Returns the number of control points in the parametric param. 02377 02378 \arg curveIndex which dimension to check 02379 \arg time the time to check 02380 02381 @returns the integer value is returned 02382 */ 02383 int ParametricParam::getNControlPoints( const int curveIndex, 02384 const OfxTime time ) 02385 { 02386 int returnValue = 0; 02387 OfxStatus stat = OFX::Private::gParametricParameterSuite->parametricParamGetNControlPoints( getOfxHandle(), 02388 curveIndex, 02389 time, 02390 &returnValue ); 02391 throwSuiteStatusException( stat ); 02392 return returnValue; 02393 } 02394 02395 /** @brief Returns the key/value pair of the nth control point. 02396 02397 \arg curveIndex which dimension to check 02398 \arg time the time to check 02399 \arg nthCtl the nth control point to get the value of 02400 02401 @returns a pair with key and value 02402 */ 02403 std::pair<double, double> ParametricParam::getNthControlPoints( const int curveIndex, 02404 const OfxTime time, 02405 const int nthCtl ) 02406 { 02407 std::pair<double, double> returnValue; 02408 OfxStatus stat = OFX::Private::gParametricParameterSuite->parametricParamGetNthControlPoint( getOfxHandle(), 02409 curveIndex, 02410 time, 02411 nthCtl, 02412 &returnValue.first, 02413 &returnValue.second ); 02414 throwSuiteStatusException( stat ); 02415 return returnValue; 02416 } 02417 02418 /** @brief Modifies an existing control point on a curve 02419 02420 \arg curveIndex which dimension to set 02421 \arg time the time to set the value at 02422 \arg nthCtl the control point to modify 02423 \arg key key of the control point 02424 \arg value value of the control point 02425 \arg addAnimationKey if the param is an animatable, setting this to true will 02426 force an animation keyframe to be set as well as a curve key, 02427 otherwise if false, a key will only be added if the curve is already 02428 animating. 02429 02430 @returns 02431 - ::kOfxStatOK - all was fine 02432 - ::kOfxStatErrBadHandle - if the paramter handle was invalid 02433 - ::kOfxStatErrUnknown - if the type is unknown 02434 02435 This modifies an existing control point. Note that by changing key, the order of the 02436 control point may be modified (as you may move it before or after anther point). So be 02437 careful when iterating over a curves control points and you change a key. 02438 */ 02439 void ParametricParam::setNthControlPoints( const int curveIndex, 02440 const OfxTime time, 02441 const int nthCtl, 02442 const double key, 02443 const double value, 02444 const bool addAnimationKey ) 02445 { 02446 OfxStatus stat = OFX::Private::gParametricParameterSuite->parametricParamSetNthControlPoint( getOfxHandle(), 02447 curveIndex, 02448 time, 02449 nthCtl, 02450 key, 02451 value, 02452 addAnimationKey ); 02453 throwSuiteStatusException( stat ); 02454 } 02455 02456 void ParametricParam::setNthControlPoints( const int curveIndex, 02457 const OfxTime time, 02458 const int nthCtl, 02459 const std::pair<double, double> ctrlPoint, 02460 const bool addAnimationKey ) 02461 { 02462 setNthControlPoints( curveIndex, 02463 time, 02464 nthCtl, 02465 ctrlPoint.first, 02466 ctrlPoint.second, 02467 addAnimationKey ); 02468 } 02469 02470 /** @brief Adds a control point to the curve. 02471 02472 \arg curveIndex which dimension to set 02473 \arg time the time to set the value at 02474 \arg key key of the control point 02475 \arg value value of the control point 02476 \arg addAnimationKey if the param is an animatable, setting this to true will 02477 force an animation keyframe to be set as well as a curve key, 02478 otherwise if false, a key will only be added if the curve is already 02479 animating. 02480 02481 This will add a new control point to the given dimension of a parametric parameter. If a key exists 02482 sufficiently close to 'key', then it will be set to the indicated control point. 02483 */ 02484 void ParametricParam::addControlPoint( const int curveIndex, 02485 const OfxTime time, 02486 const double key, 02487 const double value, 02488 const bool addAnimationKey ) 02489 { 02490 OfxStatus stat = OFX::Private::gParametricParameterSuite->parametricParamAddControlPoint( getOfxHandle(), curveIndex, time, key, value, addAnimationKey ); 02491 throwSuiteStatusException( stat ); 02492 } 02493 02494 /** @brief Deletes the nth control point from a parametric param. 02495 02496 \arg curveIndex which dimension to delete 02497 \arg nthCtl the control point to delete 02498 */ 02499 void ParametricParam::deleteControlPoint( const int curveIndex, 02500 const int nthCtl ) 02501 { 02502 OfxStatus stat = OFX::Private::gParametricParameterSuite->parametricParamDeleteControlPoint( getOfxHandle(), curveIndex, nthCtl ); 02503 throwSuiteStatusException( stat ); 02504 } 02505 02506 /** @brief Delete all curve control points on the given param. 02507 02508 \arg curveIndex which dimension to clear 02509 */ 02510 void ParametricParam::deleteControlPoint( const int curveIndex ) 02511 { 02512 OfxStatus stat = OFX::Private::gParametricParameterSuite->parametricParamDeleteAllControlPoints( getOfxHandle(), curveIndex ); 02513 throwSuiteStatusException( stat ); 02514 } 02515 02516 //////////////////////////////////////////////////////////////////////////////// 02517 // Wraps up a camera param 02518 02519 /** @brief hidden constructor */ 02520 CameraParam::CameraParam( OfxImageEffectHandle imageEffectHandle, const ParamSet* paramSet, const std::string& name, NukeOfxCameraHandle handle ) 02521 : Param( paramSet, name, eCameraParam, (OfxParamHandle)handle ) 02522 , _imageEffectHandle( imageEffectHandle ) 02523 { 02524 // fetch all parameters 02525 // NukeOfxCameraHandle *camera; 02526 // OfxPropertySetHandle *propertySet; 02527 // OfxStatus stat = OFX::Private::gCameraParameterSuite->cameraGetHandle( getOfxHandle(), name.c_str(), camera, propertySet ); 02528 // throwSuiteStatusException( stat ); 02529 } 02530 02531 Param& CameraParam::getParameter( const std::string& name ) 02532 { 02533 return *this; // @todo tuttle: use internal list, like a ParamSet or a Group ? 02534 } 02535 02536 02537 //////////////////////////////////////////////////////////////////////////////// 02538 // for a set of parameters 02539 /** @brief hidden ctor */ 02540 ParamSet::ParamSet( void ) 02541 : _paramSetHandle( 0 ) 02542 {} 02543 02544 /** @brief set the param set handle */ 02545 void ParamSet::setParamSetHandle( OfxParamSetHandle h ) 02546 { 02547 // set me handle 02548 _paramSetHandle = h; 02549 02550 if( h ) 02551 { 02552 // fetch me props 02553 OfxPropertySetHandle props; 02554 OfxStatus stat = OFX::Private::gParamSuite->paramSetGetPropertySet( h, &props ); 02555 _paramSetProps.propSetHandle( props ); 02556 throwSuiteStatusException( stat ); 02557 } 02558 else 02559 { 02560 _paramSetProps.propSetHandle( 0 ); 02561 } 02562 } 02563 02564 /** @brief dtor */ 02565 ParamSet::~ParamSet() 02566 { 02567 // delete any descriptor we may have constructed 02568 std::map<std::string, Param*>::iterator iter; 02569 for( iter = _fetchedParams.begin(); iter != _fetchedParams.end(); ++iter ) 02570 { 02571 if( iter->second ) 02572 { 02573 delete iter->second; 02574 iter->second = NULL; 02575 } 02576 } 02577 } 02578 02579 /** @brief calls the raw OFX routine to fetch a param */ 02580 void ParamSet::fetchRawParam( const std::string& name, ParamTypeEnum paramType, OfxParamHandle& handle ) 02581 { 02582 OfxPropertySetHandle propHandle; 02583 02584 OfxStatus stat = OFX::Private::gParamSuite->paramGetHandle( _paramSetHandle, name.c_str(), &handle, &propHandle ); 02585 02586 throwSuiteStatusException( stat ); 02587 02588 PropertySet props( propHandle ); 02589 02590 // make sure it is of our type 02591 std::string paramTypeStr = props.propGetString( kOfxParamPropType ); 02592 if( paramTypeStr != mapParamTypeEnumToString( paramType ) ) 02593 { 02594 BOOST_THROW_EXCEPTION( OFX::Exception::TypeRequest( "Parameter exists but is of the wrong type" ) ); 02595 } 02596 } 02597 02598 /** @brief calls the raw OFX routine to fetch a param */ 02599 void ParamSet::fetchRawCameraParam( OfxImageEffectHandle pluginHandle, const std::string& name, NukeOfxCameraHandle& handle ) 02600 { 02601 OfxPropertySetHandle propHandle; 02602 02603 OfxStatus stat = OFX::Private::gCameraParameterSuite->cameraGetHandle( pluginHandle, name.c_str(), &handle, &propHandle ); 02604 02605 throwSuiteStatusException( stat ); 02606 } 02607 02608 ParamTypeEnum ParamSet::getParamType( const std::string& name ) const 02609 { 02610 OfxPropertySetHandle propHandle; 02611 OfxParamHandle handle; 02612 OfxStatus stat = OFX::Private::gParamSuite->paramGetHandle( _paramSetHandle, name.c_str(), &handle, &propHandle ); 02613 02614 throwSuiteStatusException( stat ); 02615 PropertySet props( propHandle ); 02616 // make sure it is of our type 02617 std::string paramTypeStr = props.propGetString( kOfxParamPropType ); 02618 return mapParamTypeStringToEnum( paramTypeStr.c_str() ); 02619 } 02620 02621 bool ParamSet::paramExists( const std::string& name ) const 02622 { 02623 OfxParamHandle handle; 02624 OfxPropertySetHandle propHandle; 02625 OfxStatus stat = OFX::Private::gParamSuite->paramGetHandle( _paramSetHandle, name.c_str(), &handle, &propHandle ); 02626 02627 if( stat != kOfxStatOK ) 02628 return false; 02629 return true; 02630 } 02631 02632 Param* ParamSet::getParam( const std::string& name ) 02633 { 02634 OfxParamHandle handle; 02635 OfxPropertySetHandle propHandle; 02636 OfxStatus stat = OFX::Private::gParamSuite->paramGetHandle( _paramSetHandle, name.c_str(), &handle, &propHandle ); 02637 02638 throwSuiteStatusException( stat ); 02639 02640 PropertySet props( propHandle ); 02641 02642 // make sure it is of our type 02643 std::string paramTypeStr = props.propGetString( kOfxParamPropType ); 02644 ParamTypeEnum t = mapParamTypeStringToEnum( paramTypeStr.c_str() ); 02645 switch( t ) 02646 { 02647 case eStringParam: 02648 { 02649 return fetchParam<StringParam>( name ); 02650 } 02651 case eIntParam: 02652 { 02653 return fetchParam<IntParam>( name ); 02654 } 02655 case eInt2DParam: 02656 { 02657 return fetchParam<Int2DParam>( name ); 02658 } 02659 case eInt3DParam: 02660 { 02661 return fetchParam<Int3DParam>( name ); 02662 } 02663 case eDoubleParam: 02664 { 02665 return fetchParam<DoubleParam>( name ); 02666 } 02667 case eDouble2DParam: 02668 { 02669 return fetchParam<Double2DParam>( name ); 02670 } 02671 case eDouble3DParam: 02672 { 02673 return fetchParam<Double3DParam>( name ); 02674 } 02675 case eRGBParam: 02676 { 02677 return fetchParam<RGBParam>( name ); 02678 } 02679 case eRGBAParam: 02680 { 02681 return fetchParam<RGBAParam>( name ); 02682 } 02683 case eBooleanParam: 02684 { 02685 return fetchParam<BooleanParam>( name ); 02686 } 02687 case eChoiceParam: 02688 { 02689 return fetchParam<ChoiceParam>( name ); 02690 } 02691 case eCustomParam: 02692 { 02693 return fetchParam<CustomParam>( name ); 02694 } 02695 case eGroupParam: 02696 { 02697 return fetchParam<GroupParam>( name ); 02698 } 02699 case ePageParam: 02700 { 02701 return fetchParam<PageParam>( name ); 02702 } 02703 case ePushButtonParam: 02704 { 02705 return fetchParam<PushButtonParam>( name ); 02706 } 02707 case eParametricParam: 02708 { 02709 return fetchParam<ParametricParam>( name ); 02710 } 02711 case eCameraParam: 02712 { 02713 BOOST_THROW_EXCEPTION( OFX::Exception::Suite( kOfxStatErrFatal, "You can't fetch a camera parameter from here..." ) ); 02714 // return fetchParam<CameraParam>( name ); 02715 } 02716 default: 02717 assert( false ); 02718 } 02719 return 0; 02720 } 02721 02722 /** @brief if a param has been fetched in this set, go find it */ 02723 Param* ParamSet::findPreviouslyFetchedParam( const std::string& name ) 02724 { 02725 // search 02726 std::map<std::string, Param*>::const_iterator search; 02727 search = _fetchedParams.find( name ); 02728 if( search == _fetchedParams.end() ) 02729 return NULL; 02730 return search->second; 02731 } 02732 02733 /** @brief Fetch an integer param, only callable from describe in context */ 02734 IntParam* ParamSet::fetchIntParam( const std::string& name ) 02735 { 02736 return fetchParam<IntParam>( name ); 02737 } 02738 02739 /** @brief Fetch a 2D integer param */ 02740 Int2DParam* ParamSet::fetchInt2DParam( const std::string& name ) 02741 { 02742 return fetchParam<Int2DParam>( name ); 02743 } 02744 02745 /** @brief Fetch a 3D integer param */ 02746 Int3DParam* ParamSet::fetchInt3DParam( const std::string& name ) 02747 { 02748 return fetchParam<Int3DParam>( name ); 02749 } 02750 02751 /** @brief Fetch an double param, only callable from describe in context */ 02752 DoubleParam* ParamSet::fetchDoubleParam( const std::string& name ) 02753 { 02754 return fetchParam<DoubleParam>( name ); 02755 } 02756 02757 /** @brief Fetch a 2D double param */ 02758 Double2DParam* ParamSet::fetchDouble2DParam( const std::string& name ) 02759 { 02760 return fetchParam<Double2DParam>( name ); 02761 } 02762 02763 /** @brief Fetch a 3D double param */ 02764 Double3DParam* ParamSet::fetchDouble3DParam( const std::string& name ) 02765 { 02766 return fetchParam<Double3DParam>( name ); 02767 } 02768 02769 /** @brief Fetch a string param */ 02770 StringParam* ParamSet::fetchStringParam( const std::string& name ) 02771 { 02772 return fetchParam<StringParam>( name ); 02773 } 02774 02775 /** @brief Fetch a RGBA param */ 02776 RGBAParam* ParamSet::fetchRGBAParam( const std::string& name ) 02777 { 02778 return fetchParam<RGBAParam>( name ); 02779 } 02780 02781 /** @brief Fetch an RGB param */ 02782 RGBParam* ParamSet::fetchRGBParam( const std::string& name ) 02783 { 02784 return fetchParam<RGBParam>( name ); 02785 } 02786 02787 /** @brief Fetch a Boolean param */ 02788 BooleanParam* ParamSet::fetchBooleanParam( const std::string& name ) 02789 { 02790 return fetchParam<BooleanParam>( name ); 02791 } 02792 02793 /** @brief Fetch a Choice param */ 02794 ChoiceParam* ParamSet::fetchChoiceParam( const std::string& name ) 02795 { 02796 return fetchParam<ChoiceParam>( name ); 02797 } 02798 02799 /** @brief Fetch a group param */ 02800 GroupParam* ParamSet::fetchGroupParam( const std::string& name ) 02801 { 02802 return fetchParam<GroupParam>( name ); 02803 } 02804 02805 /** @brief Fetch a Page param */ 02806 PageParam* ParamSet::fetchPageParam( const std::string& name ) 02807 { 02808 return fetchParam<PageParam>( name ); 02809 } 02810 02811 /** @brief Fetch a push button param */ 02812 PushButtonParam* ParamSet::fetchPushButtonParam( const std::string& name ) 02813 { 02814 return fetchParam<PushButtonParam>( name ); 02815 } 02816 02817 /** @brief Fetch a custom param */ 02818 CustomParam* ParamSet::fetchCustomParam( const std::string& name ) 02819 { 02820 return fetchParam<CustomParam>( name ); 02821 } 02822 02823 /** @brief Fetch a parametric param */ 02824 ParametricParam* ParamSet::fetchParametricParam( const std::string& name ) 02825 { 02826 return fetchParam<ParametricParam>( name ); 02827 } 02828 02829 /// open an undoblock 02830 void ParamSet::beginEditBlock( const std::string& name ) 02831 { 02832 OfxStatus stat = OFX::Private::gParamSuite->paramEditBegin( _paramSetHandle, name.c_str() ); 02833 throwSuiteStatusException( stat ); 02834 } 02835 02836 /// close an undoblock 02837 void ParamSet::endEditBlock() 02838 { 02839 OfxStatus stat = OFX::Private::gParamSuite->paramEditEnd( _paramSetHandle ); 02840 throwSuiteStatusException( stat ); 02841 } 02842 02843 }