Panda3D
|
Controls the timing of a character animation. More...
#include "animControl.h"
Public Member Functions | |
AnimControl (const string &name, PartBundle *part, double frame_rate, int num_frames) | |
This constructor is used to create a temporarily uninitialized AnimControl that will serve as a placeholder for an animation while the animation is being loaded during an asynchronous load-and-bind operation. | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
bool | channel_has_changed (AnimChannelBase *channel, bool frame_blend_flag) const |
Returns true if the indicated channel value has changed since the last call to mark_channels(). | |
void | clear_name () |
Resets the Namable's name to empty. | |
void | fail_anim (PartBundle *part) |
This can only be called once for a given AnimControl. | |
virtual TypeHandle | force_init_type () |
AnimBundle * | get_anim () const |
Returns the AnimBundle bound in with this AnimControl. | |
PandaNode * | get_anim_model () const |
Retrieves the pointer set via set_anim_model(). | |
int | get_best_parent_from_Set (const std::set< int > &) const |
const BitArray & | get_bound_joints () const |
Returns the subset of joints controlled by this AnimControl. | |
int | get_channel_index () const |
Returns the particular channel index associated with this AnimControl. | |
double | get_frac () const |
Returns the fractional part of the current frame. | |
int | get_frame () const |
Returns the current integer frame number. | |
double | get_frame_rate () const |
Returns the native frame rate of the animation. | |
double | get_full_fframe () const |
Returns the current floating-point frame number. | |
int | get_full_frame () const |
Returns the current integer frame number. | |
const string & | get_name () const |
int | get_next_frame () const |
Returns the current integer frame number + 1, constrained to the range 0 <= f < get_num_frames(). | |
virtual int | get_num_frames () const |
Returns the number of frames in the animation. | |
PartBundle * | get_part () const |
Returns the PartBundle bound in with this AnimControl. | |
string | get_pending_done_event () const |
Returns the event name that will be thrown when the AnimControl is finished binding asynchronously. | |
double | get_play_rate () const |
Returns the rate at which the animation plays. | |
int | get_ref_count () const |
Returns the current reference count. | |
virtual TypeHandle | get_type () const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. | |
bool | has_anim () const |
Returns true if the AnimControl was successfully loaded, or false if there was a problem. | |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
bool | is_pending () const |
Returns true if the AnimControl is being bound asynchronously, and has not yet finished. | |
bool | is_playing () const |
Returns true if the animation is currently playing, false if it is stopped (e.g. | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. | |
void | loop (bool restart) |
Starts the entire animation looping. | |
void | loop (bool restart, double from, double to) |
Loops the animation from the frame "from" to and including the frame "to", indefinitely. | |
void | mark_channels (bool frame_blend_flag) |
Marks this point as the point of reference for the next call to channel_has_changed(). | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *, void *) |
void * | operator new (size_t size, void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new (size_t size) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
void * | operator new[] (size_t size, void *ptr) |
virtual void | output (ostream &out) const |
Outputs the Namable. | |
void | pingpong (bool restart) |
Starts the entire animation bouncing back and forth between its first frame and last frame. | |
void | 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. | |
void | play () |
Runs the entire animation from beginning to end and stops. | |
void | 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. | |
void | pose (double frame) |
Sets the animation to the indicated frame and holds it there. | |
void | ref () const |
Explicitly increments the reference count. | |
void | set_anim_model (PandaNode *model) |
Associates the indicated PandaNode with the AnimControl. | |
void | set_bound_joints (const BitArray &bound_joints) |
Called to initialize the AnimControl with its array of bound_joints, before setup_anim() has completed. | |
void | set_name (const string &name) |
void | set_pending_done_event (const string &done_event) |
Specifies an event name that will be thrown when the AnimControl is finished binding asynchronously. | |
void | set_play_rate (double play_rate) |
Changes the rate at which the animation plays. | |
void | setup_anim (PartBundle *part, AnimBundle *anim, int channel_index, const BitArray &bound_joints) |
This can only be called once for a given AnimControl. | |
void | stop () |
Stops a currently playing or looping animation right where it is. | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
virtual bool | unref () const |
Explicitly decrements the reference count. | |
void | wait_pending () |
Blocks the current thread until the AnimControl has finished loading and is fully bound. | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. | |
void | weak_unref (WeakPointerToVoid *ptv) |
Removes the indicated PointerToVoid as a weak reference to this object. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Protected Member Functions | |
virtual void | animation_activated () |
This is provided as a callback method for when the user calls one of the play/loop/pose type methods to start the animation playing. | |
bool | do_test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | do_test_ref_count_nonzero () const |
Returns true if the reference count is nonzero, false otherwise. | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new AnimInterface. | |
void | set_frame_rate (double frame_rate) |
Should be called by a derived class to specify the native frame rate of the animation. | |
void | set_num_frames (int num_frames) |
Should be called by a derived class to specify the number of frames of the animation. | |
virtual void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. |
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.
Definition at line 41 of file animControl.h.
AnimControl::AnimControl | ( | const string & | name, |
PartBundle * | part, | ||
double | frame_rate, | ||
int | num_frames | ||
) |
This constructor is used to create a temporarily uninitialized AnimControl that will serve as a placeholder for an animation while the animation is being loaded during an asynchronous load-and-bind operation.
Definition at line 35 of file animControl.cxx.
References AnimInterface::set_frame_rate(), and AnimInterface::set_num_frames().
void AnimControl::animation_activated | ( | ) | [protected, virtual] |
This is provided as a callback method for when the user calls one of the play/loop/pose type methods to start the animation playing.
Reimplemented from AnimInterface.
Definition at line 249 of file animControl.cxx.
References PartBundle::control_activated(), and get_part().
TypedObject * TypedObject::as_typed_object | ( | ) | [inline, inherited] |
Returns the object, upcast (if necessary) to a TypedObject pointer.
Definition at line 99 of file typedObject.I.
const TypedObject * TypedObject::as_typed_object | ( | ) | const [inline, inherited] |
Returns the object, upcast (if necessary) to a TypedObject pointer.
Definition at line 110 of file typedObject.I.
bool AnimControl::channel_has_changed | ( | AnimChannelBase * | channel, |
bool | frame_blend_flag | ||
) | const |
Returns true if the indicated channel value has changed since the last call to mark_channels().
Definition at line 212 of file animControl.cxx.
References AnimInterface::get_frac(), AnimInterface::get_frame(), and AnimChannelBase::has_changed().
Referenced by MovingPartBase::do_update().
void Namable::clear_name | ( | ) | [inline, inherited] |
bool ReferenceCount::do_test_ref_count_integrity | ( | ) | const [protected, 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.
Definition at line 29 of file referenceCount.cxx.
Referenced by ReferenceCount::do_test_ref_count_nonzero(), and ReferenceCount::test_ref_count_integrity().
bool ReferenceCount::do_test_ref_count_nonzero | ( | ) | const [protected, inherited] |
Returns true if the reference count is nonzero, false otherwise.
Definition at line 56 of file referenceCount.cxx.
References ReferenceCount::do_test_ref_count_integrity().
Referenced by ReferenceCount::test_ref_count_nonzero().
void AnimControl::fail_anim | ( | PartBundle * | part | ) |
This can only be called once for a given AnimControl.
It indicates the attempt to bind it asynchronously has failed.
Definition at line 104 of file animControl.cxx.
References ConditionVarFullDirect::notify_all().
void AnimInterface::fillin | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected, inherited] |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new AnimInterface.
Reimplemented in SequenceNode.
Definition at line 113 of file animInterface.cxx.
References DatagramIterator::get_int32(), and BamReader::read_cdata().
AnimBundle * AnimControl::get_anim | ( | ) | const [inline] |
Returns the AnimBundle bound in with this AnimControl.
Definition at line 50 of file animControl.I.
PandaNode * AnimControl::get_anim_model | ( | ) | const [inline] |
Retrieves the pointer set via set_anim_model().
See set_anim_model().
Definition at line 115 of file animControl.I.
const BitArray & AnimControl::get_bound_joints | ( | ) | const [inline] |
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).
Definition at line 83 of file animControl.I.
int AnimControl::get_channel_index | ( | ) | const [inline] |
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".
Definition at line 67 of file animControl.I.
Referenced by MovingPartBase::determine_effective_channels(), MovingPartBase::do_update(), MovingPartMatrix::get_blend_value(), and MovingPartScalar::get_blend_value().
double AnimInterface::get_frac | ( | ) | const [inline, 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().
Definition at line 233 of file animInterface.I.
Referenced by channel_has_changed(), MovingPartScalar::get_blend_value(), MovingPartMatrix::get_blend_value(), and mark_channels().
int AnimInterface::get_frame | ( | ) | const [inline, inherited] |
Returns the current integer frame number.
This number will be in the range 0 <= f < get_num_frames().
Definition at line 190 of file animInterface.I.
References AnimInterface::get_num_frames().
Referenced by channel_has_changed(), VideoTexture::consider_update(), SequenceNode::cull_callback(), MovingPartScalar::get_blend_value(), MovingPartMatrix::get_blend_value(), SequenceNode::get_first_visible_child(), AnimControlCollection::get_frame(), SequenceNode::get_visible_child(), and mark_channels().
double AnimInterface::get_frame_rate | ( | ) | const [inline, 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.
Definition at line 177 of file animInterface.I.
double AnimInterface::get_full_fframe | ( | ) | const [inline, 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).
Definition at line 275 of file animInterface.I.
int AnimInterface::get_full_frame | ( | ) | const [inline, 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.
Definition at line 253 of file animInterface.I.
int AnimInterface::get_next_frame | ( | ) | const [inline, 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.
Definition at line 212 of file animInterface.I.
References AnimInterface::get_num_frames().
Referenced by MovingPartScalar::get_blend_value(), and MovingPartMatrix::get_blend_value().
int AnimInterface::get_num_frames | ( | ) | const [virtual, 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.
Definition at line 67 of file animInterface.cxx.
Referenced by AnimInterface::get_frame(), AnimInterface::get_next_frame(), AnimControlCollection::get_num_frames(), AnimInterface::loop(), AnimInterface::pingpong(), and AnimInterface::play().
PartBundle * AnimControl::get_part | ( | ) | const |
Returns the PartBundle bound in with this AnimControl.
Definition at line 182 of file animControl.cxx.
Referenced by animation_activated(), PartBundle::control_activated(), and output().
string AnimControl::get_pending_done_event | ( | ) | const |
Returns the event name that will be thrown when the AnimControl is finished binding asynchronously.
Definition at line 170 of file animControl.cxx.
double AnimInterface::get_play_rate | ( | ) | const [inline, inherited] |
Returns the rate at which the animation plays.
See set_play_rate().
Definition at line 162 of file animInterface.I.
int ReferenceCount::get_ref_count | ( | ) | const [inline, inherited] |
Returns the current reference count.
Definition at line 155 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by TransformState::clear_cache(), RenderState::clear_cache(), RenderState::finalize(), RenderEffects::finalize(), RenderEffect::finalize(), RenderAttrib::finalize(), InternalName::finalize(), TransformState::get_num_unused_states(), RenderState::get_num_unused_states(), TransformState::list_cycles(), RenderState::list_cycles(), GeomVertexFormat::remove_column(), TransformState::unref(), RenderState::unref(), RenderState::~RenderState(), and TransformState::~TransformState().
int TypedObject::get_type_index | ( | ) | const [inline, 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().
Definition at line 52 of file typedObject.I.
References TypeHandle::get_index().
WeakReferenceList * ReferenceCount::get_weak_list | ( | ) | const [inline, inherited] |
Returns the WeakReferenceList associated with this ReferenceCount object.
If there has never been a WeakReferenceList associated with this object, creates one now.
Definition at line 307 of file referenceCount.I.
Referenced by ReferenceCount::weak_ref().
bool AnimControl::has_anim | ( | ) | const [inline] |
Returns true if the AnimControl was successfully loaded, or false if there was a problem.
This may return false while is_pending() is true.
Definition at line 39 of file animControl.I.
Referenced by output().
bool Namable::has_name | ( | ) | const [inline, inherited] |
Returns true if the Namable has a nonempty name set, false if the name is empty.
Definition at line 75 of file namable.I.
Referenced by XFileNode::add_child(), EggComponentData::add_name(), Texture::do_read_dds_file(), Texture::do_read_one(), Character::fillin(), EggGroupUniquifier::get_category(), EggXfmSAnim::optimize(), NodePathComponent::output(), AsyncTask::output(), EggNamedObject::output(), EggSAnimData::write(), EggPrimitive::write_body(), ParametricCurveCollection::write_egg(), ParametricCurve::write_egg(), EggNamedObject::write_header(), XFileDataNodeTemplate::write_text(), and XFileDataDef::write_text().
bool ReferenceCount::has_weak_list | ( | ) | const [inline, inherited] |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
In general, this will be true if there was ever a WeakPointerTo created for this object (even if there is not any for it now).
Definition at line 294 of file referenceCount.I.
Referenced by ReferenceCount::weak_unref().
bool TypedObject::is_exact_type | ( | TypeHandle | handle | ) | const [inline, inherited] |
Returns true if the current object is the indicated type exactly.
Definition at line 74 of file typedObject.I.
References TypeHandle::get_name().
Referenced by GraphicsStateGuardian::async_reload_texture(), PortalNode::combine_with(), PandaNode::combine_with(), GeomNode::combine_with(), CollisionNode::combine_with(), Character::combine_with(), PGItem::cull_callback(), FactoryParams::get_param_of_type(), CollisionHandlerPusher::handle_entries(), SceneGraphReducer::r_flatten(), ConnectionWriter::send(), FltToEggLevelState::set_transform(), and VirtualFileSystem::unmount().
bool TypedObject::is_of_type | ( | TypeHandle | handle | ) | const [inline, inherited] |
Returns true if the current object is or derives from the indicated type.
Definition at line 63 of file typedObject.I.
References TypeHandle::is_derived_from().
Referenced by EggSliderData::add_back_pointer(), EggJointData::add_back_pointer(), CIntervalManager::add_c_interval(), XFileNode::add_child(), CollisionTraverser::add_collider(), CollisionHandlerPhysical::add_collider(), EggXfmSAnim::add_data(), CharacterJointBundle::add_node(), NonlinearImager::add_screen(), EggGroupNode::apply_first_attribute(), EggGroupNode::apply_last_attribute(), DeferredNodeProperty::apply_to_node(), RecorderController::begin_playback(), NodePath::clear_clip_plane(), EggGroupNode::clear_connected_shading(), NodePath::clear_light(), EggBase::convert_paths(), NodePath::decode_from_bam_stream(), VrpnClient::disconnect_device(), PhysicsManager::do_physics(), GraphicsStateGuardian::fetch_specified_part(), EggRenderState::fill_state(), AnimBundleNode::find_anim_bundle(), EggGroupNode::find_coordsys_entry(), XFile::find_data_object(), Character::find_joint(), EggGroupNode::find_materials(), Character::find_slider(), XFile::find_template(), EggGroupNode::find_textures(), EggMaterialCollection::find_used_materials(), EggTextureCollection::find_used_textures(), EggGroupNode::force_filenames(), EggJointData::force_initial_rest_frame(), WindowFramework::get_aspect_2d(), EggPoolUniquifier::get_category(), EggGroupUniquifier::get_category(), EggGroupNode::get_connected_shading(), PandaFramework::get_mouse(), FactoryParams::get_param_of_type(), EggGroupNode::has_absolute_pathnames(), NodePath::has_clip_plane(), NodePath::has_clip_plane_off(), NodePath::has_light(), PandaFramework::hide_collision_solids(), x11GraphicsWindow::open_window(), eglGraphicsWindow::open_window(), EggNode::parse_egg(), CharacterMaker::part_to_node(), EggGroupNode::post_apply_flat_attribute(), EggBinner::prepare_node(), PortalClipper::prepare_portal(), NodePath::project_texture(), EggMatrixTablePointer::quantize_channels(), ParametricCurveCollection::r_add_curves(), SceneGraphReducer::r_collect_vertex_data(), EggGroupNode::r_load_externals(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), EggGroupNode::remove_invalid_primitives(), EggGroupNode::remove_unused_vertices(), EggLoader::reparent_decals(), EggMaterialCollection::replace_materials(), EggTextureCollection::replace_textures(), EggGroupNode::resolve_filenames(), EggGroupNode::reverse_vertex_ordering(), NodePath::set_clip_plane(), NodePath::set_clip_plane_off(), NodePath::set_light(), ProjectionScreen::set_projector(), NonlinearImager::set_source_camera(), EggXfmSAnim::set_value(), NonlinearImager::set_viewer_camera(), PandaFramework::show_collision_solids(), BamCache::store(), XFileToEggConverter::strip_nodes(), EggGroupNode::strip_normals(), DataGraphTraverser::traverse(), DataGraphTraverser::traverse_below(), EggGroupNode::triangulate_polygons(), EggGroupNode::unify_attributes(), EggNameUniquifier::uniquify(), NodeCullCallbackData::upcall(), PhysicsCollisionHandler::validate_target(), EggXfmSAnim::write(), EggGroup::write(), EggToDXFLayer::write_3d_face(), and EggToDXFLayer::write_entities().
bool AnimControl::is_pending | ( | ) | const [inline] |
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.
Definition at line 27 of file animControl.I.
Referenced by output().
bool AnimInterface::is_playing | ( | ) | const [inline, inherited] |
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).
Definition at line 289 of file animInterface.I.
Referenced by AnimControlCollection::is_playing().
void ReferenceCount::local_object | ( | ) | [inline, inherited] |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
This allows the object to be passed to functions that will increment and decrement the object's reference count temporarily, and it will prevent the object from being deleted (inappropriately), when the reference count returns to zero. It actually achieves this by setting a large positive value in the reference count field.
Definition at line 276 of file referenceCount.I.
Referenced by PGTop::cull_callback(), BoundingSphere::extend_by_hexahedron(), AsyncTaskManager::find_task(), AsyncTaskManager::find_tasks(), and AsyncTaskManager::find_tasks_matching().
void AnimInterface::loop | ( | bool | restart | ) | [inline, inherited] |
Starts the entire animation looping.
If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current frame.
Definition at line 57 of file animInterface.I.
References AnimInterface::get_num_frames().
Referenced by AnimControlCollection::loop(), and EggLoader::start_sequences().
void AnimInterface::loop | ( | bool | restart, |
double | from, | ||
double | to | ||
) | [inline, 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.
Definition at line 71 of file animInterface.I.
References AnimInterface::animation_activated().
void AnimControl::mark_channels | ( | bool | frame_blend_flag | ) |
Marks this point as the point of reference for the next call to channel_has_changed().
Definition at line 233 of file animControl.cxx.
References AnimInterface::get_frac(), and AnimInterface::get_frame().
Referenced by PartBundle::force_update(), and PartBundle::update().
void AnimControl::output | ( | ostream & | out | ) | const [virtual] |
Outputs the Namable.
This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.
Reimplemented from Namable.
Definition at line 192 of file animControl.cxx.
References get_part(), has_anim(), and is_pending().
void AnimInterface::pingpong | ( | bool | restart | ) | [inline, 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.
Definition at line 89 of file animInterface.I.
References AnimInterface::get_num_frames().
void AnimInterface::pingpong | ( | bool | restart, |
double | from, | ||
double | to | ||
) | [inline, inherited] |
Loops the animation from the frame "from" to and including the frame "to", and then back in the opposite direction, indefinitely.
Definition at line 101 of file animInterface.I.
References AnimInterface::animation_activated().
void AnimInterface::play | ( | double | from, |
double | to | ||
) | [inline, 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.
Definition at line 41 of file animInterface.I.
References AnimInterface::animation_activated().
void AnimInterface::play | ( | ) | [inline, inherited] |
Runs the entire animation from beginning to end and stops.
Definition at line 23 of file animInterface.I.
References AnimInterface::get_num_frames().
Referenced by AnimControlCollection::play().
void AnimInterface::pose | ( | double | frame | ) | [inline, inherited] |
Sets the animation to the indicated frame and holds it there.
Definition at line 132 of file animInterface.I.
References AnimInterface::animation_activated().
Referenced by AnimControlCollection::pose().
void ReferenceCount::ref | ( | ) | const [inline, 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.
Definition at line 179 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by CachedTypedWritableReferenceCount::cache_ref(), TypedWritable::decode_raw_from_bam_stream(), NodeCachedReferenceCount::node_ref(), NodeReferenceCount::node_ref(), BamCacheRecord::set_data(), CullableObject::set_draw_callback(), and ModelRoot::set_reference().
void AnimControl::set_anim_model | ( | PandaNode * | model | ) | [inline] |
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.
Definition at line 104 of file animControl.I.
void AnimControl::set_bound_joints | ( | const BitArray & | bound_joints | ) |
Called to initialize the AnimControl with its array of bound_joints, before setup_anim() has completed.
Definition at line 91 of file animControl.cxx.
void AnimInterface::set_frame_rate | ( | double | frame_rate | ) | [inline, protected, inherited] |
Should be called by a derived class to specify the native frame rate of the animation.
It is legal to call this after the animation has already started.
Reimplemented in SequenceNode.
Definition at line 302 of file animInterface.I.
Referenced by AnimControl(), and setup_anim().
void AnimInterface::set_num_frames | ( | int | num_frames | ) | [inline, protected, inherited] |
Should be called by a derived class to specify the number of frames of the animation.
It is legal to call this after the animation has already started, but doing so may suddenly change the apparent current frame number.
Definition at line 317 of file animInterface.I.
Referenced by AnimControl(), and setup_anim().
void AnimControl::set_pending_done_event | ( | const 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.
Definition at line 155 of file animControl.cxx.
void AnimInterface::set_play_rate | ( | double | play_rate | ) | [inline, 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.
Definition at line 150 of file animInterface.I.
Referenced by WindowFramework::stagger_animations().
void AnimControl::setup_anim | ( | PartBundle * | part, |
AnimBundle * | anim, | ||
int | channel_index, | ||
const BitArray & | bound_joints | ||
) |
This can only be called once for a given AnimControl.
It is used to supply the AnimBundle and related information.
Definition at line 64 of file animControl.cxx.
References ConditionVarFullDirect::notify_all(), AnimInterface::set_frame_rate(), and AnimInterface::set_num_frames().
Referenced by PartBundle::do_bind_anim().
void AnimInterface::stop | ( | ) | [inline, inherited] |
Stops a currently playing or looping animation right where it is.
The animation remains posed at the current frame.
Definition at line 117 of file animInterface.I.
Referenced by AnimControlCollection::stop().
bool ReferenceCount::test_ref_count_integrity | ( | ) | const [inline, 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.
Definition at line 236 of file referenceCount.I.
References ReferenceCount::do_test_ref_count_integrity().
Referenced by EggGroupNode::add_child(), InternalName::find_ancestor(), InternalName::get_ancestor(), ReferenceCount::get_ref_count(), InternalName::get_top(), ReferenceCount::ref(), EggVertex::test_gref_integrity(), EggVertex::test_pref_integrity(), EggNode::test_under_integrity(), EggPrimitive::test_vref_integrity(), EggGroup::test_vref_integrity(), MouseWatcher::throw_event_pattern(), ReferenceCount::unref(), and EggNode::update_under().
bool ReferenceCount::test_ref_count_nonzero | ( | ) | const [inline, inherited] |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
Returns true if ok, false otherwise.
Definition at line 252 of file referenceCount.I.
References ReferenceCount::do_test_ref_count_nonzero().
Referenced by CopyOnWritePointer::test_ref_count_nonzero().
bool ReferenceCount::unref | ( | ) | const [inline, virtual, 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, GeomVertexFormat, InternalName, RenderAttrib, RenderEffects, RenderState, and TransformState.
Definition at line 214 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by CachedTypedWritableReferenceCount::cache_unref(), TypedWritable::decode_raw_from_bam_stream(), RenderEffect::finalize(), NodeCachedReferenceCount::node_unref(), NodeReferenceCount::node_unref(), TransformState::unref(), RenderState::unref(), RenderEffects::unref(), RenderAttrib::unref(), InternalName::unref(), GeomVertexFormat::unref(), and GeomVertexArrayFormat::unref().
void AnimControl::wait_pending | ( | ) |
Blocks the current thread until the AnimControl has finished loading and is fully bound.
Definition at line 131 of file animControl.cxx.
References Thread::get_current_thread(), and ConditionVarFullDirect::wait().
Referenced by PartBundle::wait_pending().
void ReferenceCount::weak_ref | ( | WeakPointerToVoid * | ptv | ) | [inline, inherited] |
Adds the indicated PointerToVoid as a weak reference to this object.
Definition at line 321 of file referenceCount.I.
References WeakReferenceList::add_reference(), and ReferenceCount::get_weak_list().
void ReferenceCount::weak_unref | ( | WeakPointerToVoid * | ptv | ) | [inline, inherited] |
Removes the indicated PointerToVoid as a weak reference to this object.
It must have previously been added via a call to weak_ref().
Definition at line 334 of file referenceCount.I.
References WeakReferenceList::clear_reference(), and ReferenceCount::has_weak_list().
void AnimInterface::write_datagram | ( | BamWriter * | manager, |
Datagram & | dg | ||
) | [protected, virtual, inherited] |
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented in SequenceNode.
Definition at line 100 of file animInterface.cxx.
References Datagram::add_int32(), and BamWriter::write_cdata().