Panda3D
|
Controls the timing of a character animation. More...
Public Member Functions | |
clearName () | |
Resets the Namable's name to empty. | |
AnimBundle | getAnim () |
Returns the AnimBundle bound in with this AnimControl. | |
PandaNode | getAnimModel () |
Retrieves the pointer set via set_anim_model(). | |
BitArray const | getBoundJoints () |
Returns the subset of joints controlled by this AnimControl. | |
int | getChannelIndex () |
Returns the particular channel index associated with this AnimControl. | |
double | getFrac () |
Returns the fractional part of the current frame. | |
int | getFrame () |
Returns the current integer frame number. | |
double | getFrameRate () |
Returns the native frame rate of the animation. | |
double | getFullFframe () |
Returns the current floating-point frame number. | |
int | getFullFrame () |
Returns the current integer frame number. | |
string | getName () |
int | getNextFrame () |
Returns the current integer frame number + 1, constrained to the range 0 <= f < get_num_frames(). | |
int | getNumFrames () |
Returns the number of frames in the animation. | |
PartBundle | getPart () |
Returns the PartBundle bound in with this AnimControl. | |
string | getPendingDoneEvent () |
Returns the event name that will be thrown when the AnimControl is finished binding asynchronously. | |
double | getPlayRate () |
Returns the rate at which the animation plays. | |
int | getRefCount () |
Returns the current reference count. | |
TypeHandle | getType () |
int | getTypeIndex () |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | hasAnim () |
Returns true if the AnimControl was successfully loaded, or false if there was a problem. | |
bool | hasName () |
Returns true if the Namable has a nonempty name set, false if the name is empty. | |
bool | isExactType (TypeHandle handle) |
Returns true if the current object is the indicated type exactly. | |
bool | isOfType (TypeHandle handle) |
Returns true if the current object is or derives from the indicated type. | |
bool | isPending () |
Returns true if the AnimControl is being bound asynchronously, and has not yet finished. | |
bool | isPlaying () |
Returns true if the animation is currently playing, false if it is stopped (e.g. | |
loop (bool restart, double from, double to) | |
Loops the animation from the frame "from" to and including the frame "to", indefinitely. | |
loop (bool restart) | |
Starts the entire animation looping. | |
output (ostream out) | |
Outputs the Namable. | |
pingpong (bool restart) | |
Starts the entire animation bouncing back and forth between its first frame and last frame. | |
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. | |
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. | |
play () | |
Runs the entire animation from beginning to end and stops. | |
pose (double frame) | |
Sets the animation to the indicated frame and holds it there. | |
ref () | |
Explicitly increments the reference count. | |
setAnimModel (PandaNode model) | |
Associates the indicated PandaNode with the AnimControl. | |
setName (string name) | |
setPendingDoneEvent (string done_event) | |
Specifies an event name that will be thrown when the AnimControl is finished binding asynchronously. | |
setPlayRate (double play_rate) | |
Changes the rate at which the animation plays. | |
stop () | |
Stops a currently playing or looping animation right where it is. | |
bool | testRefCountIntegrity () |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | testRefCountNonzero () |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
bool | unref () |
Explicitly decrements the reference count. | |
waitPending () | |
Blocks the current thread until the AnimControl has finished loading and is fully bound. | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
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.
clearName | ( | ) | [inherited] |
Resets the Namable's name to empty.
Reimplemented in AsyncTask.
AnimBundle getAnim | ( | ) |
Returns the AnimBundle bound in with this AnimControl.
PandaNode getAnimModel | ( | ) |
Retrieves the pointer set via set_anim_model().
See set_anim_model().
BitArray const 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] |
Reimplemented from TypedReferenceCount.
double getFrac | ( | ) | [inherited] |
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.
It will always be true that get_full_frame() + get_frac() == get_full_fframe().
int getFrame | ( | ) | [inherited] |
Returns the current integer frame number.
This number will be in the range 0 <= f < get_num_frames().
double getFrameRate | ( | ) | [inherited] |
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.
double getFullFframe | ( | ) | [inherited] |
Returns the current floating-point frame number.
Unlike the value returned by get_frame(), this frame number may extend beyond the range of get_num_frames() if the frame range passed to play(), loop(), etc. did.
Unlike the value returned by get_full_frame(), this return value may equal (to_frame + 1.0), when the animation has played to its natural end. However, in this case the return value of get_full_frame() will be to_frame, not (to_frame + 1).
int getFullFrame | ( | ) | [inherited] |
Returns the current integer frame number.
Unlike the value returned by get_frame(), this frame number may extend beyond the range of get_num_frames() if the frame range passed to play(), loop(), etc. did.
Unlike the value returned by get_full_fframe(), this return value will never exceed the value passed to to_frame in the play() method.
string getName | ( | ) | [inherited] |
Reimplemented in DynamicTextFont.
int getNextFrame | ( | ) | [inherited] |
Returns the current integer frame number + 1, constrained to the range 0 <= f < get_num_frames().
If the play mode is PM_play, this will clamp to the same value as get_frame() at the end of the animation. If the play mode is any other value, this will wrap around to frame 0 at the end of the animation.
int getNumFrames | ( | ) | [inherited] |
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).
Reimplemented in SequenceNode.
PartBundle getPart | ( | ) |
Returns the PartBundle bound in with this AnimControl.
string getPendingDoneEvent | ( | ) |
Returns the event name that will be thrown when the AnimControl is finished binding asynchronously.
double getPlayRate | ( | ) | [inherited] |
Returns the rate at which the animation plays.
See set_play_rate().
int getRefCount | ( | ) | [inherited] |
Returns the current reference count.
TypeHandle getType | ( | ) | [inherited] |
Reimplemented in AnimChannelBase.
int getTypeIndex | ( | ) | [inherited] |
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().
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 hasName | ( | ) | [inherited] |
Returns true if the Namable has a nonempty name set, false if the name is empty.
bool isExactType | ( | TypeHandle | handle | ) | [inherited] |
Returns true if the current object is the indicated type exactly.
bool isOfType | ( | TypeHandle | handle | ) | [inherited] |
Returns true if the current object is or derives from the indicated type.
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.
bool isPlaying | ( | ) | [inherited] |
loop | ( | bool | restart | ) | [inherited] |
Starts the entire animation looping.
If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current frame.
loop | ( | bool | restart, |
double | from, | ||
double | to | ||
) | [inherited] |
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.
output | ( | ostream | out | ) |
pingpong | ( | bool | restart | ) | [inherited] |
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.
pingpong | ( | bool | restart, |
double | from, | ||
double | to | ||
) | [inherited] |
Loops the animation from the frame "from" to and including the frame "to", and then back in the opposite direction, indefinitely.
play | ( | double | from, |
double | to | ||
) | [inherited] |
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.
play | ( | ) | [inherited] |
Runs the entire animation from beginning to end and stops.
pose | ( | double | frame | ) | [inherited] |
Sets the animation to the indicated frame and holds it there.
ref | ( | ) | [inherited] |
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.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
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 | ( | string | 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.
setPlayRate | ( | double | play_rate | ) | [inherited] |
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.
stop | ( | ) | [inherited] |
Stops a currently playing or looping animation right where it is.
The animation remains posed at the current frame.
bool testRefCountIntegrity | ( | ) | [inherited] |
Does some easy checks to make sure that the reference count isn't completely bogus.
Returns true if ok, false otherwise.
Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.
bool testRefCountNonzero | ( | ) | [inherited] |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
Returns true if ok, false otherwise.
bool unref | ( | ) | [inherited] |
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().
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.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
The return value is true if the new reference count is nonzero, false if it is zero.
Reimplemented in GeomVertexArrayFormat, and GeomVertexFormat.
waitPending | ( | ) |
Blocks the current thread until the AnimControl has finished loading and is fully bound.