From 9ae1ffe13b095da445677e6423983e9440da2baf Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 21 Dec 2007 13:18:13 +0000 Subject: [PATCH] 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." --- src/osg/Sequence.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/osg/Sequence.cpp b/src/osg/Sequence.cpp index bc8bc74bc..dd53c4863 100644 --- a/src/osg/Sequence.cpp +++ b/src/osg/Sequence.cpp @@ -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.) {