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. 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(). See set_anim_model(). More...
 
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). More...
 
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. 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. This may return false while is_pending() is true. More...
 
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. More...
 
 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. More...
 
 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. 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 ()
 Derived classes should override this function to return get_class_type(). More...
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). 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. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise. More...
 
bool unref ()
 Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete(). More...
 
- Public Member Functions inherited from AnimInterface
double getFrac ()
 Returns the fractional part of the current frame. Normally, this is in the range 0.0 <= f < 1.0, but in the one special case of an animation playing to its end frame and stopping, it might exactly equal 1.0. More...
 
int getFrame ()
 Returns the current integer frame number. This number will be in the range 0 <= f < get_num_frames(). More...
 
double getFrameRate ()
 Returns the native frame rate of the animation. This is the number of frames per second that will elapse when the play_rate is set to 1.0. It is a fixed property of the animation and may not be adjusted by the user. 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. This is a property of the animation and may not be directly adjusted by the user (although it may change without warning with certain kinds of animations, since this is a virtual method that may be overridden). More...
 
double getPlayRate ()
 Returns the rate at which the animation plays. See set_play_rate(). More...
 
bool isPlaying ()
 Returns true if the animation is currently playing, false if it is stopped (e.g. because stop() or pose() was called, or because it reached the end of the animation after play() was called). More...
 
 loop (bool restart)
 Starts the entire animation looping. If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current frame. More...
 
 loop (bool restart, double from, double to)
 Loops the animation from the frame "from" to and including the frame "to", indefinitely. If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current frame. More...
 
 output (Ostream out)
 
 pingpong (bool restart)
 Starts the entire animation bouncing back and forth between its first frame and last frame. If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current 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. Both "from" and "to" frame numbers may be outside the range (0, get_num_frames()) and the animation will follow the range correctly, reporting numbers modulo get_num_frames(). For instance, play(0, get_num_frames() * 2) will play the animation twice and then stop. 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. 1.0 is the normal speed, 2.0 is twice normal speed, and 0.5 is half normal speed. 0.0 is legal to pause the animation, and a negative value will play the animation backwards. More...
 
 stop ()
 Stops a currently playing or looping animation right where it is. The animation remains posed at the current frame. More...
 
- Public Member Functions inherited from Namable
 __init__ (const Namable copy)
 
 __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...
 
Namable operator= (const Namable other)
 
 output (Ostream out)
 Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this. 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 ()
 

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.