void getTo(TimeValue time, int index, double* tx, double* ty) const { KnobDoublePtr knob = to[index].lock(); assert(knob); *tx = knob->getValueAtTime(time, DimIdx(0)); *ty = knob->getValueAtTime(time, DimIdx(1)); }
RectD ViewerNode::getUserRoI() const { RectD ret; KnobDoublePtr btmLeft = _imp->userRoIBtmLeftKnob.lock(); KnobDoublePtr size = _imp->userRoISizeKnob.lock(); ret.x1 = btmLeft->getValue(); ret.y1 = btmLeft->getValue(DimIdx(1)); ret.x2 = ret.x1 + size->getValue(); ret.y2 = ret.y1 + size->getValue(DimIdx(1)); return ret; }
void ViewerNode::setUserRoI(const RectD& rect) { KnobDoublePtr btmLeft = _imp->userRoIBtmLeftKnob.lock(); KnobDoublePtr size = _imp->userRoISizeKnob.lock(); std::vector<double> values(2); values[0] = rect.x1; values[1] = rect.y1; btmLeft->setValueAcrossDimensions(values, DimIdx(0), ViewSetSpec::all(), eValueChangedReasonUserEdited); values[0] = rect.x2 - rect.x1; values[1] = rect.y2 - rect.y1; size->setValueAcrossDimensions(values, DimIdx(0), ViewSetSpec::all(), eValueChangedReasonUserEdited); }
void TrackArgs::getRedrawAreasNeeded(TimeValue time, std::list<RectD>* canonicalRects) const { for (std::vector<TrackMarkerAndOptionsPtr >::const_iterator it = _imp->tracks.begin(); it != _imp->tracks.end(); ++it) { if ( !(*it)->natronMarker->isEnabled(time) ) { continue; } KnobDoublePtr searchBtmLeft = (*it)->natronMarker->getSearchWindowBottomLeftKnob(); KnobDoublePtr searchTopRight = (*it)->natronMarker->getSearchWindowTopRightKnob(); KnobDoublePtr centerKnob = (*it)->natronMarker->getCenterKnob(); KnobDoublePtr offsetKnob = (*it)->natronMarker->getOffsetKnob(); Point offset, center, btmLeft, topRight; offset.x = offsetKnob->getValueAtTime(time, DimIdx(0)); offset.y = offsetKnob->getValueAtTime(time, DimIdx(1)); center.x = centerKnob->getValueAtTime(time, DimIdx(0)); center.y = centerKnob->getValueAtTime(time, DimIdx(1)); btmLeft.x = searchBtmLeft->getValueAtTime(time, DimIdx(0)) + center.x + offset.x; btmLeft.y = searchBtmLeft->getValueAtTime(time, DimIdx(1)) + center.y + offset.y; topRight.x = searchTopRight->getValueAtTime(time, DimIdx(0)) + center.x + offset.x; topRight.y = searchTopRight->getValueAtTime(time, DimIdx(1)) + center.y + offset.y; RectD rect; rect.x1 = btmLeft.x; rect.y1 = btmLeft.y; rect.x2 = topRight.x; rect.y2 = topRight.y; canonicalRects->push_back(rect); } }
static void deleteKnobAnimation(const std::set<double>& userKeyframes, const KnobIPtr& knob, DeleteKnobAnimationEnum type, double currentTime) { for (int i = 0; i < knob->getNDimensions(); ++i) { CurvePtr curve = knob->getAnimationCurve(ViewIdx(0), DimIdx(i)); assert(curve); KeyFrameSet keys = curve->getKeyFrames_mt_safe(); std::list<double> toRemove; switch (type) { case eDeleteKnobAnimationAll: { for (KeyFrameSet::iterator it = keys.begin(); it != keys.end(); ++it) { std::set<double>::iterator found = userKeyframes.find( it->getTime() ); if ( found == userKeyframes.end() ) { toRemove.push_back( it->getTime() ); } } break; } case eDeleteKnobAnimationBeforeTime: { for (KeyFrameSet::iterator it = keys.begin(); it != keys.end(); ++it) { if (it->getTime() >= currentTime) { break; } std::set<double>::iterator found = userKeyframes.find( it->getTime() ); if ( found == userKeyframes.end() ) { toRemove.push_back( it->getTime() ); } } break; } case eDeleteKnobAnimationAfterTime: { for (KeyFrameSet::reverse_iterator it = keys.rbegin(); it != keys.rend(); ++it) { if (it->getTime() <= currentTime) { break; } std::set<double>::iterator found = userKeyframes.find( it->getTime() ); if ( found == userKeyframes.end() ) { toRemove.push_back( it->getTime() ); } } break; } } knob->deleteValuesAtTime(toRemove, ViewSetSpec::all(), DimIdx(i), eValueChangedReasonUserEdited); } }
void TrackMarker::resetTrack() { Point curCenter; KnobDoublePtr centerKnob = getCenterKnob(); curCenter.x = centerKnob->getValue(); curCenter.y = centerKnob->getValue(DimIdx(1)); const KnobsVec& knobs = getKnobs(); for (KnobsVec::const_iterator it = knobs.begin(); it != knobs.end(); ++it) { if (*it != centerKnob) { (*it)->resetToDefaultValue(DimSpec::all(), ViewSetSpec::all()); } else { (*it)->removeAnimation(ViewSetSpec::all(), DimSpec::all(), eValueChangedReasonUserEdited); std::vector<double> values(2); values[0] = curCenter.x; values[1] = curCenter.y; centerKnob->setValueAcrossDimensions(values); } } removeAnimation(ViewSetSpec::all(), DimSpec::all(), eValueChangedReasonUserEdited); }
void ViewerNodePrivate::refreshInputChoiceMenu(int internalIndex, int groupInputIndex) { KnobChoicePtr inputChoiceKnob = internalIndex == 0 ? aInputNodeChoiceKnob.lock() : bInputNodeChoiceKnob.lock(); assert(groupInputIndex >= 0 && groupInputIndex < _publicInterface->getMaxInputCount()); std::string groupInputID; { std::stringstream ss; ss << groupInputIndex; groupInputID = ss.str(); } std::vector<ChoiceOption> entries = inputChoiceKnob->getEntries(); for (std::size_t i = 0; i < entries.size(); ++i) { if (entries[i].id == groupInputID) { inputChoiceKnob->setValue(i); return; } } // Input is no longer connected fallback on first input in the list if any, otherwise on None ("-") inputChoiceKnob->setValue(entries.size() > 1 ? 1 : 0, ViewSetSpec::all(), DimIdx(0), eValueChangedReasonPluginEdited); }
void KnobGuiColor::onDialogCurrentColorChanged(const QColor & color) { KnobColorPtr knob = _knob.lock(); if (!knob) { return; } int nDims = knob->getNDimensions(); std::vector<double> values(nDims); values[0] = color.redF(); convertFromUIToInternalColorspace(&values[0]); if (nDims > 1) { values[1] = color.greenF(); convertFromUIToInternalColorspace(&values[1]); } if (nDims > 2) { values[2] = color.blueF(); convertFromUIToInternalColorspace(&values[2]); } if (nDims > 3) { values[3] = color.alphaF(); } KnobGuiPtr knobUI = getKnobGui(); knob->setValueAcrossDimensions(values, DimIdx(0), getView(), eValueChangedReasonUserEdited); if ( knobUI->getGui() ) { knobUI->getGui()->setDraftRenderEnabled(true); } }
void KnobGuiColor::onDimensionsMadeVisible(bool visible) { KnobColorPtr knob = _knob.lock(); if (!knob) { return; } int nDims = knob->getNDimensions(); QColor colors[4]; colors[0].setRgbF(0.851643, 0.196936, 0.196936); colors[1].setRgbF(0, 0.654707, 0); colors[2].setRgbF(0.345293, 0.345293, 1); colors[3].setRgbF(0.398979, 0.398979, 0.398979); for (int i = 0; i < nDims; ++i) { SpinBox* sb = 0; getSpinBox(DimIdx(i), &sb); assert(sb); if (!visible) { sb->setAdditionalDecorationTypeEnabled(LineEdit::eAdditionalDecorationColoredUnderlinedText, false); } else { sb->setAdditionalDecorationTypeEnabled(LineEdit::eAdditionalDecorationColoredUnderlinedText, true, colors[i]); } } }
void KnobGuiColor::onDialogCurrentColorChanged(const QColor & color) { KnobColorPtr knob = _knob.lock(); bool isSimple = _useSimplifiedUI; int nDims = knob->getNDimensions(); std::vector<double> values(nDims); values[0] = isSimple ? color.redF() : Color::from_func_srgb( color.redF() ); if (nDims >= 3) { values[1] = isSimple ? color.greenF() : Color::from_func_srgb( color.greenF() ); values[2] = isSimple ? color.blueF() : Color::from_func_srgb( color.blueF() ); if (nDims == 4) { values[3] = color.alphaF(); } } KnobGuiPtr knobUI = getKnobGui(); knob->setValueAcrossDimensions(values, DimIdx(0), getView(), eValueChangedReasonUserEdited); if ( knobUI->getGui() ) { knobUI->getGui()->setDraftRenderEnabled(true); } }
void ViewerNode::refreshFps() { bool fpsEnabled = _imp->enableFpsKnob.lock()->getValue(); double fps; if (fpsEnabled) { fps = _imp->fpsKnob.lock()->getValue(); } else { NodePtr input0 = getCurrentAInput(); NodePtr input1 = getCurrentBInput(); if (input0) { fps = input0->getEffectInstance()->getFrameRate(); } else { if (input1) { fps = input1->getEffectInstance()->getFrameRate(); } else { fps = getApp()->getProjectFrameRate(); } } _imp->fpsKnob.lock()->setValue(fps, ViewSetSpec::all(), DimIdx(0), eValueChangedReasonPluginEdited); } getNode()->getRenderEngine()->setDesiredFPS(fps); }
void NodeAnimPrivate::computeFRRange() { NodeGuiPtr nodeUI = nodeGui.lock(); NodePtr node = nodeUI->getNode(); if (!node) { return; } KnobIntBasePtr frameRangeKnob = toKnobIntBase(node->getKnobByName(kFrameRangeParamNameFrameRange)); assert(frameRangeKnob); frameRange.min = frameRangeKnob->getValue(DimIdx(0)); frameRange.max = frameRangeKnob->getValue(DimIdx(1)); }
QPointF ViewerNode::getWipeCenter() const { KnobDoublePtr wipeCenter = _imp->wipeCenter.lock(); QPointF r; r.rx() = wipeCenter->getValue(); r.ry() = wipeCenter->getValue(DimIdx(1)); return r; }
bool PointOverlayInteract::onOverlayPenUp(TimeValue time, const RenderScale & renderScale, ViewIdx view, const QPointF & viewportPos, const QPointF & penPos, double pressure, TimeValue timestamp) { KnobDoublePtr knob = _imp->param.lock(); // do not show interact if knob is secret or not enabled // see https://github.com/MrKepzie/Natron/issues/932 if ( !knob || !knob->shouldDrawOverlayInteract() ) { return false; } RenderScale pscale; getPixelScale(pscale.x, pscale.y); bool didSomething = false; if (_imp->state == ePositionInteractStatePicked) { if (!_imp->interactiveDrag) { std::vector<double> p(2); p[0] = fround(_imp->lastPenPos.x(), pscale.x); p[1] = fround(_imp->lastPenPos.y(), pscale.y); for (int i = 0; i < 2; ++i) { if (knob->getValueIsNormalized(DimIdx(i)) != eValueIsNormalizedNone) { p[i] = knob->normalize(DimIdx(i), time, p[i]); } } knob->setValueAcrossDimensions(p, DimIdx(0), view, eValueChangedReasonUserEdited); } _imp->state = ePositionInteractStateInactive; bool motion = onOverlayPenMotion(time, renderScale, view, viewportPos, penPos, pressure, timestamp); Q_UNUSED(motion); didSomething = true; } return didSomething; } // onOverlayPenUp
void ViewerNode::setRefreshButtonDown(bool down) { KnobButtonPtr knob = _imp->refreshButtonKnob.lock(); // Ignore evaluation ScopedChanges_RAII changes(this, true); knob->setValue(down, ViewIdx(0), DimIdx(0), eValueChangedReasonTimeChanged); }
void AnimationModuleSelectionModel::addAnimatedItemsWithoutKeyframes(const AnimItemBasePtr& item, DimSpec dim, ViewSetSpec viewSpec, AnimItemDimViewKeyFramesMap* result) { if (!result) { return; } std::list<ViewIdx> views = item->getViewsList(); int nDims = item->getNDimensions(); if (viewSpec.isAll()) { for (std::list<ViewIdx>::const_iterator it3 = views.begin(); it3 != views.end(); ++it3) { if (dim.isAll()) { for (int i = 0; i < nDims; ++i) { QTreeWidgetItem* treeItem = item->getTreeItem(DimIdx(i), *it3); if (AnimationModuleTreeView::isItemVisibleRecursive(treeItem)) { AnimItemDimViewIndexID key(item, *it3, DimIdx(i)); KeyFrameWithStringSet &keysForItem = (*result)[key]; (void)keysForItem; } } } else { QTreeWidgetItem* treeItem = item->getTreeItem(DimIdx(dim), *it3); if (AnimationModuleTreeView::isItemVisibleRecursive(treeItem)) { AnimItemDimViewIndexID key(item, *it3, DimIdx(dim)); KeyFrameWithStringSet &keysForItem = (*result)[key]; (void)keysForItem; } } } } else { if (dim.isAll()) { for (int i = 0; i < nDims; ++i) { QTreeWidgetItem* treeItem = item->getTreeItem(DimIdx(i), ViewIdx(viewSpec)); if (AnimationModuleTreeView::isItemVisibleRecursive(treeItem)) { AnimItemDimViewIndexID key(item, ViewIdx(viewSpec), DimIdx(i)); KeyFrameWithStringSet &keysForItem = (*result)[key]; (void)keysForItem; } } } else { QTreeWidgetItem* treeItem = item->getTreeItem(DimIdx(dim), ViewIdx(viewSpec)); if (AnimationModuleTreeView::isItemVisibleRecursive(treeItem)) { AnimItemDimViewIndexID key(item, ViewIdx(viewSpec), DimIdx(dim)); KeyFrameWithStringSet &keysForItem = (*result)[key]; (void)keysForItem; } } } } // addAnimatedItemsWithoutKeyframes
void TrackMarker::setEnabledAtTime(TimeValue time, bool enabled) { KnobBoolPtr knob = _imp->enabled.lock(); if (!knob) { return; } knob->setValueAtTime(time, enabled, ViewSetSpec::all(), DimIdx(0)); }
void ViewerNodePrivate::abortAllViewersRendering() { std::list<ViewerNodePtr> viewers; getAllViewerNodes(false, viewers); playForwardButtonKnob.lock()->setValue(false, ViewSetSpec::all(), DimIdx(0), eValueChangedReasonPluginEdited); playBackwardButtonKnob.lock()->setValue(false, ViewSetSpec::all(), DimIdx(0), eValueChangedReasonPluginEdited); if ( _publicInterface->getApp()->isGuiFrozen() && appPTR->getCurrentSettings()->isAutoTurboEnabled() ) { _publicInterface->getApp()->setGuiFrozen(false); } // Abort all viewers because they are all synchronised. for (std::list<ViewerNodePtr>::const_iterator it = viewers.begin(); it != viewers.end(); ++it) { (*it)->getNode()->getRenderEngine()->abortRenderingNoRestart(); } }
void TrackMarker::getCenterKeyframes(std::set<double>* keyframes) const { CurvePtr curve = _imp->center.lock()->getAnimationCurve(ViewIdx(0), DimIdx(0)); assert(curve); KeyFrameSet keys = curve->getKeyFrames_mt_safe(); for (KeyFrameSet::iterator it = keys.begin(); it != keys.end(); ++it) { keyframes->insert( it->getTime() ); } }
SetExpressionCommand::SetExpressionCommand(const KnobIPtr & knob, bool hasRetVar, DimSpec dimension, ViewSetSpec view, const std::string& expr, QUndoCommand *parent) : QUndoCommand(parent) , _knob(knob) , _oldExprs() , _newExpr(expr) , _hasRetVar(hasRetVar) , _dimension(dimension) , _view(view) { int nDims = knob->getNDimensions(); std::list<ViewIdx> allViews = knob->getViewsList(); if (dimension.isAll()) { for (int i = 0; i < nDims; ++i) { if (view.isAll()) { for (std::list<ViewIdx>::const_iterator it = allViews.begin(); it!=allViews.end(); ++it) { getOldExprForDimView(knob, DimIdx(i), *it, &_oldExprs); } } else { getOldExprForDimView(knob, DimIdx(i), ViewIdx(view), &_oldExprs); } } } else { if (view.isAll()) { for (std::list<ViewIdx>::const_iterator it = allViews.begin(); it!=allViews.end(); ++it) { getOldExprForDimView(knob, DimIdx(dimension), *it, &_oldExprs); } } else { getOldExprForDimView(knob, DimIdx(dimension), ViewIdx(view), &_oldExprs); } } setText( tr("Set Expression") ); }
void TrackMarker::setKeyFrameOnCenterAndPatternAtTime(TimeValue time) { KnobDoublePtr center = _imp->center.lock(); { std::vector<double> values(2); values[0] = center->getValueAtTime(time); values[1] = center->getValueAtTime(time, DimIdx(1)); center->setValueAtTimeAcrossDimensions(time, values); } KnobDoublePtr patternCorners[4] = {_imp->patternBtmLeft.lock(), _imp->patternTopLeft.lock(), _imp->patternTopRight.lock(), _imp->patternBtmRight.lock()}; for (int c = 0; c < 4; ++c) { KnobDoublePtr k = patternCorners[c]; std::vector<double> values(2); values[0] = k->getValueAtTime(time, DimIdx(0)); values[1] = k->getValueAtTime(time, DimIdx(1)); k->setValueAcrossDimensions(values); } }
void EditExpressionDialog::setTitle() { KnobIPtr k = _knob->getKnob(); QString title( tr("Set expression on ") ); title.append( QString::fromUtf8( k->getName().c_str() ) ); if ( !_dimension.isAll() && (k->getNDimensions() > 1) ) { title.append( QLatin1Char('.') ); title.append( QString::fromUtf8( k->getDimensionName(DimIdx(_dimension)).c_str() ) ); } setWindowTitle(title); }
void SetExpressionCommand::undo() { KnobIPtr knob = _knob.lock(); if (!knob) { return; } knob->beginChanges(); try { int nDims = knob->getNDimensions(); std::list<ViewIdx> allViews = knob->getViewsList(); if (_dimension.isAll()) { for (int i = 0; i < nDims; ++i) { if (_view.isAll()) { for (std::list<ViewIdx>::const_iterator it = allViews.begin(); it!=allViews.end(); ++it) { setOldExprForDimView(knob, DimIdx(i), *it, _oldExprs); } } else { setOldExprForDimView(knob, DimIdx(i), ViewIdx(_view), _oldExprs); } } } else { if (_view.isAll()) { for (std::list<ViewIdx>::const_iterator it = allViews.begin(); it!=allViews.end(); ++it) { setOldExprForDimView(knob, DimIdx(_dimension), *it, _oldExprs); } } else { setOldExprForDimView(knob, DimIdx(_dimension), ViewIdx(_view), _oldExprs); } } } catch (...) { Dialogs::errorDialog( tr("Expression").toStdString(), tr("The expression is invalid.").toStdString() ); } knob->endChanges(); }
bool CornerPinOverlayInteract::onOverlayPenUp(TimeValue time, const RenderScale & /*renderScale*/, ViewIdx view, const QPointF & /*viewportPos*/, const QPointF & /*pos*/, double /*pressure*/, TimeValue /*timestamp*/) { // do not show interact if knob is secret or not enabled // see https://github.com/MrKepzie/Natron/issues/932 KnobDoublePtr from1Knob = _imp->from[0].lock(); if ( !from1Knob || !from1Knob->shouldDrawOverlayInteract() ) { return false; } bool didSomething = _imp->dragging != -1; if ( !_imp->interactiveDrag && (_imp->dragging != -1) ) { // no need to redraw overlay since it is slave to the paramaters if (_imp->useFromDrag) { KnobDoublePtr knob = _imp->from[_imp->dragging].lock(); assert(knob); std::vector<double> val(2); val[0] = _imp->fromDrag[_imp->dragging].x; val[1] = _imp->fromDrag[_imp->dragging].y; knob->setValueAcrossDimensions(val, DimIdx(0), view, eValueChangedReasonUserEdited); } else { KnobDoublePtr knob = _imp->to[_imp->dragging].lock(); assert(knob); std::vector<double> val(2); val[0] = _imp->toDrag[_imp->dragging].x; val[1] = _imp->toDrag[_imp->dragging].y; if (_imp->toPointsAutoKeyingEnabled) { knob->setValueAtTimeAcrossDimensions(time, val, DimIdx(0), view, eValueChangedReasonUserEdited); // Also set a keyframe on other points for (int i = 0; i < 4; ++i) { if (i == _imp->dragging) { continue; } std::vector<double> values(2); KnobDoublePtr toPoint = _imp->to[i].lock(); values[0] = toPoint->getValueAtTime(time, DimIdx(0)); values[1] = toPoint->getValueAtTime(time, DimIdx(1)); toPoint->setValueAtTimeAcrossDimensions(time, values, DimIdx(0), view, eValueChangedReasonUserEdited); } } else { knob->setValueAcrossDimensions(val, DimIdx(0), view, eValueChangedReasonUserEdited); } } } _imp->dragging = -1; return didSomething; } // onOverlayPenUp
void KnobGuiGroup::createWidget(QHBoxLayout* layout) { _button = new GroupBoxLabel( layout->parentWidget() ); KnobGuiPtr knobUI = getKnobGui(); if ( knobUI->hasToolTip() ) { knobUI->toolTip(_button, getView()); } _checked = _knob.lock()->getValue(DimIdx(0), getView()); _button->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE); _button->setChecked(_checked); QObject::connect( _button, SIGNAL(checked(bool)), this, SLOT(onCheckboxChecked(bool)) ); layout->addWidget(_button); }
void TrackMarker::resetCenter() { KnobItemsTablePtr model = getModel(); if (!model) { return; } RectD rod; NodePtr input = model->getNode()->getInput(0); if (!input) { Format f; getApp()->getProject()->getProjectDefaultFormat(&f); rod = f.toCanonicalFormat(); } else { TimeValue time(input->getApp()->getTimeLine()->currentFrame()); RenderScale scale(1.); RectD rod; { GetRegionOfDefinitionResultsPtr results; ActionRetCodeEnum stat = input->getEffectInstance()->getRegionOfDefinition_public(time, scale, ViewIdx(0), &results); if (!isFailureRetCode(stat)) { rod = results->getRoD(); } } Point center; center.x = 0; center.y = 0; center.x = (rod.x1 + rod.x2) / 2.; center.y = (rod.y1 + rod.y2) / 2.; KnobDoublePtr centerKnob = getCenterKnob(); centerKnob->setValue(center.x, ViewSetSpec::all(), DimIdx(0)); centerKnob->setValue(center.y, ViewSetSpec::all(), DimIdx(1)); } }
bool areToPointsAnimated() const { bool hasAnimation = true; for (int i = 0; i < 4; ++i) { KnobDoublePtr knob = to[i].lock(); for (int d = 0; d < 2; ++d) { bool dimHasAnim = knob->isAnimated(DimIdx(d), ViewIdx(0)); if (!dimHasAnim) { hasAnimation = false; break; } } if (!hasAnimation) { break; } } return hasAnimation; }
void ViewerTab::onTimeLineTimeChanged(SequenceTime time, int reason) { Gui* gui = getGui(); if (!gui) { return; } ViewerNodePtr node = _imp->viewerNode.lock(); ViewerInstancePtr viewerNode = node->getInternalViewerNode(); if ((TimelineChangeReasonEnum)reason != eTimelineChangeReasonPlaybackSeek) { node->getCurrentFrameKnob()->setValue(time, ViewSetSpec::current(), DimIdx(0), eValueChangedReasonPluginEdited); } GuiAppInstancePtr app = gui->getApp(); if ( app && _imp->timeLineGui->getTimeline() != app->getTimeLine() ) { viewerNode->renderCurrentFrame(true); } }
bool DiskCacheNode::knobChanged(const KnobIPtr& k, ValueChangedReasonEnum /*reason*/, ViewSetSpec /*view*/, double /*time*/, bool /*originatedFromMainThread*/) { bool ret = true; if (_imp->frameRange.lock() == k) { int idx = _imp->frameRange.lock()->getValue(DimIdx(0)); switch (idx) { case 0: case 1: _imp->firstFrame.lock()->setSecret(true); _imp->lastFrame.lock()->setSecret(true); break; case 2: _imp->firstFrame.lock()->setSecret(false); _imp->lastFrame.lock()->setSecret(false); break; default: break; } } else if (_imp->preRender.lock() == k) { AppInstance::RenderWork w; w.writer = toOutputEffectInstance( shared_from_this() ); assert(w.writer); w.firstFrame = INT_MIN; w.lastFrame = INT_MAX; w.frameStep = 1; w.useRenderStats = false; std::list<AppInstance::RenderWork> works; works.push_back(w); getApp()->renderWritersNonBlocking(works); } else { ret = false; } return ret; }
RectD TrackMarker::getMarkerImageRoI(TimeValue time) const { Point center, offset; KnobDoublePtr centerKnob = getCenterKnob(); KnobDoublePtr offsetKnob = getOffsetKnob(); center.x = centerKnob->getValueAtTime(time, DimIdx(0)); center.y = centerKnob->getValueAtTime(time, DimIdx(1)); offset.x = offsetKnob->getValueAtTime(time, DimIdx(0)); offset.y = offsetKnob->getValueAtTime(time, DimIdx(1)); RectD roiCanonical; KnobDoublePtr swBl = getSearchWindowBottomLeftKnob(); KnobDoublePtr swTr = getSearchWindowTopRightKnob(); roiCanonical.x1 = swBl->getValueAtTime(time, DimIdx(0)) + center.x + offset.x; roiCanonical.y1 = swBl->getValueAtTime(time, DimIdx(1)) + center.y + offset.y; roiCanonical.x2 = swTr->getValueAtTime(time, DimIdx(0)) + center.x + offset.x; roiCanonical.y2 = swTr->getValueAtTime(time, DimIdx(1)) + center.y + offset.y; return roiCanonical; }