From c3f3093ecc8ca055ae6fc093db3d9b023d6e2217 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 10 Nov 2006 15:25:04 +0000 Subject: [PATCH] From John Kelso, add support for default frame time for children of a Sequence node --- include/osg/Sequence | 8 ++++++++ src/osg/Sequence.cpp | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/osg/Sequence b/include/osg/Sequence index 3a61e8fef..2e1cb02f5 100644 --- a/include/osg/Sequence +++ b/include/osg/Sequence @@ -44,6 +44,12 @@ public : /** Get time for child. */ float getTime(int frame) const; + /** Set default time in seconds for new child. */ + void setDefaultTime(float t) {_defaultTime = t;} + + /** Get default time in seconds for new child. */ + float getDefaultTime(void) const {return _defaultTime;}; + /** Get number of frames */ inline unsigned int getNumFrames() const { return _frameTime.size(); } @@ -107,6 +113,8 @@ protected : float _speed; int _nreps, _nrepsremain; + float _defaultTime ; + SequenceMode _mode; }; diff --git a/src/osg/Sequence.cpp b/src/osg/Sequence.cpp index d99596f0d..aa914eaac 100644 --- a/src/osg/Sequence.cpp +++ b/src/osg/Sequence.cpp @@ -30,6 +30,7 @@ Sequence::Sequence() : _speed(0), _nreps(0), _nrepsremain(0), + _defaultTime(1.f), _mode(STOP) { setNumChildrenRequiringUpdateTraversal(1); @@ -47,6 +48,7 @@ Sequence::Sequence(const Sequence& seq, const CopyOp& copyop) : _speed(seq._speed), _nreps(seq._nreps), _nrepsremain(seq._nrepsremain), + _defaultTime(seq._defaultTime), _mode(seq._mode) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); @@ -144,7 +146,7 @@ void Sequence::traverse(NodeVisitor& nv) // default timeout for unset values if (sw >= (int) _frameTime.size()) { - setTime(sw, 1.0f); + setTime(sw, _defaultTime); } // frame time-out?