#include <showInterval.h>
Inheritance diagram for ShowInterval:
Public Types | |
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 | |
ShowInterval (const NodePath &node, const string &name=string()) | |
virtual void | priv_instant () |
This is called in lieu of priv_initialize() .. | |
virtual void | priv_reverse_instant () |
This is called in lieu of priv_reverse_initialize() .. | |
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 | priv_initialize (double t) |
This replaces the first call to priv_step(), and indicates that the interval has just begun. | |
virtual void | priv_step (double t) |
Advances the time on the interval. | |
virtual void | priv_finalize () |
This is called to stop an interval, forcing it to whatever state it would be after it played all the way through. | |
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_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. | |
virtual void | output (ostream &out) const |
virtual void | write (ostream &out, int indent_level) 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 | |
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. | |
virtual void | do_recompute () |
Does whatever processing is necessary to recompute the interval after a call to mark_dirty() has indicated a recomputation is necessary. | |
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 Attributes | |
NodePath | _node |
Static Private Attributes | |
int | _unique_index |
TypeHandle | _type_handle |
Definition at line 36 of file showInterval.h.
|
Definition at line 66 of file cInterval.h. |
|
Definition at line 77 of file cInterval.h. |
|
Definition at line 36 of file showInterval.cxx. References CInterval::_name, and _unique_index. |
|
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 CMetaInterval::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 CMetaInterval::get_interval_end_time(), CInterval::is_playing(), CInterval::priv_do_event(), CInterval::priv_initialize(), priv_instant(), HideInterval::priv_instant(), and CMetaInterval::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. |
|
Does whatever processing is necessary to recompute the interval after a call to mark_dirty() has indicated a recomputation is necessary.
Reimplemented in CMetaInterval. Definition at line 781 of file cInterval.cxx. |
|
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. |
|
Reimplemented from CInterval. Definition at line 59 of file showInterval.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. |
|
Reimplemented from CInterval. Definition at line 48 of file showInterval.h. Referenced by priv_instant(). |
|
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 CMetaInterval::get_interval_end_time(), CInterval::priv_do_event(), CInterval::priv_finalize(), CMetaInterval::priv_instant(), CInterval::priv_interrupt(), and CInterval::priv_reverse_initialize(). |
|
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(), CMetaInterval::priv_reverse_instant(), CInterval::set_wants_t_callback(), and CIntervalManager::~CIntervalManager(). |
|
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(). |
|
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 56 of file showInterval.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 51 of file showInterval.h. |
|
Called internally whenever the interval reaches its final state.
Definition at line 762 of file cInterval.cxx. Referenced by CMetaInterval::get_interval_end_time(), CInterval::priv_do_event(), and CMetaInterval::priv_instant(). |
|
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 CMetaInterval::add_c_interval(), CMetaInterval::add_ext_index(), and CMetaInterval::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. |
|
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 to stop an interval, forcing it to whatever state it would be after it played all the way through. It's generally invoked by set_final_t(). Reimplemented in CMetaInterval. Definition at line 381 of file cInterval.cxx. References CInterval::get_duration(), and CInterval::get_name(). Referenced by CInterval::pause(). |
|
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 in CLerpNodePathInterval, and CMetaInterval. Definition at line 316 of file cInterval.cxx. References CInterval::_state, CInterval::check_stopped(), CInterval::get_class_type(), CInterval::priv_step(), CInterval::recompute(), CInterval::S_started, and t. Referenced by CInterval::resume(). |
|
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 64 of file showInterval.cxx. References _node, CInterval::_state, CInterval::check_stopped(), get_class_type(), NodePath::hide(), 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 in CMetaInterval. Definition at line 482 of file cInterval.cxx. References CInterval::_clock_start, CInterval::_end_t, CInterval::_play_rate, CInterval::_start_t, CInterval::get_duration(), and t. |
|
Called generally following a priv_reverse_initialize(), this indicates the interval should set itself to the initial state.
Reimplemented in CMetaInterval. Definition at line 449 of file cInterval.cxx. References CInterval::_clock_start, CInterval::_end_t, CInterval::_loop_count, CInterval::_play_rate, CInterval::_start_t, ClockObject::get_frame_time(), ClockObject::get_global_clock(), and CInterval::get_t(). Referenced by CInterval::setup_play(). |
|
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 in CLerpNodePathInterval, and CMetaInterval. Definition at line 404 of file cInterval.cxx. References CInterval::_start_t, CInterval::_start_t_at_start, CInterval::get_duration(), and nassertv. |
|
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 87 of file showInterval.cxx. |
|
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 in CLerpAnimEffectInterval, CLerpNodePathInterval, CMetaInterval, and WaitInterval. Definition at line 360 of file cInterval.cxx. References CInterval::_state, CInterval::check_started(), CInterval::get_class_type(), and CInterval::S_paused. Referenced by CInterval::is_playing(), CInterval::priv_do_event(), and CInterval::priv_initialize(). |
|
Calls do_recompute() if the dirty flag has been set.
Definition at line 355 of file cInterval.I. Referenced by CMetaInterval::get_interval_end_time(), CInterval::get_name(), CInterval::is_playing(), CMetaInterval::pop_level(), CInterval::priv_do_event(), CInterval::priv_initialize(), CMetaInterval::priv_reverse_instant(), CMetaInterval::priv_step(), and CMetaInterval::set_interval_start_time(). |
|
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(). |
|
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. |
|
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. |
|
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. |
|
Reimplemented in CMetaInterval. Definition at line 512 of file cInterval.cxx. |
|
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 CMetaInterval::get_interval_end_time(), CMetaInterval::priv_initialize(), CMetaInterval::priv_instant(), CMetaInterval::priv_reverse_initialize(), WaitInterval::priv_step(), and CMetaInterval::priv_step(). |
|
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 CMetaInterval::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 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(). |
|
Definition at line 44 of file showInterval.h. Referenced by priv_instant(). |
|
Definition at line 168 of file cInterval.h. Referenced by CInterval::CInterval(), CInterval::priv_interrupt(), and CInterval::priv_reverse_finalize(). |
|
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 25 of file showInterval.cxx. |
|
Definition at line 24 of file showInterval.cxx. Referenced by ShowInterval(). |
|
Definition at line 158 of file cInterval.h. Referenced by CInterval::CInterval(). |