#include <cMetaInterval.h>
Inheritance diagram for CMetaInterval:
Public Types | |
enum | RelativeStart { RS_previous_end, RS_previous_begin, RS_level_begin } |
enum | DefType { DT_c_interval, DT_ext_index, DT_push_level, DT_pop_level } |
enum | EventType { ET_initialize, ET_instant, ET_step, ET_finalize, ET_reverse_initialize, ET_reverse_instant, ET_reverse_finalize, ET_interrupt } |
enum | State { S_initial, S_started, S_paused, S_final } |
Public Member Functions | |
CMetaInterval (const string &name) | |
virtual | ~CMetaInterval () |
void | set_precision (double precision) |
Indicates the precision with which time measurements are compared. | |
double | get_precision () const |
Returns the precision with which time measurements are compared. | |
void | clear_intervals () |
Resets the list of intervals and prepares for receiving a new list. | |
int | push_level (const string &name, double rel_time, RelativeStart rel_to) |
Marks the beginning of a nested level of child intervals. | |
int | add_c_interval (CInterval *c_interval, double rel_time, RelativeStart rel_to) |
Adds a new CInterval to the list. | |
int | add_ext_index (int ext_index, const string &name, double duration, bool open_ended, double rel_time, RelativeStart rel_to) |
Adds a new external interval to the list. | |
int | pop_level (double duration=-1.0) |
Finishes a level marked by a previous call to push_level(), and returns to the previous level. | |
bool | set_interval_start_time (const string &name, double rel_time, RelativeStart rel_to=RS_level_begin) |
Adjusts the start time of the child interval with the given name, if found. | |
double | get_interval_start_time (const string &name) const |
Returns the actual start time, relative to the beginning of the interval, of the child interval with the given name, if found, or -1 if the interval is not found. | |
double | get_interval_end_time (const string &name) const |
Returns the actual end time, relative to the beginning of the interval, of the child interval with the given name, if found, or -1 if the interval is not found. | |
int | get_num_defs () const |
Returns the number of interval and push/pop definitions that have been added to the meta interval. | |
DefType | get_def_type (int n) const |
Returns the type of the nth interval definition that has been added. | |
CInterval * | get_c_interval (int n) const |
Return the CInterval pointer associated with the nth interval definition. | |
int | get_ext_index (int n) const |
Return the external interval index number associated with the nth interval definition. | |
virtual void | priv_initialize (double t) |
This replaces the first call to priv_step(), and indicates that the interval has just begun. | |
virtual void | priv_instant () |
This is called in lieu of priv_initialize() .. | |
virtual void | priv_step (double t) |
Advances the time on the interval. | |
virtual void | priv_finalize () |
This is called when an interval is interrupted. | |
virtual void | priv_reverse_initialize (double t) |
Similar to priv_initialize(), but this is called when the interval is being played backwards; it indicates that the interval should start at the finishing state and undo any intervening intervals. | |
virtual void | priv_reverse_instant () |
This is called in lieu of priv_reverse_initialize() .. | |
virtual void | priv_reverse_finalize () |
Called generally following a priv_reverse_initialize(), this indicates the interval should set itself to the initial state. | |
virtual void | priv_interrupt () |
This is called while the interval is playing to indicate that it is about to be interrupted; that is, priv_step() will not be called for a length of time. | |
bool | is_event_ready () |
Returns true if a recent call to priv_initialize(), priv_step(), or priv_finalize() has left some external intervals ready to play. | |
int | get_event_index () const |
If a previous call to is_event_ready() returned true, this returns the index number (added via add_event_index()) of the external interval that needs to be played. | |
double | get_event_t () const |
If a previous call to is_event_ready() returned true, this returns the t value that should be fed to the given interval. | |
EventType | get_event_type () const |
If a previous call to is_event_ready() returned true, this returns the type of the event (initialize, step, finalize, etc.) for the given interval. | |
void | pop_event () |
Acknowledges that the external interval on the top of the queue has been extracted, and is about to be serviced by the scripting language. | |
virtual void | write (ostream &out, int indent_level) const |
void | timeline (ostream &out) const |
Outputs a list of all events in the order in which they occur. | |
virtual TypeHandle | get_type () const |
virtual TypeHandle | force_init_type () |
const string & | get_name () const |
Returns the interval's name. | |
double | get_duration () const |
Returns the duration of the interval in seconds. | |
bool | get_open_ended () const |
Returns the state of the "open_ended" flag. | |
State | get_state () const |
Indicates the state the interval believes it is in: whether it has been started, is currently in the middle, or has been finalized. | |
bool | is_stopped () const |
Returns true if the interval is in either its initial or final states (but not in a running or paused state). | |
void | set_done_event (const string &event) |
Sets the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own. | |
const string & | get_done_event () const |
Returns the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own. | |
void | set_t (double t) |
Explicitly sets the time within the interval. | |
double | get_t () const |
Returns the current time of the interval: the last value of t passed to priv_initialize(), priv_step(), or priv_finalize(). | |
void | set_auto_pause (bool auto_pause) |
Changes the state of the 'auto_pause' flag. | |
bool | get_auto_pause () const |
Returns the state of the 'auto_pause' flag. | |
void | set_auto_finish (bool auto_finish) |
Changes the state of the 'auto_finish' flag. | |
bool | get_auto_finish () const |
Returns the state of the 'auto_finish' flag. | |
void | set_wants_t_callback (bool wants_t_callback) |
Changes the state of the 'wants_t_callback' flag. | |
bool | get_wants_t_callback () const |
Returns the state of the 'wants_t_callback' flag. | |
void | set_manager (CIntervalManager *manager) |
Indicates the CIntervalManager object which will be responsible for playing this interval. | |
CIntervalManager * | get_manager () const |
Returns the CIntervalManager object which will be responsible for playing this interval. | |
void | start (double start_t=0.0, double end_t=-1.0, double play_rate=1.0) |
Starts the interval playing by registering it with the current CIntervalManager. | |
void | loop (double start_t=0.0, double end_t=-1.0, double play_rate=1.0) |
Starts the interval playing by registering it with the current CIntervalManager. | |
double | pause () |
Stops the interval from playing but leaves it in its current state. | |
void | resume () |
Restarts the interval from its current point after a previous call to pause(). | |
void | resume (double start_t) |
Restarts the interval from the indicated point after a previous call to pause(). | |
void | finish () |
Stops the interval from playing and sets it to its final state. | |
bool | is_playing () const |
Returns true if the interval is currently playing, false otherwise. | |
void | priv_do_event (double t, EventType event) |
Calls the appropriate event function indicated by the EventType. | |
virtual void | output (ostream &out) const |
void | setup_play (double start_time, double end_time, double play_rate, bool do_loop) |
Called to prepare the interval for automatic timed playback, e.g. | |
void | setup_resume () |
Called to prepare the interval for restarting at the current point within the interval after an interruption. | |
bool | step_play () |
Should be called once per frame to execute the automatic timed playback begun with setup_play(). | |
void | mark_dirty () |
Called by a derived class to indicate the interval has been changed internally and must be recomputed before its duration may be returned. | |
bool | check_t_callback () |
Returns true if the wants_t_callback() flag is true and the interval's t value has changed since the last call to check_t_callback(), false otherwise. | |
int | get_type_index () const |
bool | is_of_type (TypeHandle handle) const |
bool | is_exact_type (TypeHandle handle) const |
int | get_ref_count () const |
int | ref () const |
int | unref () const |
void | test_ref_count_integrity () const |
Static Public Member Functions | |
TypeHandle | get_class_type () |
void | init_type () |
Protected Member Functions | |
virtual void | do_recompute () |
Recomputes all of the events (and the duration) according to the set of interval defs. | |
void | interval_done () |
Called internally whenever the interval reaches its final state. | |
void | recompute () const |
Calls do_recompute() if the dirty flag has been set. | |
void | check_stopped (TypeHandle type, const char *method_name) const |
Issues a warning if our internal state is not in one of the stopped states. | |
void | check_started (TypeHandle type, const char *method_name) const |
Issues a warning if our internal state is not in one of the started states. | |
Protected Attributes | |
State | _state |
double | _curr_t |
string | _name |
string | _done_event |
double | _duration |
bool | _auto_pause |
bool | _auto_finish |
bool | _wants_t_callback |
double | _last_t_callback |
CIntervalManager * | _manager |
double | _clock_start |
double | _start_t |
double | _end_t |
bool | _end_t_at_end |
bool | _start_t_at_start |
double | _play_rate |
bool | _do_loop |
int | _loop_count |
int | _ref_count |
Private Types | |
typedef pvector< IntervalDef > | Defs |
typedef pvector< PlaybackEvent * > | PlaybackEvents |
typedef plist< PlaybackEvent * > | ActiveEvents |
typedef pdeque< EventQueueEntry > | EventQueue |
enum | PlaybackEventType { PET_begin, PET_end, PET_instant } |
Private Member Functions | |
int | double_to_int_time (double t) const |
Converts from an external double time value or offset in seconds to an internal integer value or offset. | |
double | int_to_double_time (int time) const |
Converts from an internal integer time value or offset to an external double time value or offset in seconds. | |
void | clear_events () |
Removes all entries from the _events list. | |
void | do_event_forward (PlaybackEvent *event, ActiveEvents &new_active, bool is_initial) |
Process a single event in the interval, moving forwards in time. | |
void | finish_events_forward (int now, ActiveEvents &new_active) |
After walking through the event list and adding a bunch of new events to new_active, finished up by calling priv_step() on all of the events still in _active and priv_initialize() on all the events in new_active, then copying the events from new_active to active. | |
void | do_event_reverse (PlaybackEvent *event, ActiveEvents &new_active, bool is_initial) |
Process a single event in the interval, moving backwards in time. | |
void | finish_events_reverse (int now, ActiveEvents &new_active) |
After walking through the event list and adding a bunch of new events to new_active, finishes up by calling priv_step() on all of the events still in _active and priv_reverse_initialize() on all the events in new_active, then copying the events from new_active to active. | |
void | enqueue_event (int n, CInterval::EventType event_type, bool is_initial, int time=0) |
Enqueues the indicated interval for invocation after we have finished scanning for events that need processing this frame. | |
void | enqueue_self_event (CInterval::EventType event_type, double t=0.0) |
Enqueues a reference to *this* interval. | |
void | enqueue_done_event () |
Enqueues a special "event" that simply marks the end of processing of the interval; the interval's done event should be thrown now, if it is defined. | |
bool | service_event_queue () |
Invokes whatever C++ intervals might be at the head of the queue, and prepares for passing an external interval to the scripting language. | |
int | recompute_level (int n, int level_begin, int &level_end) |
Recursively recomputes a complete level (delimited by push/pop definitions). | |
int | get_begin_time (const IntervalDef &def, int level_begin, int previous_begin, int previous_end) |
Returns the integer begin time indicated by the given IntervalDef, given the indicated level begin, previous begin, and previous end times. | |
void | write_event_desc (ostream &out, const IntervalDef &def, int &extra_indent_level) const |
Formats an event for output, for write() or timeline(). | |
Private Attributes | |
double | _precision |
Defs | _defs |
int | _current_nesting_level |
PlaybackEvents | _events |
ActiveEvents | _active |
int | _end_time |
size_t | _next_event_index |
bool | _processing_events |
EventQueue | _event_queue |
Static Private Attributes | |
TypeHandle | _type_handle |
Some of them may overlap and some of them may not.
Definition at line 46 of file cMetaInterval.h.
|
Definition at line 151 of file cMetaInterval.h. |
|
Definition at line 146 of file cMetaInterval.h. |
|
Definition at line 152 of file cMetaInterval.h. |
|
Definition at line 147 of file cMetaInterval.h. |
|
Definition at line 75 of file cMetaInterval.h. Referenced by get_precision(). |
|
Definition at line 66 of file cInterval.h. |
|
Definition at line 122 of file cMetaInterval.h. |
|
Definition at line 51 of file cMetaInterval.h. |
|
Definition at line 77 of file cInterval.h. |
|
Definition at line 43 of file cMetaInterval.cxx. References _processing_events. |
|
Definition at line 61 of file cMetaInterval.cxx. References _event_queue, and clear_events(). |
|
Adds a new CInterval to the list. The interval will be played when the indicated time (relative to the given point) has been reached. The return value is the index of the def entry representing the new interval. Definition at line 172 of file cMetaInterval.cxx. References _defs, _event_queue, CMetaInterval::IntervalDef::_ext_duration, CMetaInterval::IntervalDef::_ext_index, CMetaInterval::IntervalDef::_ext_name, CMetaInterval::IntervalDef::_ext_open_ended, _processing_events, CMetaInterval::IntervalDef::_rel_time, CMetaInterval::IntervalDef::_rel_to, CMetaInterval::IntervalDef::_type, DT_ext_index, CInterval::mark_dirty(), and nassertr. |
|
Adds a new external interval to the list. This represents some object in the external scripting language that has properties similar to a CInterval (for instance, a Python Interval object). The CMetaInterval object cannot play this external interval directly, but it records a placeholder for it and will ask the scripting language to play it when it is time, via is_event_ready() and related methods. The ext_index number itself is simply a handle that the scripting language makes up and associates with its interval object somehow. The CMetaInterval object does not attempt to interpret this value. The return value is the index of the def entry representing the new interval. Definition at line 232 of file cMetaInterval.cxx. References CMetaInterval::IntervalDef::_c_interval, _defs, _event_queue, CMetaInterval::IntervalDef::_ext_name, _processing_events, CMetaInterval::IntervalDef::_rel_time, CMetaInterval::IntervalDef::_rel_to, CMetaInterval::IntervalDef::_type, DT_c_interval, DT_ext_index, CInterval::mark_dirty(), and nassertr. |
|
Issues a warning if our internal state is not in one of the started states.
Definition at line 392 of file cInterval.I. Referenced by priv_initialize(), and CInterval::priv_step(). |
|
Issues a warning if our internal state is not in one of the stopped states.
Definition at line 372 of file cInterval.I. Referenced by get_interval_end_time(), CInterval::is_playing(), CInterval::priv_do_event(), CInterval::priv_initialize(), ShowInterval::priv_instant(), HideInterval::priv_instant(), and priv_step(). |
|
Returns true if the wants_t_callback() flag is true and the interval's t value has changed since the last call to check_t_callback(), false otherwise.
Definition at line 338 of file cInterval.I. |
|
Removes all entries from the _events list.
Definition at line 1007 of file cMetaInterval.cxx. References _active, CMetaInterval::PlaybackEvent::_n, CMetaInterval::PlaybackEvent::_time, enqueue_event(), CInterval::ET_reverse_initialize, and CInterval::ET_step. Referenced by ~CMetaInterval(). |
|
Resets the list of intervals and prepares for receiving a new list.
Definition at line 76 of file cMetaInterval.cxx. |
|
Process a single event in the interval, moving forwards in time. If the event represents a new begin, adds it to the new_active list; if it is an end, finalizes it. If is_initial is true, it is as if we are in initialize or finalize: instant events will be invoked only if they are marked open_ended. Definition at line 1040 of file cMetaInterval.cxx. References CMetaInterval::IntervalDef::_c_interval, _defs, _event_queue, CMetaInterval::IntervalDef::_ext_open_ended, CMetaInterval::IntervalDef::_type, DT_c_interval, DT_ext_index, CInterval::ET_instant, CInterval::ET_reverse_instant, int_to_double_time(), and nassertv. Referenced by priv_initialize(), and priv_instant(). |
|
Process a single event in the interval, moving backwards in time. This undoes the indicated event. If the event represents a new begin, adds it to the new_active list; if it is an end, finalizes it. If is_initial is true, it is as if we are in reverse_initialize or reverse_finalize: instant events will be invoked only if they are marked open_ended. Definition at line 1142 of file cMetaInterval.cxx. References CMetaInterval::IntervalDef::_c_interval, _defs, DT_c_interval, DT_ext_index, int_to_double_time(), and nassertr. Referenced by priv_initialize(), and priv_step(). |
|
Recomputes all of the events (and the duration) according to the set of interval defs.
Reimplemented from CInterval. Definition at line 980 of file cMetaInterval.cxx. |
|
Converts from an external double time value or offset in seconds to an internal integer value or offset.
Definition at line 228 of file cMetaInterval.I. Referenced by priv_initialize(), priv_instant(), and priv_step(). |
|
Enqueues a special "event" that simply marks the end of processing of the interval; the interval's done event should be thrown now, if it is defined.
Definition at line 1336 of file cMetaInterval.cxx. Referenced by get_interval_end_time(), and priv_instant(). |
|
Enqueues the indicated interval for invocation after we have finished scanning for events that need processing this frame. is_initial is only relevant for event types ET_instant or ET_reverse_instant, and indicates whether we are in the priv_initialize() (or priv_reverse_initialize()) call, and should therefore only invoke open-ended intervals. time is only relevant for ET_initialize, ET_reverse_initialize, and ET_step. Definition at line 1254 of file cMetaInterval.cxx. Referenced by clear_events(), and get_interval_end_time(). |
|
Enqueues a reference to *this* interval. This is called only when the interval is recursively re-entered; the request will be serviced when the current request is done processing. time is only relevant for ET_initialize, ET_reverse_initialize, and ET_step. Definition at line 1316 of file cMetaInterval.cxx. References DT_pop_level, and DT_push_level. Referenced by get_interval_end_time(), priv_initialize(), priv_instant(), and priv_step(). |
|
Stops the interval from playing and sets it to its final state.
Definition at line 216 of file cInterval.cxx. References CInterval::ET_finalize, CInterval::ET_interrupt, CInterval::ET_reverse_finalize, CInterval::ET_reverse_initialize, CInterval::ET_reverse_instant, and CInterval::ET_step. |
|
After walking through the event list and adding a bunch of new events to new_active, finished up by calling priv_step() on all of the events still in _active and priv_initialize() on all the events in new_active, then copying the events from new_active to active.
Definition at line 1101 of file cMetaInterval.cxx. References _event_queue. Referenced by priv_initialize(), and priv_instant(). |
|
After walking through the event list and adding a bunch of new events to new_active, finishes up by calling priv_step() on all of the events still in _active and priv_reverse_initialize() on all the events in new_active, then copying the events from new_active to active.
Definition at line 1207 of file cMetaInterval.cxx. References _events. Referenced by priv_initialize(), and priv_step(). |
|
Reimplemented from CInterval. Definition at line 210 of file cMetaInterval.h. |
|
Returns the state of the 'auto_finish' flag. See set_auto_finish(). Definition at line 240 of file cInterval.I. |
|
Returns the state of the 'auto_pause' flag. See set_auto_pause(). Definition at line 200 of file cInterval.I. References CInterval::_manager, and INLINE. |
|
Returns the integer begin time indicated by the given IntervalDef, given the indicated level begin, previous begin, and previous end times.
Definition at line 1521 of file cMetaInterval.cxx. |
|
Return the CInterval pointer associated with the nth interval definition. It is only valid to call this if get_def_type(n) returns DT_c_interval. Definition at line 112 of file cMetaInterval.I. |
|
Reimplemented from CInterval. Definition at line 199 of file cMetaInterval.h. References CInterval::get_class_type(). Referenced by get_interval_end_time(), priv_initialize(), and priv_step(). |
|
Returns the type of the nth interval definition that has been added.
Definition at line 94 of file cMetaInterval.I. References _defs, DT_ext_index, INLINE, and nassertr. |
|
Returns the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own.
Definition at line 143 of file cInterval.I. References CInterval::_auto_pause. |
|
Returns the duration of the interval in seconds.
Definition at line 45 of file cInterval.I. References CInterval::_open_ended, and INLINE. Referenced by get_interval_end_time(), CInterval::priv_do_event(), CInterval::priv_finalize(), priv_instant(), CInterval::priv_interrupt(), and CInterval::priv_reverse_initialize(). |
|
If a previous call to is_event_ready() returned true, this returns the index number (added via add_event_index()) of the external interval that needs to be played.
Definition at line 173 of file cMetaInterval.I. References _precision, and INLINE. |
|
If a previous call to is_event_ready() returned true, this returns the t value that should be fed to the given interval.
Definition at line 194 of file cMetaInterval.I. |
|
If a previous call to is_event_ready() returned true, this returns the type of the event (initialize, step, finalize, etc.) for the given interval.
Definition at line 212 of file cMetaInterval.I. References INLINE. |
|
Return the external interval index number associated with the nth interval definition. It is only valid to call this if get_def_type(n) returns DT_ext_index. Definition at line 131 of file cMetaInterval.I. References _event_queue, INLINE, int_to_double_time(), and nassertr. |
|
Returns the actual end time, relative to the beginning of the interval, of the child interval with the given name, if found, or -1 if the interval is not found.
Definition at line 407 of file cMetaInterval.cxx. References _active, CInterval::_curr_t, _event_queue, _events, CMetaInterval::PlaybackEvent::_n, _next_event_index, _processing_events, CInterval::_state, CMetaInterval::PlaybackEvent::_type, CInterval::check_stopped(), enqueue_done_event(), enqueue_event(), enqueue_self_event(), CInterval::ET_instant, get_class_type(), CInterval::get_duration(), CInterval::interval_done(), PET_begin, CInterval::recompute(), and CInterval::S_final. |
|
Returns the actual start time, relative to the beginning of the interval, of the child interval with the given name, if found, or -1 if the interval is not found.
Definition at line 364 of file cMetaInterval.cxx. |
|
Returns the CIntervalManager object which will be responsible for playing this interval. Note that this can only return a C++ object; if the particular CIntervalManager object has been extended in the scripting language, this will return the encapsulated C++ object, not the full extended object. Definition at line 321 of file cInterval.I. |
|
Returns the interval's name.
Definition at line 32 of file cInterval.I. References CInterval::_duration, INLINE, and CInterval::recompute(). Referenced by CInterval::get_wants_t_callback(), CInterval::priv_finalize(), priv_reverse_instant(), CInterval::set_wants_t_callback(), and CIntervalManager::~CIntervalManager(). |
|
Returns the number of interval and push/pop definitions that have been added to the meta interval.
Definition at line 79 of file cMetaInterval.I. References _defs, DT_c_interval, INLINE, nassertr, and NULL. |
|
Returns the state of the "open_ended" flag. This is primarily intended for instantaneous intervals like FunctionIntervals; it indicates true if the interval has some lasting effect that should be applied even if the interval doesn't get started until after its finish time, or false if the interval is a transitive thing that doesn't need to be called late. Definition at line 71 of file cInterval.I. References CInterval::_state, INLINE, CInterval::S_final, and CInterval::S_initial. Referenced by CInterval::setup_play(). |
|
Returns the precision with which time measurements are compared. See set_precision(). Definition at line 62 of file cMetaInterval.I. References _defs, DefType, DT_c_interval, INLINE, and nassertr. |
|
Indicates the state the interval believes it is in: whether it has been started, is currently in the middle, or has been finalized.
Definition at line 88 of file cInterval.I. References CInterval::_done_event, and INLINE. Referenced by CInterval::pause(). |
|
Returns the current time of the interval: the last value of t passed to priv_initialize(), priv_step(), or priv_finalize().
Definition at line 160 of file cInterval.I. Referenced by CInterval::priv_reverse_finalize(). |
|
Reimplemented from CInterval. Definition at line 207 of file cMetaInterval.h. |
|
Returns the state of the 'wants_t_callback' flag. Definition at line 277 of file cInterval.I. References CInterval::_state, CInterval::get_name(), TypeHandle::get_name(), INLINE, nassertv, CInterval::S_paused, CInterval::S_started, and verify_intervals. |
|
Reimplemented from CInterval. Definition at line 202 of file cMetaInterval.h. References CInterval::get_class_type(), and CInterval::init_type(). |
|
Converts from an internal integer time value or offset to an external double time value or offset in seconds.
Definition at line 246 of file cMetaInterval.I. Referenced by do_event_forward(), do_event_reverse(), get_ext_index(), pop_level(), priv_reverse_instant(), and set_interval_start_time(). |
|
Called internally whenever the interval reaches its final state.
Definition at line 762 of file cInterval.cxx. Referenced by get_interval_end_time(), CInterval::priv_do_event(), and priv_instant(). |
|
Returns true if a recent call to priv_initialize(), priv_step(), or priv_finalize() has left some external intervals ready to play. If this returns true, call get_event_index(), get_event_t(), and pop_event() to retrieve the relevant information. Definition at line 154 of file cMetaInterval.I. References _event_queue, and CInterval::ET_step. Referenced by CIntervalManager::get_num_intervals(). |
|
Returns true if the interval is currently playing, false otherwise.
Definition at line 246 of file cInterval.cxx. References CInterval::_state, CInterval::check_stopped(), CInterval::get_class_type(), CInterval::priv_step(), CInterval::recompute(), CInterval::S_started, and t. |
|
Returns true if the interval is in either its initial or final states (but not in a running or paused state).
Definition at line 105 of file cInterval.I. Referenced by CInterval::setup_play(). |
|
Starts the interval playing by registering it with the current CIntervalManager. The interval will play until it is interrupted with finish() or pause(), looping back to start_t when it reaches end_t. If end_t is less than zero, it indicates the end of the interval. Definition at line 143 of file cInterval.cxx. References CInterval::_manager, CIntervalManager::add_c_interval(), and CInterval::setup_resume(). |
|
Called by a derived class to indicate the interval has been changed internally and must be recomputed before its duration may be returned.
Definition at line 741 of file cInterval.cxx. Referenced by add_c_interval(), add_ext_index(), and push_level(). |
|
Reimplemented in CLerpAnimEffectInterval, and CLerpNodePathInterval. Definition at line 496 of file cInterval.cxx. |
|
Stops the interval from playing but leaves it in its current state. It may later be resumed from this point by calling resume(). Definition at line 161 of file cInterval.cxx. References CInterval::_manager, CIntervalManager::find_c_interval(), CInterval::get_state(), CInterval::priv_finalize(), CInterval::priv_instant(), CInterval::S_final, and CInterval::S_initial. |
|
Acknowledges that the external interval on the top of the queue has been extracted, and is about to be serviced by the scripting language. This prepares the interval so the next call to is_event_ready() will return information about the next external interval on the queue, if any. Definition at line 874 of file cMetaInterval.cxx. References PET_end. |
|
Finishes a level marked by a previous call to push_level(), and returns to the previous level. If the duration is not negative, it represents a phony duration to assign to the level, for the purposes of sequencing later intervals. Otherwise, the level's duration is computed based on the intervals within the level. Definition at line 274 of file cMetaInterval.cxx. References CMetaInterval::IntervalDef::_actual_begin_time, CMetaInterval::IntervalDef::_c_interval, _defs, CMetaInterval::IntervalDef::_ext_name, CMetaInterval::IntervalDef::_type, DT_c_interval, DT_ext_index, int_to_double_time(), and CInterval::recompute(). |
|
Calls the appropriate event function indicated by the EventType.
Definition at line 262 of file cInterval.cxx. References CInterval::_state, CInterval::check_stopped(), CInterval::get_class_type(), CInterval::get_duration(), CInterval::interval_done(), CInterval::priv_step(), CInterval::recompute(), CInterval::S_final, and CInterval::S_started. |
|
This is called when an interval is interrupted. It should advance the time as if priv_step() were called, and also perform whatever cleanup might be required. Reimplemented from CInterval. Definition at line 630 of file cMetaInterval.cxx. References _events, _processing_events, and PET_begin. |
|
This replaces the first call to priv_step(), and indicates that the interval has just begun. This may be overridden by derived classes that need to do some explicit initialization on the first call. Reimplemented from CInterval. Definition at line 453 of file cMetaInterval.cxx. References CInterval::_curr_t, _events, _next_event_index, _processing_events, CInterval::_state, CInterval::check_started(), do_event_forward(), do_event_reverse(), double_to_int_time(), enqueue_self_event(), CInterval::ET_step, finish_events_forward(), finish_events_reverse(), get_class_type(), CInterval::S_started, and t. Referenced by priv_instant(). |
|
This is called in lieu of priv_initialize() .. priv_step() .. priv_finalize(), when everything is to happen within one frame. The interval should initialize itself, then leave itself in the final state. Reimplemented from CInterval. Definition at line 514 of file cMetaInterval.cxx. References CInterval::_curr_t, _event_queue, _events, _next_event_index, _processing_events, CInterval::_state, do_event_forward(), double_to_int_time(), enqueue_done_event(), enqueue_self_event(), CInterval::ET_finalize, finish_events_forward(), CInterval::get_duration(), CInterval::interval_done(), priv_initialize(), CInterval::S_final, and CInterval::S_initial. |
|
This is called while the interval is playing to indicate that it is about to be interrupted; that is, priv_step() will not be called for a length of time. But the interval should remain in its current state in anticipation of being eventually restarted when the calls to priv_step() eventually resume. The purpose of this function is to allow self-running intervals like sound intervals to stop the actual sound playback during the pause. Reimplemented from CInterval. Definition at line 836 of file cMetaInterval.cxx. References CInterval::_duration, and _events. |
|
Called generally following a priv_reverse_initialize(), this indicates the interval should set itself to the initial state.
Reimplemented from CInterval. Definition at line 782 of file cMetaInterval.cxx. References _events, PET_begin, PET_end, and PET_instant. |
|
Similar to priv_initialize(), but this is called when the interval is being played backwards; it indicates that the interval should start at the finishing state and undo any intervening intervals.
Reimplemented from CInterval. Definition at line 679 of file cMetaInterval.cxx. References CInterval::_curr_t, CInterval::_state, and CInterval::S_initial. |
|
This is called in lieu of priv_reverse_initialize() .. priv_step() .. priv_reverse_finalize(), when everything is to happen within one frame. The interval should initialize itself, then leave itself in the initial state. Reimplemented from CInterval. Definition at line 742 of file cMetaInterval.cxx. References CMetaInterval::IntervalDef::_actual_begin_time, _defs, _precision, CInterval::get_name(), indent(), int_to_double_time(), nassertv, CInterval::recompute(), and write_event_desc(). |
|
Advances the time on the interval. The time may either increase (the normal case) or decrease (e.g. if the interval is being played by a slider). Reimplemented from CInterval. Definition at line 560 of file cMetaInterval.cxx. References _active, CInterval::_curr_t, _events, _next_event_index, _processing_events, CInterval::_state, CInterval::check_stopped(), do_event_reverse(), double_to_int_time(), enqueue_self_event(), CInterval::ET_reverse_initialize, finish_events_reverse(), get_class_type(), CInterval::recompute(), CInterval::S_started, and t. |
|
Marks the beginning of a nested level of child intervals. Within the nested level, a RelativeStart time of RS_level_begin refers to the start of the level, and the first interval added within the level is always relative to the start of the level. The return value is the index of the def entry created by this push. Definition at line 138 of file cMetaInterval.cxx. References CMetaInterval::IntervalDef::_c_interval, _defs, _event_queue, CInterval::_parents, _processing_events, CMetaInterval::IntervalDef::_rel_time, CMetaInterval::IntervalDef::_rel_to, CMetaInterval::IntervalDef::_type, DT_c_interval, CInterval::mark_dirty(), nassertr, and NULL. |
|
Calls do_recompute() if the dirty flag has been set.
Definition at line 355 of file cInterval.I. Referenced by get_interval_end_time(), CInterval::get_name(), CInterval::is_playing(), pop_level(), CInterval::priv_do_event(), CInterval::priv_initialize(), priv_reverse_instant(), priv_step(), and set_interval_start_time(). |
|
Recursively recomputes a complete level (delimited by push/pop definitions). The value n on entry refers to the first entry after the push; the return value will reference the matching pop, or an index greater than the last element in the array if there was no matching pop. The level_begin value indicates the begin time of this level. On return, level_end is filled with the end time of this level. Definition at line 1429 of file cMetaInterval.cxx. |
|
Restarts the interval from the indicated point after a previous call to pause().
Definition at line 199 of file cInterval.cxx. References CInterval::ET_initialize, CInterval::ET_instant, CInterval::priv_initialize(), CInterval::priv_instant(), and t. |
|
Restarts the interval from its current point after a previous call to pause().
Definition at line 183 of file cInterval.cxx. References CInterval::_manager, and CIntervalManager::remove_c_interval(). |
|
Invokes whatever C++ intervals might be at the head of the queue, and prepares for passing an external interval to the scripting language. The return value is true if there remains at least one external event to be serviced, false if all events are handled. Definition at line 1361 of file cMetaInterval.cxx. |
|
Changes the state of the 'auto_finish' flag. If this is true, the interval may be arbitrarily finished when the system needs to reset due to some external event by calling CIntervalManager::interrupt(). If this is false (the default), the interval must always be explicitly finished or paused. Definition at line 225 of file cInterval.I. References CInterval::_manager. |
|
Changes the state of the 'auto_pause' flag. If this is true, the interval may be arbitrarily interrupted when the system needs to reset due to some external event by calling CIntervalManager::interrupt(). If this is false (the default), the interval must always be explicitly finished or paused. Definition at line 185 of file cInterval.I. References CInterval::_last_t_callback. |
|
Sets the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own.
Definition at line 124 of file cInterval.I. References CInterval::_auto_pause, and INLINE. |
|
Adjusts the start time of the child interval with the given name, if found. This may be either a C++ interval added via add_c_interval(), or an external interval added via add_ext_index(); the name must match exactly. If the interval is found, its start time is adjusted, and all subsequent intervals are adjusting accordingly, and true is returned. If a matching interval is not found, nothing is changed and false is returned. Definition at line 317 of file cMetaInterval.cxx. References CMetaInterval::IntervalDef::_actual_begin_time, CMetaInterval::IntervalDef::_c_interval, _defs, CMetaInterval::IntervalDef::_ext_duration, CMetaInterval::IntervalDef::_ext_name, CMetaInterval::IntervalDef::_type, DT_c_interval, DT_ext_index, int_to_double_time(), and CInterval::recompute(). |
|
Indicates the CIntervalManager object which will be responsible for playing this interval. This defaults to the global CIntervalManager; you should need to change this only if you have special requirements for playing this interval. Definition at line 298 of file cInterval.I. |
|
Indicates the precision with which time measurements are compared. For numerical accuracy, all floating-point time values are converted to integer values internally by scaling by the precision factor. The larger the number given here, the smaller the delta of time that can be differentiated; the limit is the maximum integer that can be represented in the system. Definition at line 46 of file cMetaInterval.I. References _precision. |
|
Explicitly sets the time within the interval. Normally, you would use start() .. finish() to let the time play normally, but this may be used to set the time to some particular value. Definition at line 80 of file cInterval.cxx. |
|
Changes the state of the 'wants_t_callback' flag. If this is true, the interval will be returned by CIntervalManager::get_event() each time the interval's time value has been changed, regardless of whether it has any external events. Definition at line 261 of file cInterval.I. References CInterval::_state, CInterval::get_name(), TypeHandle::get_name(), INLINE, nassertv, CInterval::S_started, and verify_intervals. |
|
Called to prepare the interval for automatic timed playback, e.g. via a Python task. The interval will be played from start_t to end_t, at a time factor specified by play_rate. start_t must always be less than end_t (except for the exception for end_t == -1, below), but if play_rate is negative the interval will be played backwards. Specify end_t of -1 to play the entire interval from start_t. Call step_play() repeatedly to execute the interval. Definition at line 547 of file cInterval.cxx. References CInterval::_loop_count, CInterval::get_open_ended(), CInterval::is_stopped(), CInterval::priv_reverse_finalize(), and CInterval::priv_reverse_instant(). |
|
Called to prepare the interval for restarting at the current point within the interval after an interruption.
Definition at line 590 of file cInterval.cxx. References CInterval::_dirty, and CInterval::_parents. Referenced by CInterval::loop(). |
|
Starts the interval playing by registering it with the current CIntervalManager. The interval will play to the end and stop. If end_t is less than zero, it indicates the end of the interval. Definition at line 115 of file cInterval.cxx. References CInterval::_manager. |
|
Should be called once per frame to execute the automatic timed playback begun with setup_play(). Returns true if the interval should continue, false if it is done and should stop. Definition at line 618 of file cInterval.cxx. References CInterval::_dirty. |
|
Outputs a list of all events in the order in which they occur.
Definition at line 929 of file cMetaInterval.cxx. |
|
Reimplemented from CInterval. Definition at line 893 of file cMetaInterval.cxx. References _active. |
|
Formats an event for output, for write() or timeline().
Definition at line 1549 of file cMetaInterval.cxx. Referenced by priv_reverse_instant(). |
|
Definition at line 184 of file cMetaInterval.h. Referenced by clear_events(), get_interval_end_time(), priv_step(), and write(). |
|
Definition at line 157 of file cInterval.h. Referenced by CInterval::CInterval(). |
|
Definition at line 156 of file cInterval.h. Referenced by CInterval::CInterval(), CInterval::get_done_event(), and CInterval::set_done_event(). |
|
Definition at line 163 of file cInterval.h. Referenced by CInterval::CInterval(), CInterval::priv_interrupt(), and CInterval::priv_reverse_finalize(). |
|
Definition at line 151 of file cInterval.h. Referenced by get_interval_end_time(), priv_initialize(), priv_instant(), priv_reverse_initialize(), WaitInterval::priv_step(), and priv_step(). |
|
Definition at line 181 of file cMetaInterval.h. |
|
Definition at line 180 of file cMetaInterval.h. Referenced by add_c_interval(), add_ext_index(), clear_intervals(), do_event_forward(), do_event_reverse(), get_def_type(), get_num_defs(), get_precision(), pop_level(), priv_reverse_instant(), push_level(), and set_interval_start_time(). |
|
Definition at line 169 of file cInterval.h. Referenced by CInterval::CInterval(). |
|
Definition at line 153 of file cInterval.h. Referenced by CInterval::get_state(). |
|
Definition at line 154 of file cInterval.h. Referenced by CInterval::CInterval(), CInterval::get_name(), and priv_interrupt(). |
|
Definition at line 165 of file cInterval.h. Referenced by CInterval::CInterval(), CInterval::priv_interrupt(), and CInterval::priv_reverse_finalize(). |
|
Definition at line 166 of file cInterval.h. Referenced by CInterval::CInterval(). |
|
Definition at line 185 of file cMetaInterval.h. |
|
Definition at line 196 of file cMetaInterval.h. Referenced by add_c_interval(), add_ext_index(), do_event_forward(), finish_events_forward(), get_ext_index(), get_interval_end_time(), is_event_ready(), priv_instant(), push_level(), and ~CMetaInterval(). |
|
Definition at line 183 of file cMetaInterval.h. Referenced by finish_events_reverse(), get_interval_end_time(), priv_finalize(), priv_initialize(), priv_instant(), priv_interrupt(), priv_reverse_finalize(), and priv_step(). |
|
Definition at line 159 of file cInterval.h. Referenced by CInterval::CInterval(), and CInterval::set_auto_pause(). |
|
Definition at line 170 of file cInterval.h. Referenced by CInterval::CInterval(), CInterval::priv_reverse_finalize(), and CInterval::setup_play(). |
|
Definition at line 160 of file cInterval.h. Referenced by CInterval::CInterval(), CInterval::get_auto_pause(), CInterval::loop(), CInterval::pause(), CInterval::resume(), CInterval::set_auto_finish(), and CInterval::start(). |
|
Definition at line 152 of file cInterval.h. Referenced by HideInterval::HideInterval(), and ShowInterval::ShowInterval(). |
|
Definition at line 187 of file cMetaInterval.h. Referenced by get_interval_end_time(), priv_initialize(), priv_instant(), and priv_step(). |
|
Definition at line 168 of file cInterval.h. Referenced by CInterval::CInterval(), CInterval::priv_interrupt(), and CInterval::priv_reverse_finalize(). |
|
Definition at line 179 of file cMetaInterval.h. Referenced by get_event_index(), priv_reverse_instant(), and set_precision(). |
|
Definition at line 188 of file cMetaInterval.h. Referenced by add_c_interval(), add_ext_index(), CMetaInterval(), get_interval_end_time(), priv_finalize(), priv_initialize(), priv_instant(), priv_step(), and push_level(). |
|
Definition at line 164 of file cInterval.h. Referenced by CInterval::CInterval(), CInterval::priv_interrupt(), CInterval::priv_reverse_finalize(), and CInterval::priv_reverse_initialize(). |
|
Definition at line 167 of file cInterval.h. Referenced by CInterval::CInterval(), and CInterval::priv_reverse_initialize(). |
|
|
Reimplemented from CInterval. Definition at line 32 of file cMetaInterval.cxx. |
|
Definition at line 158 of file cInterval.h. Referenced by CInterval::CInterval(). |