mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
add clearToInitial
This commit is contained in:
parent
711b83387a
commit
4ad4e2952e
@ -146,6 +146,15 @@ class Interval(DirectObject):
|
||||
self.privPostEvent()
|
||||
self.__removeTask()
|
||||
|
||||
def clearToInitial(self):
|
||||
# This method resets the interval's internal state to the
|
||||
# initial state, abandoning any parts of the interval that
|
||||
# have not yet been called. Calling it is like pausing the
|
||||
# interval and creating a new one in its place.
|
||||
self.pause()
|
||||
self.state = CInterval.SInitial
|
||||
self.currT = 0.0
|
||||
|
||||
def isPlaying(self):
|
||||
return taskMgr.hasTaskNamed(self.getName() + '-play')
|
||||
|
||||
@ -326,18 +335,6 @@ class Interval(DirectObject):
|
||||
# The rest of these methods are duplicates of functions defined
|
||||
# for the CInterval class via the file CInterval-extensions.py.
|
||||
|
||||
def play(self, *args, **kw):
|
||||
self.notify.error("using deprecated Interval.play() interface")
|
||||
self.start(*args, **kw)
|
||||
|
||||
def stop(self):
|
||||
self.notify.error("using deprecated Interval.stop() interface")
|
||||
self.finish()
|
||||
|
||||
def setFinalT(self):
|
||||
self.notify.error("using deprecated Interval.setFinalT() interface")
|
||||
self.finish()
|
||||
|
||||
def privPostEvent(self):
|
||||
# Call after calling any of the priv* methods to do any required
|
||||
# Python finishing steps.
|
||||
|
@ -246,6 +246,23 @@ finish() {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CInterval::clear_to_initial
|
||||
// Access: Published
|
||||
// Description: Pauses the interval, if it is playing, and resets its
|
||||
// state to its initial state, abandoning any state
|
||||
// changes already in progress in the middle of the
|
||||
// interval. Calling this is like pausing the interval
|
||||
// and discarding it, creating a new one in its place.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CInterval::
|
||||
clear_to_initial() {
|
||||
pause();
|
||||
|
||||
_state = S_initial;
|
||||
_curr_t = 0.0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CInterval::is_playing
|
||||
// Access: Published
|
||||
|
@ -94,6 +94,7 @@ PUBLISHED:
|
||||
void resume(double start_t);
|
||||
void resume_until(double end_t);
|
||||
void finish();
|
||||
void clear_to_initial();
|
||||
bool is_playing() const;
|
||||
|
||||
// These functions control the actual playback of the interval.
|
||||
|
Loading…
x
Reference in New Issue
Block a user