Controls the timing of a character animation. More...

Inheritance diagram for AnimControl:
TypedReferenceCount AnimInterface Namable TypedObject ReferenceCount MemoryBase MemoryBase MemoryBase

Public Member Functions

AnimBundle getAnim ()
 Returns the AnimBundle bound in with this AnimControl. More...
 
PandaNode getAnimModel ()
 Retrieves the pointer set via set_anim_model(). More...
 
const BitArray getBoundJoints ()
 Returns the subset of joints controlled by this AnimControl. More...
 
int getChannelIndex ()
 Returns the particular channel index associated with this AnimControl. More...
 
PartBundle getPart ()
 Returns the PartBundle bound in with this AnimControl. More...
 
str getPendingDoneEvent ()
 Returns the event name that will be thrown when the AnimControl is finished binding asynchronously. More...
 
bool hasAnim ()
 Returns true if the AnimControl was successfully loaded, or false if there was a problem. More...
 
bool isPending ()
 Returns true if the AnimControl is being bound asynchronously, and has not yet finished. More...
 
 output (Ostream out)
 
 setAnimModel (PandaNode model)
 Associates the indicated PandaNode with the AnimControl. More...
 
 setPendingDoneEvent (str done_event)
 Specifies an event name that will be thrown when the AnimControl is finished binding asynchronously. More...
 
 waitPending ()
 Blocks the current thread until the AnimControl has finished loading and is fully bound. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 
- Public Member Functions inherited from AnimInterface
double getFrac ()
 Returns the fractional part of the current frame. More...
 
int getFrame ()
 Returns the current integer frame number. More...
 
double getFrameRate ()
 Returns the native frame rate of the animation. More...
 
double getFullFframe ()
 Returns the current floating-point frame number. More...
 
int getFullFrame ()
 Returns the current integer frame number. More...
 
int getNextFrame ()
 Returns the current integer frame number + 1, constrained to the range 0 <= f < get_num_frames(). More...
 
int getNumFrames ()
 Returns the number of frames in the animation. More...
 
double getPlayRate ()
 Returns the rate at which the animation plays. More...
 
bool isPlaying ()
 Returns true if the animation is currently playing, false if it is stopped (e.g. More...
 
 loop (bool restart)
 Starts the entire animation looping. More...
 
 loop (bool restart, double from, double to)
 Loops the animation from the frame "from" to and including the frame "to", indefinitely. More...
 
 output (Ostream out)
 
 pingpong (bool restart)
 Starts the entire animation bouncing back and forth between its first frame and last frame. More...
 
 pingpong (bool restart, double from, double to)
 Loops the animation from the frame "from" to and including the frame "to", and then back in the opposite direction, indefinitely. More...
 
 play ()
 Runs the entire animation from beginning to end and stops. More...
 
 play (double from, double to)
 Runs the animation from the frame "from" to and including the frame "to", at which point the animation is stopped. More...
 
 pose (double frame)
 Sets the animation to the indicated frame and holds it there. More...
 
 setPlayRate (double play_rate)
 Changes the rate at which the animation plays. More...
 
 stop ()
 Stops a currently playing or looping animation right where it is. More...
 
- Public Member Functions inherited from Namable
 __init__ (const Namable)
 
 __init__ (str initial_name)
 
 clearName ()
 Resets the Namable's name to empty. More...
 
str getName ()
 
bool hasName ()
 Returns true if the Namable has a nonempty name set, false if the name is empty. More...
 
 output (Ostream out)
 Outputs the Namable. More...
 
 setName (str name)
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from AnimInterface
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from Namable
static TypeHandle getClassType ()
 

Additional Inherited Members

- Public Attributes inherited from TypedObject
TypeHandle type
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 
- Public Attributes inherited from AnimInterface
double frac
 
int frame
 
double frame_rate
 
double full_fframe
 
int full_frame
 
int next_frame
 
int num_frames
 
double play_rate
 
bool playing
 
- Public Attributes inherited from Namable
const String name
 

Detailed Description

Controls the timing of a character animation.

An AnimControl object is created for each character/bundle binding and manages the state of the animation: whether started, stopped, or looping, and the current frame number and play rate.

Member Function Documentation

AnimBundle getAnim ( )

Returns the AnimBundle bound in with this AnimControl.

PandaNode getAnimModel ( )

Retrieves the pointer set via set_anim_model().

See set_anim_model().

const BitArray getBoundJoints ( )

Returns the subset of joints controlled by this AnimControl.

Most of the time, this will be BitArray::all_on(), for a normal full-body animation. For a subset animation, however, this will be just a subset of those bits, corresponding to the set of joints and sliders actually bound (as enumerated by bind_hierarchy() in depth-first LIFO order).

int getChannelIndex ( )

Returns the particular channel index associated with this AnimControl.

This channel index is the slot on which each AnimGroup is bound to its associated PartGroup, for each joint in the animation.

It will be true that get_part()->find_child("n")->get_bound(get_channel_index()) == get_anim()->find_child("n"), for each joint "n".

static TypeHandle getClassType ( )
static
PartBundle getPart ( )

Returns the PartBundle bound in with this AnimControl.

str getPendingDoneEvent ( )

Returns the event name that will be thrown when the AnimControl is finished binding asynchronously.

bool hasAnim ( )

Returns true if the AnimControl was successfully loaded, or false if there was a problem.

This may return false while is_pending() is true.

bool isPending ( )

Returns true if the AnimControl is being bound asynchronously, and has not yet finished.

If this is true, the AnimControl's interface is still available and will be perfectly useful (though get_anim() might return NULL), but nothing visible will happen immediately.

output ( Ostream  out)
setAnimModel ( PandaNode  model)

Associates the indicated PandaNode with the AnimControl.

By convention, this node represents the root node of the model file that corresponds to this AnimControl's animation file, though nothing in this code makes this assumption or indeed does anything with this node.

The purpose of this is simply to allow the AnimControl to keep a reference count on the ModelRoot node that generated it, so that the model will not disappear from the model pool until it is no longer referenced.

setPendingDoneEvent ( str  done_event)

Specifies an event name that will be thrown when the AnimControl is finished binding asynchronously.

If the AnimControl has already finished binding, the event will be thrown immediately.

waitPending ( )

Blocks the current thread until the AnimControl has finished loading and is fully bound.