From Jason Daly, "I'm still having a problem with SWING animations on sequences. Here's

the fix again, merged with this morning's svn (including the other
Sequence fixes from J-S)."
This commit is contained in:
Robert Osfield
2007-12-24 14:45:31 +00:00
parent 1f0637fdd7
commit e39bb04c62
2 changed files with 13 additions and 10 deletions

View File

@@ -32,6 +32,7 @@ Sequence::Sequence() :
_speed(0),
_nreps(-1),
_nrepsRemain(0),
_step(0),
_defaultTime(1.),
_lastFrameTime(0.),
_saveRealLastFrameTime(-1.),
@@ -57,6 +58,7 @@ Sequence::Sequence(const Sequence& seq, const CopyOp& copyop) :
_speed(seq._speed),
_nreps(seq._nreps),
_nrepsRemain(seq._nrepsRemain),
_step(seq._step),
_defaultTime(seq._defaultTime),
_lastFrameTime(seq._lastFrameTime),
_saveRealLastFrameTime(seq._saveRealLastFrameTime),
@@ -174,11 +176,19 @@ void Sequence::setDuration(float speed, int nreps)
void Sequence::setMode(SequenceMode mode)
{
int ubegin, uend;
switch (mode)
{
case START:
// restarts sequence from beginning
_value = -1;
// Figure out which direction to start stepping the sequence
ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin);
uend = (_end < 0 ? (int)_frameTime.size()-1: _end);
_step = (ubegin > uend ? -1 : 1);
_start = _now;
_mode = mode;
if (_saveRealLastFrameTime>=0.)
@@ -221,11 +231,6 @@ void Sequence::traverse(NodeVisitor& nv)
int _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin);
int _uend = (_end < 0 ? (int)_frameTime.size()-1: _end);
// are we stepping forward or backward?
int _step;
_step = (_ubegin < _uend ? 1 : -1);
_step = (_speed <0. ? -_step : _step);
int _sbegin = osg::minimum(_ubegin,_uend);
int _send = osg::maximum(_ubegin,_uend);
@@ -394,11 +399,6 @@ int Sequence::_getNextValue()
int _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin);
int _uend = (_end < 0 ? (int)_frameTime.size()-1: _end);
// are we stepping forward or backward?
int _step;
_step = (_ubegin < _uend ? 1 : -1);
_step = (_speed <0. ? -_step : _step);
int _sbegin = osg::minimum(_ubegin,_uend);
int _send = osg::maximum(_ubegin,_uend);