mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
finishIntervalsMatching
This commit is contained in:
parent
13c78ac7f1
commit
dc6772b566
@ -3,6 +3,7 @@ from DirectNotifyGlobal import *
|
|||||||
import EventManager
|
import EventManager
|
||||||
import Interval
|
import Interval
|
||||||
import types
|
import types
|
||||||
|
import fnmatch
|
||||||
|
|
||||||
class IntervalManager(CIntervalManager):
|
class IntervalManager(CIntervalManager):
|
||||||
|
|
||||||
@ -52,6 +53,27 @@ class IntervalManager(CIntervalManager):
|
|||||||
return self.ivals[index]
|
return self.ivals[index]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def finishIntervalsMatching(self, pattern):
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
maxIndex = self.getMaxIndex()
|
||||||
|
for index in range(maxIndex):
|
||||||
|
ival = self.getCInterval(index)
|
||||||
|
if ival and \
|
||||||
|
fnmatch.fnmatchcase(ival.getName(), pattern):
|
||||||
|
# Finish and remove this interval. Finishing it
|
||||||
|
# automatically removes it.
|
||||||
|
count += 1
|
||||||
|
if self.ivals[index]:
|
||||||
|
# Finish the python version if we have it
|
||||||
|
self.ivals[index].finish()
|
||||||
|
else:
|
||||||
|
# Otherwise, it's a C-only interval.
|
||||||
|
ival.finish()
|
||||||
|
|
||||||
|
return count
|
||||||
|
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
# This method should be called once per frame to perform all
|
# This method should be called once per frame to perform all
|
||||||
# of the per-frame processing on the active intervals.
|
# of the per-frame processing on the active intervals.
|
||||||
|
@ -244,6 +244,21 @@ get_num_intervals() const {
|
|||||||
return _name_index.size();
|
return _name_index.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: CIntervalManager::get_max_index
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns one more than the largest interval index
|
||||||
|
// number in the manager. If you walk through all the
|
||||||
|
// values between (0, get_max_index()] and call
|
||||||
|
// get_c_interval() on each number, you will retrieve
|
||||||
|
// all of the managed intervals (and possibly a number
|
||||||
|
// of NULL pointers as well).
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
int CIntervalManager::
|
||||||
|
get_max_index() const {
|
||||||
|
return _intervals.size();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: CIntervalManager::step
|
// Function: CIntervalManager::step
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -59,6 +59,7 @@ PUBLISHED:
|
|||||||
|
|
||||||
int interrupt();
|
int interrupt();
|
||||||
int get_num_intervals() const;
|
int get_num_intervals() const;
|
||||||
|
int get_max_index() const;
|
||||||
|
|
||||||
void step();
|
void step();
|
||||||
int get_next_event();
|
int get_next_event();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user