Go to the documentation of this file.
31 double frame_rate,
int num_frames) :
34 _pending_cvar(_pending_lock),
38 #ifdef DO_MEMORY_USAGE
45 set_frame_rate(frame_rate);
46 set_num_frames(num_frames);
59 nassertv(_pending && part == _part);
60 nassertv(_anim ==
nullptr);
62 _channel_index = channel_index;
63 _bound_joints = bound_joints;
64 set_frame_rate(_anim->get_base_frame_rate());
65 set_num_frames(_anim->get_num_frames());
71 if (!_pending_done_event.empty()) {
72 throw_event(_pending_done_event);
83 _bound_joints = bound_joints;
93 nassertv(_pending && part == _part);
96 if (!_pending_done_event.empty()) {
97 throw_event(_pending_done_event);
121 <<
" until " << get_name() <<
" is bound\n";
123 _pending_cvar.
wait();
136 _pending_done_event = done_event;
138 throw_event(_pending_done_event);
149 return _pending_done_event;
164 output(std::ostream &out)
const {
165 out <<
"AnimControl(" << get_name() <<
", " <<
get_part()->get_name()
167 AnimInterface::output(out);
171 out <<
" (pending bind)";
173 out <<
" (failed bind)";
183 if (_marked_frame < 0) {
188 double this_frac = 0.0;
189 if (frame_blend_flag) {
192 return channel->
has_changed(_marked_frame, _marked_frac,
193 this_frame, this_frac);
204 if (frame_blend_flag) {
214 animation_activated() {
bool is_pending() const
Returns true if the AnimControl is being bound asynchronously, and has not yet finished.
A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool has_changed(int last_frame, double last_frac, int this_frame, double this_frac)
Returns true if the value has changed since the last call to has_changed().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the root of an AnimChannel hierarchy.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_pending_done_event(const std::string &done_event)
Specifies an event name that will be thrown when the AnimControl is finished binding asynchronously.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void control_removed(AnimControl *control)
Called by the AnimControl when it destructs.
bool channel_has_changed(AnimChannelBase *channel, bool frame_blend_flag) const
Returns true if the indicated channel value has changed since the last call to mark_channels().
get_current_thread
Returns a pointer to the currently-executing Thread object.
TypeHandle is the identifier used to differentiate C++ class types.
std::string get_pending_done_event() const
Returns the event name that will be thrown when the AnimControl is finished binding asynchronously.
static void update_type(ReferenceCount *ptr, TypeHandle type)
Associates the indicated type with the given pointer.
PartBundle * get_part() const
Returns the PartBundle bound in with this AnimControl.
Parent class for all animation channels.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_frac
Returns the fractional part of the current frame.
void setup_anim(PartBundle *part, AnimBundle *anim, int channel_index, const BitArray &bound_joints)
This can only be called once for a given AnimControl.
void wait_pending()
Blocks the current thread until the AnimControl has finished loading and is fully bound.
bool has_anim() const
Returns true if the AnimControl was successfully loaded, or false if there was a problem.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void wait()
Waits on the condition.
void mark_channels(bool frame_blend_flag)
Marks this point as the point of reference for the next call to channel_has_changed().
void set_bound_joints(const BitArray &bound_joints)
Called to initialize the AnimControl with its array of bound_joints, before setup_anim() has complete...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for all things which can have a name.
void fail_anim(PartBundle *part)
This can only be called once for a given AnimControl.
virtual void control_activated(AnimControl *control)
Called by the AnimControl whenever it starts an animation.
AnimControl(const std::string &name, PartBundle *part, double frame_rate, int num_frames)
This constructor is used to create a temporarily uninitialized AnimControl that will serve as a place...
void notify_all()
Informs all of the other threads who are currently blocked on wait() that the relevant condition has ...
A dynamic array with an unlimited number of bits.
This is the root of a MovingPart hierarchy.
get_frame
Returns the current integer frame number.