Panda3D
|
This is a named collection of AnimControl pointers. More...
#include "animControlCollection.h"
Classes | |
class | ControlDef |
Public Member Functions | |
AnimControlCollection () | |
Returns the AnimControl associated with the given name, or NULL if no such control has been associated. | |
void | clear_anims () |
Disassociates all anims from this collection. | |
AnimControl * | find_anim (const string &name) const |
Returns the AnimControl associated with the given name, or NULL if no such control has been associated. | |
AnimControl * | get_anim (int n) const |
Returns the nth AnimControl associated with this collection. | |
string | get_anim_name (int n) const |
Returns the name of the nth AnimControl associated with this collection. | |
int | get_frame (const string &anim_name) const |
Returns the current frame in the named animation, or 0 if the animation is not found. | |
int | get_frame () const |
Returns the current frame in the last-started animation. | |
int | get_num_anims () const |
Returns the number of AnimControls associated with this collection. | |
int | get_num_frames () const |
Returns the total number of frames in the last-started animation. | |
int | get_num_frames (const string &anim_name) const |
Returns the total number of frames in the named animation, or 0 if the animation is not found. | |
bool | is_playing () const |
Returns true if the last-started animation is currently playing, false otherwise. | |
bool | is_playing (const string &anim_name) const |
Returns true if the named animation is currently playing, false otherwise. | |
bool | loop (const string &anim_name, bool restart) |
Starts the named animation looping. | |
bool | loop (const string &anim_name, bool restart, int from, int to) |
Starts the named animation looping. | |
void | loop_all (bool restart) |
Starts all animations looping. | |
void | loop_all (bool restart, int from, int to) |
Starts all animations looping. | |
MAKE_SEQ (get_anims, get_num_anims, get_anim) | |
MAKE_SEQ (get_anim_names, get_num_anims, get_anim_name) | |
void | output (ostream &out) const |
bool | play (const string &anim_name) |
Starts the named animation playing. | |
bool | play (const string &anim_name, int from, int to) |
Starts the named animation playing. | |
void | play_all () |
Starts all animations playing. | |
void | play_all (int from, int to) |
Starts all animations playing. | |
bool | pose (const string &anim_name, int frame) |
Sets to a particular frame in the named animation. | |
void | pose_all (int frame) |
Sets all animations to the indicated frame. | |
bool | stop (const string &anim_name) |
Stops the named animation. | |
bool | stop_all () |
Stops all currently playing animations. | |
void | store_anim (AnimControl *control, const string &name) |
Associates the given AnimControl with this collection under the given name. | |
bool | unbind_anim (const string &name) |
Removes the AnimControl associated with the given name, if any. | |
string | which_anim_playing () const |
Returns the name of the bound AnimControl currently playing, if any. | |
void | write (ostream &out) const |
This is a named collection of AnimControl pointers.
An AnimControl may be added to the collection by name. While an AnimControl is associated, its reference count is maintained; associating a new AnimControl with the same name will decrement the previous control's reference count (and possibly delete it, unbinding its animation).
Definition at line 37 of file animControlCollection.h.
AnimControlCollection::AnimControlCollection | ( | ) |
Returns the AnimControl associated with the given name, or NULL if no such control has been associated.
Definition at line 26 of file animControlCollection.cxx.
void AnimControlCollection::clear_anims | ( | ) |
Disassociates all anims from this collection.
Definition at line 169 of file animControlCollection.cxx.
AnimControl * AnimControlCollection::find_anim | ( | const string & | name | ) | const |
Returns the AnimControl associated with the given name, or NULL if no such control has been associated.
Definition at line 80 of file animControlCollection.cxx.
Referenced by get_frame(), get_num_frames(), is_playing(), loop(), play(), pose(), and stop().
AnimControl * AnimControlCollection::get_anim | ( | int | n | ) | const |
Returns the nth AnimControl associated with this collection.
Definition at line 146 of file animControlCollection.cxx.
string AnimControlCollection::get_anim_name | ( | int | n | ) | const |
Returns the name of the nth AnimControl associated with this collection.
Definition at line 158 of file animControlCollection.cxx.
int AnimControlCollection::get_frame | ( | const string & | anim_name | ) | const [inline] |
Returns the current frame in the named animation, or 0 if the animation is not found.
Definition at line 119 of file animControlCollection.I.
References find_anim(), and AnimInterface::get_frame().
int AnimControlCollection::get_frame | ( | ) | const [inline] |
Returns the current frame in the last-started animation.
Definition at line 134 of file animControlCollection.I.
References AnimInterface::get_frame().
int AnimControlCollection::get_num_anims | ( | ) | const |
Returns the number of AnimControls associated with this collection.
Definition at line 135 of file animControlCollection.cxx.
int AnimControlCollection::get_num_frames | ( | const string & | anim_name | ) | const [inline] |
Returns the total number of frames in the named animation, or 0 if the animation is not found.
Definition at line 177 of file animControlCollection.I.
References find_anim(), and AnimInterface::get_num_frames().
int AnimControlCollection::get_num_frames | ( | ) | const [inline] |
Returns the total number of frames in the last-started animation.
Definition at line 192 of file animControlCollection.I.
References AnimInterface::get_num_frames().
bool AnimControlCollection::is_playing | ( | ) | const [inline] |
Returns true if the last-started animation is currently playing, false otherwise.
Definition at line 163 of file animControlCollection.I.
References AnimInterface::is_playing().
bool AnimControlCollection::is_playing | ( | const string & | anim_name | ) | const [inline] |
Returns true if the named animation is currently playing, false otherwise.
Definition at line 148 of file animControlCollection.I.
References find_anim(), and AnimInterface::is_playing().
bool AnimControlCollection::loop | ( | const string & | anim_name, |
bool | restart, | ||
int | from, | ||
int | to | ||
) | [inline] |
Starts the named animation looping.
Definition at line 70 of file animControlCollection.I.
References find_anim(), and AnimInterface::loop().
bool AnimControlCollection::loop | ( | const string & | anim_name, |
bool | restart | ||
) | [inline] |
Starts the named animation looping.
Definition at line 54 of file animControlCollection.I.
References find_anim(), and AnimInterface::loop().
void AnimControlCollection::loop_all | ( | bool | restart | ) |
Starts all animations looping.
Definition at line 208 of file animControlCollection.cxx.
void AnimControlCollection::loop_all | ( | bool | restart, |
int | from, | ||
int | to | ||
) |
Starts all animations looping.
Definition at line 222 of file animControlCollection.cxx.
bool AnimControlCollection::play | ( | const string & | anim_name | ) | [inline] |
Starts the named animation playing.
Definition at line 22 of file animControlCollection.I.
References find_anim(), and AnimInterface::play().
bool AnimControlCollection::play | ( | const string & | anim_name, |
int | from, | ||
int | to | ||
) | [inline] |
Starts the named animation playing.
Definition at line 38 of file animControlCollection.I.
References find_anim(), and AnimInterface::play().
void AnimControlCollection::play_all | ( | int | from, |
int | to | ||
) |
Starts all animations playing.
Definition at line 194 of file animControlCollection.cxx.
void AnimControlCollection::play_all | ( | ) |
Starts all animations playing.
Definition at line 180 of file animControlCollection.cxx.
bool AnimControlCollection::pose | ( | const string & | anim_name, |
int | frame | ||
) | [inline] |
Sets to a particular frame in the named animation.
Definition at line 102 of file animControlCollection.I.
References find_anim(), and AnimInterface::pose().
void AnimControlCollection::pose_all | ( | int | frame | ) |
Sets all animations to the indicated frame.
Definition at line 257 of file animControlCollection.cxx.
bool AnimControlCollection::stop | ( | const string & | anim_name | ) | [inline] |
Stops the named animation.
Definition at line 86 of file animControlCollection.I.
References find_anim(), and AnimInterface::stop().
bool AnimControlCollection::stop_all | ( | ) |
Stops all currently playing animations.
Returns true if any animations were stopped, false if none were playing.
Definition at line 238 of file animControlCollection.cxx.
void AnimControlCollection::store_anim | ( | AnimControl * | control, |
const string & | name | ||
) |
Associates the given AnimControl with this collection under the given name.
The AnimControl will remain associated until a new AnimControl is associated with the same name later, or until unbind_anim() is called with this name.
Definition at line 49 of file animControlCollection.cxx.
bool AnimControlCollection::unbind_anim | ( | const string & | name | ) |
Removes the AnimControl associated with the given name, if any.
Returns true if an AnimControl was removed, false if there was no AnimControl with the indicated name.
Definition at line 100 of file animControlCollection.cxx.
string AnimControlCollection::which_anim_playing | ( | ) | const |
Returns the name of the bound AnimControl currently playing, if any.
If more than one AnimControl is currently playing, returns all of the names separated by spaces.
Definition at line 274 of file animControlCollection.cxx.