mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
fix resume_until some more
This commit is contained in:
parent
2536db25f4
commit
27a8da21ec
@ -124,7 +124,7 @@ class IntervalManager(CIntervalManager):
|
||||
def __storeInterval(self, interval, index):
|
||||
while index >= len(self.ivals):
|
||||
self.ivals.append(None)
|
||||
assert(self.ivals[index] == None)
|
||||
assert(self.ivals[index] == None or self.ivals[index] == interval)
|
||||
self.ivals[index] = interval
|
||||
|
||||
def __repr__(self):
|
||||
|
@ -357,13 +357,18 @@ class MetaInterval(CMetaInterval):
|
||||
self.privPostEvent()
|
||||
return self.getT()
|
||||
|
||||
def resume(self, t0 = None):
|
||||
def resume(self, startT = None):
|
||||
self.__updateIvals()
|
||||
if t0 != None:
|
||||
self.setT(t0)
|
||||
if startT != None:
|
||||
self.setT(startT)
|
||||
self.setupResume()
|
||||
self.__manager.addInterval(self)
|
||||
|
||||
def resumeUntil(self, endT):
|
||||
self.__updateIvals()
|
||||
self.setupResumeUntil(endT)
|
||||
self.__manager.addInterval(self)
|
||||
|
||||
def finish(self):
|
||||
self.__updateIvals()
|
||||
state = self.getState()
|
||||
|
@ -197,17 +197,7 @@ resume(double start_t) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CInterval::
|
||||
resume_until(double end_t) {
|
||||
double duration = get_duration();
|
||||
|
||||
if (end_t < 0.0 || end_t >= duration) {
|
||||
_end_t = duration;
|
||||
_end_t_at_end = true;
|
||||
} else {
|
||||
_end_t = end_t;
|
||||
_end_t_at_end = false;
|
||||
}
|
||||
|
||||
setup_resume();
|
||||
setup_resume_until(end_t);
|
||||
_manager->add_c_interval(this, false);
|
||||
}
|
||||
|
||||
@ -517,6 +507,29 @@ setup_resume() {
|
||||
_loop_count = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CInterval::setup_resume_until
|
||||
// Access: Published
|
||||
// Description: Called to prepare the interval for restarting from
|
||||
// the current point after a previous call to pause()
|
||||
// (or a previous play-to-point-and-stop), to play until
|
||||
// the indicated point and then stop.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CInterval::
|
||||
setup_resume_until(double end_t) {
|
||||
double duration = get_duration();
|
||||
|
||||
if (end_t < 0.0 || end_t >= duration) {
|
||||
_end_t = duration;
|
||||
_end_t_at_end = true;
|
||||
} else {
|
||||
_end_t = end_t;
|
||||
_end_t_at_end = false;
|
||||
}
|
||||
|
||||
setup_resume();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CInterval::step_play
|
||||
// Access: Published
|
||||
|
@ -119,6 +119,7 @@ PUBLISHED:
|
||||
void setup_play(double start_time, double end_time, double play_rate,
|
||||
bool do_loop);
|
||||
void setup_resume();
|
||||
void setup_resume_until(double end_t);
|
||||
bool step_play();
|
||||
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user