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:
parent
1f0637fdd7
commit
e39bb04c62
@ -185,6 +185,9 @@ class OSG_EXPORT Sequence : public Group
|
|||||||
// stopping when it gets to zero. init to 0
|
// stopping when it gets to zero. init to 0
|
||||||
int _nreps, _nrepsRemain;
|
int _nreps, _nrepsRemain;
|
||||||
|
|
||||||
|
// frame step (are we stepping forward or backward?)
|
||||||
|
int _step;
|
||||||
|
|
||||||
// default frame time for newly created frames or children- default is 1.
|
// default frame time for newly created frames or children- default is 1.
|
||||||
// set by setDefaultTime
|
// set by setDefaultTime
|
||||||
double _defaultTime ;
|
double _defaultTime ;
|
||||||
|
@ -32,6 +32,7 @@ Sequence::Sequence() :
|
|||||||
_speed(0),
|
_speed(0),
|
||||||
_nreps(-1),
|
_nreps(-1),
|
||||||
_nrepsRemain(0),
|
_nrepsRemain(0),
|
||||||
|
_step(0),
|
||||||
_defaultTime(1.),
|
_defaultTime(1.),
|
||||||
_lastFrameTime(0.),
|
_lastFrameTime(0.),
|
||||||
_saveRealLastFrameTime(-1.),
|
_saveRealLastFrameTime(-1.),
|
||||||
@ -57,6 +58,7 @@ Sequence::Sequence(const Sequence& seq, const CopyOp& copyop) :
|
|||||||
_speed(seq._speed),
|
_speed(seq._speed),
|
||||||
_nreps(seq._nreps),
|
_nreps(seq._nreps),
|
||||||
_nrepsRemain(seq._nrepsRemain),
|
_nrepsRemain(seq._nrepsRemain),
|
||||||
|
_step(seq._step),
|
||||||
_defaultTime(seq._defaultTime),
|
_defaultTime(seq._defaultTime),
|
||||||
_lastFrameTime(seq._lastFrameTime),
|
_lastFrameTime(seq._lastFrameTime),
|
||||||
_saveRealLastFrameTime(seq._saveRealLastFrameTime),
|
_saveRealLastFrameTime(seq._saveRealLastFrameTime),
|
||||||
@ -174,11 +176,19 @@ void Sequence::setDuration(float speed, int nreps)
|
|||||||
|
|
||||||
void Sequence::setMode(SequenceMode mode)
|
void Sequence::setMode(SequenceMode mode)
|
||||||
{
|
{
|
||||||
|
int ubegin, uend;
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case START:
|
case START:
|
||||||
// restarts sequence from beginning
|
// restarts sequence from beginning
|
||||||
_value = -1;
|
_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;
|
_start = _now;
|
||||||
_mode = mode;
|
_mode = mode;
|
||||||
if (_saveRealLastFrameTime>=0.)
|
if (_saveRealLastFrameTime>=0.)
|
||||||
@ -221,11 +231,6 @@ void Sequence::traverse(NodeVisitor& nv)
|
|||||||
int _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin);
|
int _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin);
|
||||||
int _uend = (_end < 0 ? (int)_frameTime.size()-1: _end);
|
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 _sbegin = osg::minimum(_ubegin,_uend);
|
||||||
int _send = osg::maximum(_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 _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin);
|
||||||
int _uend = (_end < 0 ? (int)_frameTime.size()-1: _end);
|
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 _sbegin = osg::minimum(_ubegin,_uend);
|
||||||
int _send = osg::maximum(_ubegin,_uend);
|
int _send = osg::maximum(_ubegin,_uend);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user