The duration of the effect This contains the duration of the plug-in effect, in frames.
| 393 | // The duration of the effect |
| 394 | // This contains the duration of the plug-in effect, in frames. |
| 395 | double |
| 396 | OfxImageEffectInstance::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. |
| 417 | double |
nothing calls this directly
no test coverage detected