MCPcopy Create free account
hub / github.com/MrKepzie/Natron / newParam

Method newParam

Engine/OfxImageEffectInstance.cpp:480–729  ·  view source on GitHub ↗

make a parameter instance

Source from the content-addressed store, hash-verified

478
479// make a parameter instance
480OFX::Host::Param::Instance *
481OfxImageEffectInstance::newParam(const std::string &paramName,
482 OFX::Host::Param::Descriptor &descriptor)
483{
484 // note: the order for parameter types is the same as in ofxParam.h
485 OFX::Host::Param::Instance* instance = NULL;
486 KnobPtr knob;
487 bool paramShouldBePersistent = true;
488 bool secretByDefault = descriptor.getSecret();
489 bool enabledByDefault = descriptor.getEnabled();
490
491 std::string paramType = descriptor.getType();
492 bool isToggableButton = false;
493 if (paramType == kOfxParamTypeBoolean) {
494 isToggableButton = (bool)descriptor.getProperties().getIntProperty(kNatronOfxBooleanParamPropIsToggableButton);
495 if (isToggableButton) {
496 paramType = kOfxParamTypePushButton;
497 }
498 }
499
500 if (paramType == kOfxParamTypeInteger) {
501 OfxIntegerInstance *ret = new OfxIntegerInstance(getOfxEffectInstance(), descriptor);
502 knob = ret->getKnob();
503 instance = ret;
504 } else if (paramType == kOfxParamTypeDouble) {
505 OfxDoubleInstance *ret = new OfxDoubleInstance(getOfxEffectInstance(), descriptor);
506 knob = ret->getKnob();
507 instance = ret;
508 } else if (paramType == kOfxParamTypeBoolean) {
509 OfxBooleanInstance *ret = new OfxBooleanInstance(getOfxEffectInstance(), descriptor);
510 knob = ret->getKnob();
511 instance = ret;
512 } else if (paramType == kOfxParamTypeChoice) {
513 OfxChoiceInstance *ret = new OfxChoiceInstance(getOfxEffectInstance(), descriptor);
514 knob = ret->getKnob();
515 instance = ret;
516 } else if (paramType == kOfxParamTypeRGBA) {
517 OfxRGBAInstance *ret = new OfxRGBAInstance(getOfxEffectInstance(), descriptor);
518 knob = ret->getKnob();
519 instance = ret;
520 } else if (paramType == kOfxParamTypeRGB) {
521 OfxRGBInstance *ret = new OfxRGBInstance(getOfxEffectInstance(), descriptor);
522 knob = ret->getKnob();
523 instance = ret;
524 } else if (paramType == kOfxParamTypeDouble2D) {
525 OfxDouble2DInstance *ret = new OfxDouble2DInstance(getOfxEffectInstance(), descriptor);
526 knob = ret->getKnob();
527 instance = ret;
528 } else if (paramType == kOfxParamTypeInteger2D) {
529 OfxInteger2DInstance *ret = new OfxInteger2DInstance(getOfxEffectInstance(), descriptor);
530 knob = ret->getKnob();
531 instance = ret;
532 } else if (paramType == kOfxParamTypeDouble3D) {
533 OfxDouble3DInstance *ret = new OfxDouble3DInstance(getOfxEffectInstance(), descriptor);
534 knob = ret->getKnob();
535 instance = ret;
536 } else if (paramType == kOfxParamTypeInteger3D) {
537 OfxInteger3DInstance *ret = new OfxInteger3DInstance(getOfxEffectInstance(), descriptor);

Callers

nothing calls this directly

Calls 15

getOfxEffectInstanceFunction · 0.85
getEnabledMethod · 0.80
setAsToolButtonMethod · 0.80
setAsDialogMethod · 0.80
getNameMethod · 0.80
setAsToolBarMethod · 0.80
setCheckableMethod · 0.80
emptyMethod · 0.80
setIconLabelMethod · 0.80

Tested by

no test coverage detected