MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / getEffectDuration

Method getEffectDuration

Engine/OfxImageEffectInstance.cpp:395–414  ·  view source on GitHub ↗

The duration of the effect This contains the duration of the plug-in effect, in frames.

Source from the content-addressed store, hash-verified

393// The duration of the effect
394// This contains the duration of the plug-in effect, in frames.
395double
396OfxImageEffectInstance::getEffectDuration() const
397{
398 assert( getOfxEffectInstance() );
399 NodePtr node = getOfxEffectInstance()->getNode();
400 if (!node) {
401 return 0;
402 }
403 int firstFrame, lastFrame;
404 bool lifetimeEnabled = node->isLifetimeActivated(&firstFrame, &lastFrame);
405 if (lifetimeEnabled) {
406 return std::max(double(lastFrame - firstFrame) + 1., 1.);
407 } else {
408 // return the project duration if the effect has no lifetime
409 double projFirstFrame, projLastFrame;
410 node->getApp()->getProject()->getFrameRange(&projFirstFrame, &projLastFrame);
411
412 return std::max(projLastFrame - projFirstFrame + 1., 1.);
413 }
414}
415
416// For an instance, this is the frame rate of the project the effect is in.
417double

Callers

nothing calls this directly

Calls 7

getOfxEffectInstanceFunction · 0.85
maxFunction · 0.85
isLifetimeActivatedMethod · 0.80
getProjectMethod · 0.80
getNodeMethod · 0.45
getFrameRangeMethod · 0.45
getAppMethod · 0.45

Tested by

no test coverage detected