void TrackMarkerPM::initializeKnobs() { TrackMarker::initializeKnobs(); NodePtr thisNode = getModel()->getNode(); NodePtr node; { CreateNodeArgsPtr args(CreateNodeArgs::create( PLUGINID_OFX_TRACKERPM, NodeCollectionPtr() )); args->setProperty<bool>(kCreateNodeArgsPropVolatile, true); args->setProperty<bool>(kCreateNodeArgsPropNoNodeGUI, true); args->setProperty<std::string>(kCreateNodeArgsPropNodeInitialName, "TrackerPMNode"); node = getApp()->createNode(args); if (!node) { throw std::runtime_error("Couldn't create plug-in " PLUGINID_OFX_TRACKERPM); } if (thisNode) { NodePtr inputNode = thisNode->getInput(0); if (inputNode) { node->connectInput(inputNode, 0); } } trackerNode = node; } KnobItemsTablePtr model = getModel(); EffectInstancePtr effect; if (model) { effect = model->getNode()->getEffectInstance(); } trackPrevButton = getNodeKnob<KnobButton>(node, kTrackerPMParamTrackingPrevious); trackNextButton = getNodeKnob<KnobButton>(node, kTrackerPMParamTrackingNext); KnobDoublePtr center = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingCenterPoint); centerKnob = center; // Slave the center knob and unslave when tracking if ( !center->linkTo(getCenterKnob()) ) { throw std::runtime_error("Could not link center"); } KnobDoublePtr offset = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingOffset); // Slave the offset knob if ( !offset->linkTo( getOffsetKnob() ) ) { throw std::runtime_error("Could not link offset"); } offsetKnob = offset; // Ref frame is set for each refFrameKnob = getNodeKnob<KnobInt>(node, kTrackerPMParamTrackingReferenceFrame); // Enable reference frame KnobBoolPtr enableRefFrameKnob = getNodeKnob<KnobBool>(node, kTrackerPMParamTrackingEnableReferenceFrame); enableRefFrameKnob->setValue(true); KnobChoicePtr scoreType = getNodeKnob<KnobChoice>(node, kTrackerPMParamScore); if (effect) { #ifdef kTrackerParamPatternMatchingScoreType KnobIPtr modelKnob = effect->getKnobByName(kTrackerParamPatternMatchingScoreType); if (modelKnob) { if ( !scoreType->linkTo(modelKnob) ) { throw std::runtime_error("Could not link scoreType"); } } #endif } scoreTypeKnob = scoreType; KnobDoublePtr correlationScore = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingCorrelationScore); correlationScoreKnob = correlationScore; KnobDoublePtr patternBtmLeft = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingPatternBoxBtmLeft); patternBtmLeftKnob = patternBtmLeft; // Slave the search window and pattern of the node to the parameters of the marker (void)patternBtmLeft->linkTo(getPatternBtmLeftKnob()); KnobDoublePtr patternTopRight = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingPatternBoxTopRight); patternTopRightKnob = patternTopRight; (void)patternTopRight->linkTo(getPatternTopRightKnob()); KnobDoublePtr searchWindowBtmLeft = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingSearchBoxBtmLeft); searchWindowBtmLeftKnob = searchWindowBtmLeft; (void)searchWindowBtmLeft->linkTo(getSearchWindowBottomLeftKnob()); KnobDoublePtr searchWindowTopRight = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingSearchBoxTopRight); searchWindowTopRightKnob = searchWindowTopRight; (void)searchWindowTopRight->linkTo(getSearchWindowTopRightKnob()); } // TrackMarkerPM::initializeKnobs
void TrackMarkerPM::initializeKnobs() { TrackMarker::initializeKnobs(); NodePtr thisNode = getContext()->getNode(); QObject::connect( getContext().get(), SIGNAL(onNodeInputChanged(int)), this, SLOT(onTrackerNodeInputChanged(int)) ); NodePtr node; { CreateNodeArgs args( PLUGINID_OFX_TRACKERPM, NodeCollectionPtr() ); args.setProperty<bool>(kCreateNodeArgsPropOutOfProject, true); args.setProperty<bool>(kCreateNodeArgsPropNoNodeGUI, true); args.setProperty<std::string>(kCreateNodeArgsPropNodeInitialName, "TrackerPMNode"); node = getContext()->getNode()->getApp()->createNode(args); if (!node) { throw std::runtime_error("Couldn't create plug-in " PLUGINID_OFX_TRACKERPM); } if (thisNode) { NodePtr inputNode = thisNode->getInput(0); if (inputNode) { node->connectInput(inputNode, 0); } } trackerNode = node; } trackPrevButton = getNodeKnob<KnobButton>(node, kTrackerPMParamTrackingPrevious); trackNextButton = getNodeKnob<KnobButton>(node, kTrackerPMParamTrackingNext); KnobDoublePtr center = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingCenterPoint); centerKnob = center; // Slave the center knob and unslave when tracking for (int i = 0; i < center->getDimension(); ++i) { center->slaveTo(i, getCenterKnob(), i); } KnobDoublePtr offset = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingOffset); // Slave the offset knob for (int i = 0; i < offset->getDimension(); ++i) { offset->slaveTo(i, getOffsetKnob(), i); } offsetKnob = offset; // Ref frame is set for each refFrameKnob = getNodeKnob<KnobInt>(node, kTrackerPMParamTrackingReferenceFrame); // Enable reference frame KnobBoolPtr enableRefFrameKnob = getNodeKnob<KnobBool>(node, kTrackerPMParamTrackingEnableReferenceFrame); enableRefFrameKnob->setValue(true); KnobChoicePtr scoreType = getNodeKnob<KnobChoice>(node, kTrackerPMParamScore); scoreType->slaveTo(0, getContext()->getCorrelationScoreTypeKnob(), 0); scoreTypeKnob = scoreType; KnobDoublePtr correlationScore = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingCorrelationScore); correlationScoreKnob = correlationScore; KnobDoublePtr patternBtmLeft = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingPatternBoxBtmLeft); patternBtmLeftKnob = patternBtmLeft; // Slave the search window and pattern of the node to the parameters of the marker for (int i = 0; i < patternBtmLeft->getDimension(); ++i) { patternBtmLeft->slaveTo(i, getPatternBtmLeftKnob(), i); } KnobDoublePtr patternTopRight = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingPatternBoxTopRight); patternTopRightKnob = patternTopRight; for (int i = 0; i < patternTopRight->getDimension(); ++i) { patternTopRight->slaveTo(i, getPatternTopRightKnob(), i); } KnobDoublePtr searchWindowBtmLeft = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingSearchBoxBtmLeft); searchWindowBtmLeftKnob = searchWindowBtmLeft; for (int i = 0; i < searchWindowBtmLeft->getDimension(); ++i) { searchWindowBtmLeft->slaveTo(i, getSearchWindowBottomLeftKnob(), i); } KnobDoublePtr searchWindowTopRight = getNodeKnob<KnobDouble>(node, kTrackerPMParamTrackingSearchBoxTopRight); searchWindowTopRightKnob = searchWindowTopRight; for (int i = 0; i < searchWindowTopRight->getDimension(); ++i) { searchWindowTopRight->slaveTo(i, getSearchWindowTopRightKnob(), i); } } // TrackMarkerPM::initializeKnobs