36class EXPCL_DIRECT_INTERVAL CInterval :
public TypedReferenceCount {
38 CInterval(
const std::string &name,
double duration,
bool open_ended);
42 INLINE
const std::string &
get_name()
const;
51 ET_reverse_initialize,
71 INLINE
double get_t()
const;
84 void start(
double start_t = 0.0,
double end_t = -1.0,
double play_rate = 1.0);
85 void loop(
double start_t = 0.0,
double end_t = -1.0,
double play_rate = 1.0);
88 void resume(
double start_t);
114 virtual void output(std::ostream &out)
const;
115 virtual void write(std::ostream &out,
int indent_level)
const;
117 void setup_play(
double start_time,
double end_time,
double play_rate,
124 EXTENSION(PyObject *__await__(PyObject *self));
144 void interval_done();
146 INLINE
void recompute()
const;
147 virtual void do_recompute();
148 INLINE
void check_stopped(
TypeHandle type,
const char *method_name)
const;
149 INLINE
void check_started(
TypeHandle type,
const char *method_name)
const;
155 std::string _done_event;
160 bool _wants_t_callback;
161 double _last_t_callback;
169 bool _start_t_at_start;
181 typedef pvector<CInterval *> Parents;
191 static void init_type() {
192 TypedReferenceCount::init_type();
194 TypedReferenceCount::get_class_type());
196 virtual TypeHandle get_type()
const {
197 return get_class_type();
199 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
202 static TypeHandle _type_handle;
204 friend class CMetaInterval;
207INLINE std::ostream &operator << (std::ostream &out,
const CInterval &ival);
208EXPCL_DIRECT_INTERVAL std::ostream &operator << (std::ostream &out, CInterval::State state);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This object holds a number of currently-playing intervals and is responsible for advancing them each ...
The base class for timeline components.
is_playing
Returns true if the interval is currently playing, false otherwise.
bool check_t_callback()
Returns true if the wants_t_callback() flag is true and the interval's t value has changed since the ...
get_manager
Returns the CIntervalManager object which will be responsible for playing this interval.
set_play_rate
Changes the play rate of the interval.
bool get_wants_t_callback() const
Returns the state of the 'wants_t_callback' flag.
virtual void priv_reverse_finalize()
Called generally following a priv_reverse_initialize(), this indicates the interval should set itself...
void resume()
Restarts the interval from its current point after a previous call to pause().
bool step_play()
Should be called once per frame to execute the automatic timed playback begun with setup_play().
virtual void priv_step(double t)
Advances the time on the interval.
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 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.
void set_wants_t_callback(bool wants_t_callback)
Changes the state of the 'wants_t_callback' flag.
set_manager
Indicates the CIntervalManager object which will be responsible for playing this interval.
get_name
Returns the interval's name.
get_auto_pause
Returns the state of the 'auto_pause' flag.
set_t
Explicitly sets the time within the interval.
get_duration
Returns the duration of the interval in seconds.
is_stopped
Returns true if the interval is in either its initial or final states (but not in a running or paused...
set_done_event
Sets the event that is generated whenever the interval reaches its final state, whether it is explici...
set_auto_pause
Changes the state of the 'auto_pause' flag.
get_open_ended
Returns the state of the "open_ended" flag.
get_state
Indicates the state the interval believes it is in: whether it has been started, is currently in the ...
get_done_event
Returns the event that is generated whenever the interval reaches its final state,...
virtual void priv_initialize(double t)
This replaces the first call to priv_step(), and indicates that the interval has just begun.
void mark_dirty()
Called by a derived class to indicate the interval has been changed internally and must be recomputed...
virtual void priv_reverse_initialize(double t)
Similar to priv_initialize(), but this is called when the interval is being played backwards; it indi...
get_play_rate
Returns the play rate as set by the last call to start(), loop(), or set_play_rate().
void resume_until(double end_t)
Restarts the interval from the current point after a previous call to pause() (or a previous play-to-...
void priv_do_event(double t, EventType event)
Calls the appropriate event function indicated by the EventType.
virtual void priv_finalize()
This is called to stop an interval, forcing it to whatever state it would be after it played all the ...
get_t
Returns the current time of the interval: the last value of t passed to priv_initialize(),...
set_auto_finish
Changes the state of the 'auto_finish' flag.
void clear_to_initial()
Pauses the interval, if it is playing, and resets its state to its initial state, abandoning any stat...
virtual void priv_reverse_instant()
This is called in lieu of priv_reverse_initialize() .
virtual void priv_interrupt()
This is called while the interval is playing to indicate that it is about to be interrupted; that is,...
void setup_resume()
Called to prepare the interval for restarting at the current point within the interval after an inter...
get_auto_finish
Returns the state of the 'auto_finish' flag.
virtual void priv_instant()
This is called in lieu of priv_initialize() .
void setup_resume_until(double end_t)
Called to prepare the interval for restarting from the current point after a previous call to pause()...
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 finish()
Stops the interval from playing and sets it to its final state.
double pause()
Stops the interval from playing but leaves it in its current state.
A lightweight class that represents a single element that may be timed and/or counted via stats.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.