Panda3D
Classes | Public Member Functions | Public Attributes | List of all members
AnimControlCollection Class Reference

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

#include "animControlCollection.h"

Public Member Functions

 AnimControlCollection ()
 Returns the AnimControl associated with the given name, or NULL if no such control has been associated. More...
 
void clear_anims ()
 Disassociates all anims from this collection. More...
 
AnimControlfind_anim (const std::string &name) const
 Returns the AnimControl associated with the given name, or NULL if no such control has been associated. More...
 
AnimControlget_anim (int n) const
 
std::string get_anim_name (int n) const
 
int get_frame (const std::string &anim_name) const
 Returns the current frame in the named animation, or 0 if the animation is not found. More...
 
int get_frame () const
 Returns the current frame in the last-started animation. More...
 
int get_num_anims () const
 
int get_num_frames (const std::string &anim_name) const
 Returns the total number of frames in the named animation, or 0 if the animation is not found. More...
 
int get_num_frames () const
 Returns the total number of frames in the last-started animation. More...
 
bool is_playing (const std::string &anim_name) const
 Returns true if the named animation is currently playing, false otherwise. More...
 
bool is_playing () const
 Returns true if the last-started animation is currently playing, false otherwise. More...
 
bool loop (const std::string &anim_name, bool restart)
 Starts the named animation looping. More...
 
bool loop (const std::string &anim_name, bool restart, double from, double to)
 Starts the named animation looping. More...
 
void loop_all (bool restart)
 Starts all animations looping. More...
 
void loop_all (bool restart, double from, double to)
 Starts all animations looping. More...
 
void output (std::ostream &out) const
 
bool play (const std::string &anim_name)
 Starts the named animation playing. More...
 
bool play (const std::string &anim_name, double from, double to)
 Starts the named animation playing. More...
 
void play_all ()
 Starts all animations playing. More...
 
void play_all (double from, double to)
 Starts all animations playing. More...
 
bool pose (const std::string &anim_name, double frame)
 Sets to a particular frame in the named animation. More...
 
void pose_all (double frame)
 Sets all animations to the indicated frame. More...
 
bool stop (const std::string &anim_name)
 Stops the named animation. More...
 
bool stop_all ()
 Stops all currently playing animations. More...
 
void store_anim (AnimControl *control, const std::string &name)
 Associates the given AnimControl with this collection under the given name. More...
 
bool unbind_anim (const std::string &name)
 Removes the AnimControl associated with the given name, if any. More...
 
std::string which_anim_playing () const
 Returns the name of the bound AnimControl currently playing, if any. More...
 
void write (std::ostream &out) const
 

Public Attributes

 get_anim
 Returns the nth AnimControl associated with this collection. More...
 
 get_anim_name
 Returns the name of the nth AnimControl associated with this collection. More...
 
 get_num_anims
 Returns the number of AnimControls associated with this collection. More...
 

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

Constructor & Destructor Documentation

◆ AnimControlCollection()

AnimControlCollection::AnimControlCollection ( )

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

Definition at line 24 of file animControlCollection.cxx.

Member Function Documentation

◆ clear_anims()

void AnimControlCollection::clear_anims ( )

Disassociates all anims from this collection.

Definition at line 146 of file animControlCollection.cxx.

◆ find_anim()

AnimControl * AnimControlCollection::find_anim ( const std::string &  name) const

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

Definition at line 71 of file animControlCollection.cxx.

Referenced by get_frame(), get_num_frames(), is_playing(), loop(), play(), pose(), and stop().

◆ get_frame() [1/2]

int AnimControlCollection::get_frame ( const std::string &  anim_name) const
inline

Returns the current frame in the named animation, or 0 if the animation is not found.

Definition at line 103 of file animControlCollection.I.

References find_anim(), and AnimInterface::get_frame.

◆ get_frame() [2/2]

int AnimControlCollection::get_frame ( ) const
inline

Returns the current frame in the last-started animation.

Definition at line 115 of file animControlCollection.I.

References AnimInterface::get_frame.

◆ get_num_frames() [1/2]

int AnimControlCollection::get_num_frames ( const std::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 151 of file animControlCollection.I.

References find_anim(), and AnimInterface::get_num_frames.

◆ get_num_frames() [2/2]

int AnimControlCollection::get_num_frames ( ) const
inline

Returns the total number of frames in the last-started animation.

Definition at line 163 of file animControlCollection.I.

References AnimInterface::get_num_frames.

◆ is_playing() [1/2]

bool AnimControlCollection::is_playing ( const std::string &  anim_name) const
inline

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

Definition at line 126 of file animControlCollection.I.

References find_anim(), and AnimInterface::is_playing.

◆ is_playing() [2/2]

bool AnimControlCollection::is_playing ( ) const
inline

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

Definition at line 139 of file animControlCollection.I.

References AnimInterface::is_playing.

◆ loop() [1/2]

bool AnimControlCollection::loop ( const std::string &  anim_name,
bool  restart 
)
inline

Starts the named animation looping.

Definition at line 46 of file animControlCollection.I.

References find_anim(), and AnimInterface::loop().

◆ loop() [2/2]

bool AnimControlCollection::loop ( const std::string &  anim_name,
bool  restart,
double  from,
double  to 
)
inline

Starts the named animation looping.

Definition at line 60 of file animControlCollection.I.

References find_anim(), and AnimInterface::loop().

◆ loop_all() [1/2]

void AnimControlCollection::loop_all ( bool  restart)

Starts all animations looping.

Definition at line 179 of file animControlCollection.cxx.

Referenced by WindowFramework::loop_animations(), and WindowFramework::next_anim_control().

◆ loop_all() [2/2]

void AnimControlCollection::loop_all ( bool  restart,
double  from,
double  to 
)

Starts all animations looping.

Definition at line 191 of file animControlCollection.cxx.

◆ play() [1/2]

bool AnimControlCollection::play ( const std::string &  anim_name)
inline

Starts the named animation playing.

Definition at line 18 of file animControlCollection.I.

References find_anim(), and AnimInterface::play().

◆ play() [2/2]

bool AnimControlCollection::play ( const std::string &  anim_name,
double  from,
double  to 
)
inline

Starts the named animation playing.

Definition at line 32 of file animControlCollection.I.

References find_anim(), and AnimInterface::play().

◆ play_all() [1/2]

void AnimControlCollection::play_all ( )

Starts all animations playing.

Definition at line 155 of file animControlCollection.cxx.

◆ play_all() [2/2]

void AnimControlCollection::play_all ( double  from,
double  to 
)

Starts all animations playing.

Definition at line 167 of file animControlCollection.cxx.

◆ pose()

bool AnimControlCollection::pose ( const std::string &  anim_name,
double  frame 
)
inline

Sets to a particular frame in the named animation.

Definition at line 88 of file animControlCollection.I.

References find_anim(), and AnimInterface::pose().

◆ pose_all()

void AnimControlCollection::pose_all ( double  frame)

Sets all animations to the indicated frame.

Definition at line 221 of file animControlCollection.cxx.

◆ stop()

bool AnimControlCollection::stop ( const std::string &  anim_name)
inline

Stops the named animation.

Definition at line 74 of file animControlCollection.I.

References find_anim(), and AnimInterface::stop().

◆ stop_all()

bool AnimControlCollection::stop_all ( )

Stops all currently playing animations.

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

Definition at line 204 of file animControlCollection.cxx.

◆ store_anim()

void AnimControlCollection::store_anim ( AnimControl control,
const std::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 42 of file animControlCollection.cxx.

◆ unbind_anim()

bool AnimControlCollection::unbind_anim ( const std::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 88 of file animControlCollection.cxx.

◆ which_anim_playing()

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

Member Data Documentation

◆ get_anim

AnimControl * AnimControlCollection::get_anim

Returns the nth AnimControl associated with this collection.

Definition at line 45 of file animControlCollection.h.

◆ get_anim_name

string AnimControlCollection::get_anim_name

Returns the name of the nth AnimControl associated with this collection.

Definition at line 46 of file animControlCollection.h.

◆ get_num_anims

int AnimControlCollection::get_num_anims

Returns the number of AnimControls associated with this collection.

Definition at line 45 of file animControlCollection.h.

Referenced by WindowFramework::next_anim_control().


The documentation for this class was generated from the following files: