support setT() while interval is playing

This commit is contained in:
David Rose 2003-07-02 23:18:41 +00:00
parent 2d221eadb2
commit 1e076dadd1
2 changed files with 26 additions and 0 deletions

View File

@ -62,8 +62,19 @@ class Interval(DirectObject):
state = self.getState()
if state == CInterval.SInitial:
self.privInitialize(t)
if self.isPlaying():
self.setupResume()
elif state == CInterval.SFinal:
self.privReverseInitialize(t)
if self.isPlaying():
self.setupResume()
elif state == CInterval.SStarted:
# Support modifying t while the interval is playing. We
# assume is_playing() will be true in this state.
assert(self.isPlaying())
self.privInterrupt()
self.privStep(t)
self.setupResume()
else:
self.privStep(t)
self.privPostEvent()

View File

@ -70,10 +70,25 @@ set_t(double t) {
switch (get_state()) {
case S_initial:
priv_initialize(t);
if (is_playing()) {
setup_resume();
}
break;
case S_final:
priv_reverse_initialize(t);
if (is_playing()) {
setup_resume();
}
break;
case S_started:
// Support modifying t while the interval is playing. We assume
// is_playing() will be true in this state.
nassertv(is_playing());
priv_interrupt();
priv_step(t);
setup_resume();
break;
default: