diff --git a/panda/src/putil/clockObject.I b/panda/src/putil/clockObject.I index 26a00315a5..df3fde9695 100644 --- a/panda/src/putil/clockObject.I +++ b/panda/src/putil/clockObject.I @@ -146,23 +146,6 @@ get_dt(Thread *current_thread) const { return cdata->_dt; } -//////////////////////////////////////////////////////////////////// -// Function: ClockObject::set_dt -// Access: Published -// Description: In non-real-time mode, sets the number of seconds -// that should appear to elapse between frames. In -// forced mode or limited mode, sets our target dt. In -// normal mode, this has no effect. -// -// Also see set_frame_rate(), which is a different way -// to specify the same quantity. -//////////////////////////////////////////////////////////////////// -INLINE void ClockObject:: -set_dt(double dt) { - nassertv(dt != 0.0); - set_frame_rate(1.0 / dt); -} - //////////////////////////////////////////////////////////////////// // Function: ClockObject::get_max_dt // Access: Published diff --git a/panda/src/putil/clockObject.cxx b/panda/src/putil/clockObject.cxx index 437d4e55dc..2c5f71d0a5 100644 --- a/panda/src/putil/clockObject.cxx +++ b/panda/src/putil/clockObject.cxx @@ -224,6 +224,34 @@ set_frame_count(int frame_count, Thread *current_thread) { cdata->_frame_count / _user_frame_rate; } +//////////////////////////////////////////////////////////////////// +// Function: ClockObject::set_dt +// Access: Published +// Description: In non-real-time mode, sets the number of seconds +// that should appear to elapse between frames. In +// forced mode or limited mode, sets our target dt. In +// normal mode, this has no effect. +// +// Also see set_frame_rate(), which is a different way +// to specify the same quantity. +//////////////////////////////////////////////////////////////////// +void ClockObject:: +set_dt(double dt) { + if (_mode == M_slave) { + // In M_slave mode, we can set any dt we like. + CDWriter cdata(_cycler, Thread::get_current_thread()); + cdata->_dt = dt; + if (dt != 0.0) { + set_frame_rate(1.0 / dt); + } + + } else { + // In any other mode, we can only set non-zero dt. + nassertv(dt != 0.0); + set_frame_rate(1.0 / dt); + } +} + //////////////////////////////////////////////////////////////////// // Function: ClockObject::set_frame_rate // Access: Published diff --git a/panda/src/putil/clockObject.h b/panda/src/putil/clockObject.h index cf8b39d8b2..262fe37320 100644 --- a/panda/src/putil/clockObject.h +++ b/panda/src/putil/clockObject.h @@ -94,7 +94,7 @@ PUBLISHED: INLINE double get_net_frame_rate(Thread *current_thread = Thread::get_current_thread()) const; INLINE double get_dt(Thread *current_thread = Thread::get_current_thread()) const; - INLINE void set_dt(double dt); + void set_dt(double dt); void set_frame_rate(double frame_rate); INLINE double get_max_dt() const;