Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

AnimControlCollection Class Reference

This is a named collection of AnimControl pointers. More...

#include <animControlCollection.h>

Inheritance diagram for AnimControlCollection:

PartBundle CharacterJointBundle List of all members.

Public Member Functions

 AnimControlCollection ()
 Returns the AnimControl associated with the given name, or NULL if no such control has been associated.

 ~AnimControlCollection ()
void store_anim (AnimControl *control, const string &name)
 Associates the given AnimControl with this collection under the given name.

AnimControlfind_anim (const string &name) const
 Returns the AnimControl associated with the given name, or NULL if no such control has been associated.

bool unbind_anim (const string &name)
 Removes the AnimControl associated with the given name, if any.

int get_num_anims () const
 Returns the number of AnimControls associated with this collection.

void clear_anims ()
 Disassociates all anims from this collection.

void set_stop_event (const CPT_Event &stop_event)
 Sets the event that will be thrown when the next animation that is played eventually comes to a stop.

void clear_stop_event ()
 Indicates that the next-started animation will not throw a stop event when it comes to a stop.

bool has_stop_event () const
 Returns true if a stop event has been established via set_stop_event().

CPT_Event get_stop_event () const
 Returns the event that has been established via set_stop_event().

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.

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.

bool stop (const string &anim_name)
 Stops the named animation.

bool pose (const string &anim_name, int frame)
 Sets to a particular frame in the named animation.

void play_all ()
 Starts all animations playing.

void play_all (int from, int to)
 Starts all animations playing.

void loop_all (bool restart)
 Starts all animations looping.

void loop_all (bool restart, int from, int to)
 Starts all animations looping.

bool stop_all ()
 Stops all currently playing animations.

void pose_all (int frame)
 Sets all animations to the indicated frame.

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_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 string &anim_name) const
 Returns true if the named animation is currently playing, false otherwise.

bool is_playing () const
 Returns true if the last-started animation is currently playing, false otherwise.

string which_anim_playing () const
 Returns the name of the bound AnimControl currently playing, if any.


Private Types

typedef pmap< string, PointerTo<
AnimControl > > 
Controls

Private Attributes

Controls _controls
CPT_Event _stop_event
AnimControl_last_started_control

Detailed Description

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 54 of file animControlCollection.h.


Member Typedef Documentation

typedef pmap<string, PointerTo< AnimControl > > AnimControlCollection::Controls [private]
 

Definition at line 100 of file animControlCollection.h.


Constructor & Destructor Documentation

AnimControlCollection::AnimControlCollection  ) 
 

Returns the AnimControl associated with the given name, or NULL if no such control has been associated.

Definition at line 37 of file animControlCollection.cxx.

AnimControlCollection::~AnimControlCollection  ) 
 

Definition at line 49 of file animControlCollection.cxx.

References _controls, _last_started_control, and NULL.


Member Function Documentation

void AnimControlCollection::clear_anims  ) 
 

Disassociates all anims from this collection.

Definition at line 151 of file animControlCollection.cxx.

References _controls.

void AnimControlCollection::clear_stop_event  )  [inline]
 

Indicates that the next-started animation will not throw a stop event when it comes to a stop.

This does not affect any already-started animations.

Definition at line 55 of file animControlCollection.I.

References _stop_event, INLINE, and NULL.

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 92 of file animControlCollection.cxx.

Referenced by get_frame(), has_stop_event(), loop(), and play().

int AnimControlCollection::get_frame  )  const [inline]
 

Returns the current frame in the last-started animation.

Definition at line 247 of file animControlCollection.I.

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 228 of file animControlCollection.I.

References find_anim(), AnimControl::get_num_frames(), INLINE, and NULL.

int AnimControlCollection::get_num_anims  )  const
 

Returns the number of AnimControls associated with this collection.

Definition at line 138 of file animControlCollection.cxx.

References _controls.

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 302 of file animControlCollection.I.

CPT_Event AnimControlCollection::get_stop_event  )  const [inline]
 

Returns the event that has been established via set_stop_event().

This is the event that will be thrown by animations that are started in the future when they stop. However, this may or may not be associated with any currently-playing animations.

Definition at line 99 of file animControlCollection.I.

bool AnimControlCollection::has_stop_event  )  const [inline]
 

Returns true if a stop event has been established via set_stop_event().

If true, this means that animations that are to be started in the future will throw this event when they stop. However, it does not necessarily mean that the currently-playing animation will throw this event.

Definition at line 78 of file animControlCollection.I.

References _last_started_control, _stop_event, find_anim(), INLINE, NULL, and AnimControl::play().

bool AnimControlCollection::is_playing  )  const [inline]
 

Returns true if the last-started animation is currently playing, false otherwise.

Definition at line 284 of file animControlCollection.I.

bool AnimControlCollection::is_playing const string &  anim_name  )  const [inline]
 

Returns true if the named animation is currently playing, false otherwise.

Definition at line 265 of file animControlCollection.I.

bool AnimControlCollection::loop const string &  anim_name,
bool  restart,
int  from,
int  to
[inline]
 

Starts the named animation looping.

Definition at line 169 of file animControlCollection.I.

References find_anim(), AnimControl::get_frame(), INLINE, and NULL.

bool AnimControlCollection::loop const string &  anim_name,
bool  restart
[inline]
 

Starts the named animation looping.

Definition at line 150 of file animControlCollection.I.

void AnimControlCollection::loop_all bool  restart,
int  from,
int  to
 

Starts all animations looping.

Definition at line 212 of file animControlCollection.cxx.

References _controls.

void AnimControlCollection::loop_all bool  restart  ) 
 

Starts all animations looping.

Definition at line 196 of file animControlCollection.cxx.

References _controls.

bool AnimControlCollection::play const string &  anim_name,
int  from,
int  to
[inline]
 

Starts the named animation playing.

Definition at line 131 of file animControlCollection.I.

bool AnimControlCollection::play const string &  anim_name  )  [inline]
 

Starts the named animation playing.

Definition at line 112 of file animControlCollection.I.

References _last_started_control, find_anim(), AnimControl::loop(), and NULL.

void AnimControlCollection::play_all int  from,
int  to
 

Starts all animations playing.

Definition at line 180 of file animControlCollection.cxx.

References _controls.

void AnimControlCollection::play_all  ) 
 

Starts all animations playing.

Definition at line 164 of file animControlCollection.cxx.

References _controls.

bool AnimControlCollection::pose const string &  anim_name,
int  frame
[inline]
 

Sets to a particular frame in the named animation.

Definition at line 207 of file animControlCollection.I.

References NULL.

void AnimControlCollection::pose_all int  frame  ) 
 

Sets all animations to the indicated frame.

Definition at line 254 of file animControlCollection.cxx.

void AnimControlCollection::set_stop_event const CPT_Event stop_event  )  [inline]
 

Sets the event that will be thrown when the next animation that is played eventually comes to a stop.

Setting this does not affect any stop event that is pending from a previously-started animation.

Definition at line 38 of file animControlCollection.I.

References _stop_event, INLINE, and NULL.

bool AnimControlCollection::stop const string &  anim_name  )  [inline]
 

Stops the named animation.

Definition at line 188 of file animControlCollection.I.

References _last_started_control, AnimControl::get_frame(), INLINE, and NULL.

bool AnimControlCollection::stop_all  ) 
 

Stops all currently playing animations.

Returns true if any animations were stopped, false if none were playing.

Definition at line 232 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 69 of file animControlCollection.cxx.

References _controls, and NULL.

Referenced by PartBundle::write().

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 115 of file animControlCollection.cxx.

References _controls.

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 276 of file animControlCollection.cxx.


Member Data Documentation

Controls AnimControlCollection::_controls [private]
 

Definition at line 101 of file animControlCollection.h.

Referenced by clear_anims(), get_num_anims(), loop_all(), play_all(), store_anim(), unbind_anim(), and ~AnimControlCollection().

AnimControl* AnimControlCollection::_last_started_control [private]
 

Definition at line 103 of file animControlCollection.h.

Referenced by has_stop_event(), play(), stop(), and ~AnimControlCollection().

CPT_Event AnimControlCollection::_stop_event [private]
 

Definition at line 102 of file animControlCollection.h.

Referenced by clear_stop_event(), has_stop_event(), and set_stop_event().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:47:26 2003 for Panda by doxygen1.3