From Jean-Sebastien Guay, "When using osg::Sequence you can stop the sequence by setting the mode

to STOP. Subsequently, you can restart it from the beginning by
setting the mode to START. This does not work as expected. The _now
time is not updated while the mode is STOP, which causes the items in
the sequence to flash by very quickly when the mode is set to START.

For example, if the mode was set to STOP and left that way for 30
seconds, and there are 10 items in the sequence, when the mode is set
to START all the items will flash by (in 3 loops) while the _now time
catches up with the real time, and then the sequence will go on at the
rate it should.

This is a simple fix for that, which updates the _now time regardless
of the mode the sequence is in."
This commit is contained in:
Robert Osfield
2007-12-21 13:18:13 +00:00
parent cf1a30841a
commit 9ae1ffe13b

View File

@@ -205,6 +205,13 @@ void Sequence::traverse(NodeVisitor& nv)
{
if (getNumChildren()==0) return;
const FrameStamp* framestamp = nv.getFrameStamp();
if (framestamp)
{
_now = framestamp->getSimulationTime();
}
if (nv.getVisitorType()==NodeVisitor::UPDATE_VISITOR &&
_mode == START &&
!_frameTime.empty() && getNumChildren()!=0)
@@ -222,12 +229,8 @@ void Sequence::traverse(NodeVisitor& nv)
int _sbegin = osg::minimum(_ubegin,_uend);
int _send = osg::maximum(_ubegin,_uend);
const FrameStamp* framestamp = nv.getFrameStamp();
if (framestamp)
{
_now = framestamp->getSimulationTime();
// hack for last frame time
if (_lastFrameTime>0. && _nrepsRemain==1 && _saveRealLastFrameTime<0.)
{