diff --git a/include/osg/AnimationPath b/include/osg/AnimationPath index 62803356a..96814443e 100644 --- a/include/osg/AnimationPath +++ b/include/osg/AnimationPath @@ -232,6 +232,10 @@ class SG_EXPORT AnimationPathCallback : public NodeCallback void setPause(bool pause); + /** get the animation time that is used to specify the position along the AnimationPath. + * Animation time is computed from the formula ((_latestTime-_firstTime)-_timeOffset)*_timeMultiplier.*/ + double getAnimationTime() const; + /** implements the callback*/ virtual void operator()(Node* node, NodeVisitor* nv); diff --git a/src/osg/AnimationPath.cpp b/src/osg/AnimationPath.cpp index 0f3a8ccf2..0360749cd 100644 --- a/src/osg/AnimationPath.cpp +++ b/src/osg/AnimationPath.cpp @@ -168,12 +168,15 @@ void AnimationPathCallback::operator()(Node* node, NodeVisitor* nv) NodeCallback::traverse(node,nv); } +double AnimationPathCallback::getAnimationTime() const +{ + return ((_latestTime-_firstTime)-_timeOffset)*_timeMultiplier; +} + void AnimationPathCallback::update(osg::Node& node) { - double animationTime = ((_latestTime-_firstTime)-_timeOffset)*_timeMultiplier; - AnimationPath::ControlPoint cp; - if (_animationPath->getInterpolatedControlPoint(animationTime,cp)) + if (_animationPath->getInterpolatedControlPoint(getAnimationTime(),cp)) { AnimationPathCallbackVisitor apcv(cp,_useInverseMatrix); node.accept(apcv);