Panda3D
|
A constraint interval that will constrain the position of one node to the position of another. More...
#include "cConstrainPosInterval.h"
Public Types | |
enum | EventType { ET_initialize, ET_instant, ET_step, ET_finalize, ET_reverse_initialize, ET_reverse_instant, ET_reverse_finalize, ET_interrupt } |
enum | State { S_initial, S_started, S_paused, S_final } |
Public Member Functions | |
CConstrainPosInterval (const string &name, double duration, const NodePath &node, const NodePath &target, bool wrt, const LVecBase3f posOffset=LVector3f::zero()) | |
Constructs a constraint interval that will constrain the position of one node to the position of another. | |
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 | check_t_callback () |
Returns true if the wants_t_callback() flag is true and the interval's t value has changed since the last call to check_t_callback(), false otherwise. | |
void | clear_to_initial () |
Pauses the interval, if it is playing, and resets its state to its initial state, abandoning any state changes already in progress in the middle of the interval. | |
void | finish () |
Stops the interval from playing and sets it to its final state. | |
virtual TypeHandle | force_init_type () |
bool | get_auto_finish () const |
Returns the state of the 'auto_finish' flag. | |
bool | get_auto_pause () const |
Returns the state of the 'auto_pause' flag. | |
int | get_best_parent_from_Set (const std::set< int > &) const |
const string & | get_done_event () const |
Returns the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own. | |
double | get_duration () const |
Returns the duration of the interval in seconds. | |
CIntervalManager * | get_manager () const |
Returns the CIntervalManager object which will be responsible for playing this interval. | |
const string & | get_name () const |
Returns the interval's name. | |
const NodePath & | get_node () const |
Returns the "source" node. | |
bool | get_open_ended () const |
Returns the state of the "open_ended" flag. | |
double | get_play_rate () const |
Returns the play rate as set by the last call to start(), loop(), or set_play_rate(). | |
int | get_ref_count () const |
Returns the current reference count. | |
State | get_state () const |
Indicates the state the interval believes it is in: whether it has been started, is currently in the middle, or has been finalized. | |
double | get_t () const |
Returns the current time of the interval: the last value of t passed to priv_initialize(), priv_step(), or priv_finalize(). | |
const NodePath & | get_target () const |
Returns the "target" node. | |
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. | |
bool | get_wants_t_callback () const |
Returns the state of the 'wants_t_callback' flag. | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. | |
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_playing () const |
Returns true if the interval is currently playing, false otherwise. | |
bool | is_stopped () const |
Returns true if the interval is in either its initial or final states (but not in a running or paused state). | |
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 (double start_t=0.0, double end_t=-1.0, double play_rate=1.0) |
Starts the interval playing by registering it with the current CIntervalManager. | |
void | mark_dirty () |
Called by a derived class to indicate the interval has been changed internally and must be recomputed before its duration may be returned. | |
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 *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
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) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
void * | operator new[] (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
virtual void | output (ostream &out) const |
double | pause () |
Stops the interval from playing but leaves it in its current state. | |
void | priv_do_event (double t, EventType event) |
Calls the appropriate event function indicated by the EventType. | |
virtual void | priv_finalize () |
This is called to stop an interval, forcing it to whatever state it would be after it played all the way through. | |
virtual void | priv_initialize (double t) |
This replaces the first call to priv_step(), and indicates that the interval has just begun. | |
virtual void | priv_instant () |
This is called in lieu of priv_initialize() . | |
virtual void | priv_interrupt () |
This is called while the interval is playing to indicate that it is about to be interrupted; that is, priv_step() will not be called for a length of time. | |
virtual void | priv_reverse_finalize () |
Called generally following a priv_reverse_initialize(), this indicates the interval should set itself to the initial state. | |
virtual void | priv_reverse_initialize (double t) |
Similar to priv_initialize(), but this is called when the interval is being played backwards; it indicates that the interval should start at the finishing state and undo any intervening intervals. | |
virtual void | priv_reverse_instant () |
This is called in lieu of priv_reverse_initialize() | |
virtual void | priv_step (double t) |
Advances the time on the interval. | |
void | ref () const |
Explicitly increments the reference count. | |
void | resume (double start_t) |
Restarts the interval from the indicated point after a previous call to pause(). | |
void | resume () |
Restarts the interval from its current point after a previous call to pause(). | |
void | resume_until (double end_t) |
Restarts the interval from the current point after a previous call to pause() (or a previous play-to-point-and-stop), to play until the indicated point and then stop. | |
void | set_auto_finish (bool auto_finish) |
Changes the state of the 'auto_finish' flag. | |
void | set_auto_pause (bool auto_pause) |
Changes the state of the 'auto_pause' flag. | |
void | set_done_event (const string &event) |
Sets the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own. | |
void | set_manager (CIntervalManager *manager) |
Indicates the CIntervalManager object which will be responsible for playing this interval. | |
void | set_play_rate (double play_rate) |
Changes the play rate of the interval. | |
void | set_t (double t) |
Explicitly sets the time within the interval. | |
void | set_wants_t_callback (bool wants_t_callback) |
Changes the state of the 'wants_t_callback' flag. | |
void | setup_play (double start_time, double end_time, double play_rate, bool do_loop) |
Called to prepare the interval for automatic timed playback, e.g. | |
void | setup_resume () |
Called to prepare the interval for restarting at the current point within the interval after an interruption. | |
void | setup_resume_until (double end_t) |
Called to prepare the interval for restarting from the current point after a previous call to pause() (or a previous play-to-point-and-stop), to play until the indicated point and then stop. | |
void | start (double start_t=0.0, double end_t=-1.0, double play_rate=1.0) |
Starts the interval playing by registering it with the current CIntervalManager. | |
bool | step_play () |
Should be called once per frame to execute the automatic timed playback begun with setup_play(). | |
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 | 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. | |
virtual void | write (ostream &out, int indent_level) const |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. | |
Public Attributes | |
bool | bogus_variable |
Protected Member Functions | |
void | check_started (TypeHandle type, const char *method_name) const |
Issues a warning if our internal state is not in one of the started states. | |
void | check_stopped (TypeHandle type, const char *method_name) const |
Issues a warning if our internal state is not in one of the stopped states. | |
virtual void | do_recompute () |
Does whatever processing is necessary to recompute the interval after a call to mark_dirty() has indicated a recomputation is necessary. | |
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 | interval_done () |
Called internally whenever the interval reaches its final state. | |
void | recompute () const |
Calls do_recompute() if the dirty flag has been set. | |
Protected Attributes | |
bool | _auto_finish |
bool | _auto_pause |
double | _clock_start |
double | _curr_t |
bool | _do_loop |
string | _done_event |
double | _duration |
double | _end_t |
bool | _end_t_at_end |
double | _last_t_callback |
int | _loop_count |
CIntervalManager * | _manager |
string | _name |
double | _play_rate |
string | _pname |
double | _start_t |
bool | _start_t_at_start |
State | _state |
bool | _wants_t_callback |
A constraint interval that will constrain the position of one node to the position of another.
Definition at line 28 of file cConstrainPosInterval.h.
CConstrainPosInterval::CConstrainPosInterval | ( | const string & | name, |
double | duration, | ||
const NodePath & | node, | ||
const NodePath & | target, | ||
bool | wrt, | ||
const LVecBase3f | posOffset = LVector3f::zero() |
||
) |
Constructs a constraint interval that will constrain the position of one node to the position of another.
If wrt is true, the node's position will be transformed into the target node's parent's space before being copied. If wrt is false, the target node's local position will be copied unaltered.
Definition at line 33 of file cConstrainPosInterval.cxx.
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.
void CInterval::check_started | ( | TypeHandle | type, |
const char * | method_name | ||
) | const [inline, protected, inherited] |
Issues a warning if our internal state is not in one of the started states.
Definition at line 275 of file cInterval.I.
References CInterval::get_name(), and TypeHandle::get_name().
Referenced by CInterval::priv_finalize(), CInterval::priv_interrupt(), CInterval::priv_reverse_finalize(), priv_step(), CConstrainTransformInterval::priv_step(), CInterval::priv_step(), CMetaInterval::priv_step(), CLerpAnimEffectInterval::priv_step(), CConstrainHprInterval::priv_step(), CConstrainPosHprInterval::priv_step(), WaitInterval::priv_step(), and CLerpNodePathInterval::priv_step().
void CInterval::check_stopped | ( | TypeHandle | type, |
const char * | method_name | ||
) | const [inline, protected, inherited] |
Issues a warning if our internal state is not in one of the stopped states.
Definition at line 259 of file cInterval.I.
References CInterval::get_name(), and TypeHandle::get_name().
Referenced by CMetaInterval::priv_initialize(), CLerpNodePathInterval::priv_initialize(), CInterval::priv_initialize(), CLerpNodePathInterval::priv_instant(), CInterval::priv_instant(), HideInterval::priv_instant(), CMetaInterval::priv_instant(), ShowInterval::priv_instant(), CMetaInterval::priv_reverse_initialize(), CLerpNodePathInterval::priv_reverse_initialize(), CInterval::priv_reverse_initialize(), CLerpNodePathInterval::priv_reverse_instant(), CMetaInterval::priv_reverse_instant(), HideInterval::priv_reverse_instant(), CInterval::priv_reverse_instant(), and ShowInterval::priv_reverse_instant().
bool CInterval::check_t_callback | ( | ) | [inline, inherited] |
Returns true if the wants_t_callback() flag is true and the interval's t value has changed since the last call to check_t_callback(), false otherwise.
Definition at line 232 of file cInterval.I.
References CInterval::get_t(), and CInterval::get_wants_t_callback().
void CInterval::clear_to_initial | ( | ) | [inherited] |
Pauses the interval, if it is playing, and resets its state to its initial state, abandoning any state changes already in progress in the middle of the interval.
Calling this is like pausing the interval and discarding it, creating a new one in its place.
Definition at line 268 of file cInterval.cxx.
References CInterval::pause().
void CInterval::do_recompute | ( | ) | [protected, virtual, inherited] |
Does whatever processing is necessary to recompute the interval after a call to mark_dirty() has indicated a recomputation is necessary.
Reimplemented in CMetaInterval.
Definition at line 777 of file cInterval.cxx.
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 CInterval::finish | ( | ) | [inherited] |
Stops the interval from playing and sets it to its final state.
Definition at line 239 of file cInterval.cxx.
References CIntervalManager::find_c_interval(), CInterval::get_name(), CInterval::get_state(), CInterval::priv_finalize(), CInterval::priv_instant(), and CIntervalManager::remove_c_interval().
bool CInterval::get_auto_finish | ( | ) | const [inline, inherited] |
Returns the state of the 'auto_finish' flag.
See set_auto_finish().
Definition at line 165 of file cInterval.I.
bool CInterval::get_auto_pause | ( | ) | const [inline, inherited] |
Returns the state of the 'auto_pause' flag.
See set_auto_pause().
Definition at line 138 of file cInterval.I.
const string & CInterval::get_done_event | ( | ) | const [inline, inherited] |
Returns the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own.
Definition at line 99 of file cInterval.I.
double CInterval::get_duration | ( | ) | const [inline, inherited] |
Returns the duration of the interval in seconds.
Definition at line 32 of file cInterval.I.
References CInterval::recompute().
Referenced by CLerpInterval::compute_delta(), CMetaInterval::priv_finalize(), CInterval::priv_finalize(), CMetaInterval::priv_instant(), CLerpNodePathInterval::priv_instant(), CInterval::priv_instant(), CInterval::setup_play(), CInterval::setup_resume_until(), and CInterval::step_play().
CIntervalManager * CInterval::get_manager | ( | ) | const [inline, inherited] |
Returns the CIntervalManager object which will be responsible for playing this interval.
Note that this can only return a C++ object; if the particular CIntervalManager object has been extended in the scripting language, this will return the encapsulated C++ object, not the full extended object.
Definition at line 220 of file cInterval.I.
const string & CInterval::get_name | ( | ) | const [inline, inherited] |
Returns the interval's name.
Definition at line 22 of file cInterval.I.
Referenced by CIntervalManager::add_c_interval(), CInterval::check_started(), CInterval::check_stopped(), CInterval::finish(), CInterval::is_playing(), and CInterval::pause().
const NodePath & CConstrainPosInterval::get_node | ( | ) | const [inline] |
Returns the "source" node.
Definition at line 22 of file cConstrainPosInterval.I.
bool CInterval::get_open_ended | ( | ) | const [inline, inherited] |
Returns the state of the "open_ended" flag.
This is primarily intended for instantaneous intervals like FunctionIntervals; it indicates true if the interval has some lasting effect that should be applied even if the interval doesn't get started until after its finish time, or false if the interval is a transitive thing that doesn't need to be called late.
Definition at line 49 of file cInterval.I.
Referenced by CInterval::step_play().
double CInterval::get_play_rate | ( | ) | const [inherited] |
Returns the play rate as set by the last call to start(), loop(), or set_play_rate().
Definition at line 294 of file cInterval.cxx.
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().
CInterval::State CInterval::get_state | ( | ) | const [inline, inherited] |
Indicates the state the interval believes it is in: whether it has been started, is currently in the middle, or has been finalized.
Definition at line 61 of file cInterval.I.
Referenced by CInterval::finish(), CInterval::pause(), and CInterval::set_t().
double CInterval::get_t | ( | ) | const [inline, inherited] |
Returns the current time of the interval: the last value of t passed to priv_initialize(), priv_step(), or priv_finalize().
Definition at line 111 of file cInterval.I.
Referenced by CInterval::check_t_callback(), CInterval::pause(), and CInterval::setup_resume().
const NodePath & CConstrainPosInterval::get_target | ( | ) | const [inline] |
Returns the "target" node.
Definition at line 32 of file cConstrainPosInterval.I.
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().
bool CInterval::get_wants_t_callback | ( | ) | const [inline, inherited] |
Returns the state of the 'wants_t_callback' flag.
Definition at line 191 of file cInterval.I.
Referenced by CInterval::check_t_callback().
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 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().
static void CConstrainPosInterval::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from CConstraintInterval.
Definition at line 50 of file cConstrainPosInterval.h.
References CConstraintInterval::init_type().
void CInterval::interval_done | ( | ) | [protected, inherited] |
Called internally whenever the interval reaches its final state.
Definition at line 763 of file cInterval.cxx.
References CIntervalManager::get_event_queue().
Referenced by CInterval::priv_finalize(), CMetaInterval::priv_finalize(), CInterval::priv_instant(), and CMetaInterval::priv_instant().
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 CInterval::is_playing | ( | ) | const [inherited] |
Returns true if the interval is currently playing, false otherwise.
Definition at line 282 of file cInterval.cxx.
References CIntervalManager::find_c_interval(), and CInterval::get_name().
Referenced by CInterval::set_play_rate(), and CInterval::set_t().
bool CInterval::is_stopped | ( | ) | const [inline, inherited] |
Returns true if the interval is in either its initial or final states (but not in a running or paused state).
Definition at line 73 of file cInterval.I.
Referenced by CInterval::step_play().
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 CInterval::loop | ( | double | start_t = 0.0 , |
double | end_t = -1.0 , |
||
double | play_rate = 1.0 |
||
) | [inherited] |
Starts the interval playing by registering it with the current CIntervalManager.
The interval will play until it is interrupted with finish() or pause(), looping back to start_t when it reaches end_t.
If end_t is less than zero, it indicates the end of the interval.
Definition at line 169 of file cInterval.cxx.
References CIntervalManager::add_c_interval(), and CInterval::setup_play().
void CInterval::mark_dirty | ( | ) | [inherited] |
Called by a derived class to indicate the interval has been changed internally and must be recomputed before its duration may be returned.
Definition at line 746 of file cInterval.cxx.
Referenced by CMetaInterval::add_c_interval(), CMetaInterval::add_ext_index(), CMetaInterval::pop_level(), CMetaInterval::push_level(), CMetaInterval::set_interval_start_time(), and CMetaInterval::set_precision().
double CInterval::pause | ( | ) | [inherited] |
Stops the interval from playing but leaves it in its current state.
It may later be resumed from this point by calling resume().
Definition at line 182 of file cInterval.cxx.
References CIntervalManager::find_c_interval(), CInterval::get_name(), CInterval::get_state(), CInterval::get_t(), CInterval::priv_interrupt(), and CIntervalManager::remove_c_interval().
Referenced by CInterval::clear_to_initial(), and CInterval::set_play_rate().
void CInterval::priv_do_event | ( | double | t, |
EventType | event | ||
) | [inherited] |
Calls the appropriate event function indicated by the EventType.
Definition at line 325 of file cInterval.cxx.
References CInterval::priv_finalize(), CInterval::priv_initialize(), CInterval::priv_instant(), CInterval::priv_interrupt(), CInterval::priv_reverse_finalize(), CInterval::priv_reverse_initialize(), CInterval::priv_reverse_instant(), and CInterval::priv_step().
void CInterval::priv_finalize | ( | ) | [virtual, inherited] |
This is called to stop an interval, forcing it to whatever state it would be after it played all the way through.
It's generally invoked by set_final_t().
Reimplemented in CMetaInterval.
Definition at line 422 of file cInterval.cxx.
References CInterval::check_started(), CInterval::get_duration(), CInterval::interval_done(), and CInterval::priv_step().
Referenced by CInterval::finish(), CInterval::priv_do_event(), and CInterval::step_play().
void CInterval::priv_initialize | ( | double | t | ) | [virtual, inherited] |
This replaces the first call to priv_step(), and indicates that the interval has just begun.
This may be overridden by derived classes that need to do some explicit initialization on the first call.
Reimplemented in CLerpNodePathInterval, and CMetaInterval.
Definition at line 374 of file cInterval.cxx.
References CInterval::check_stopped(), CInterval::priv_step(), and CInterval::recompute().
Referenced by CInterval::priv_do_event(), CInterval::set_t(), and CInterval::step_play().
void CInterval::priv_instant | ( | ) | [virtual, inherited] |
This is called in lieu of priv_initialize() .
. priv_step() .. priv_finalize(), when everything is to happen within one frame. The interval should initialize itself, then leave itself in the final state.
Reimplemented in CLerpNodePathInterval, CMetaInterval, HideInterval, and ShowInterval.
Definition at line 390 of file cInterval.cxx.
References CInterval::check_stopped(), CInterval::get_duration(), CInterval::interval_done(), CInterval::priv_step(), and CInterval::recompute().
Referenced by CInterval::finish(), CInterval::priv_do_event(), and CInterval::step_play().
void CInterval::priv_interrupt | ( | ) | [virtual, inherited] |
This is called while the interval is playing to indicate that it is about to be interrupted; that is, priv_step() will not be called for a length of time.
But the interval should remain in its current state in anticipation of being eventually restarted when the calls to priv_step() eventually resume.
The purpose of this function is to allow self-running intervals like sound intervals to stop the actual sound playback during the pause.
Reimplemented in CMetaInterval.
Definition at line 493 of file cInterval.cxx.
References CInterval::check_started().
Referenced by CInterval::pause(), CInterval::priv_do_event(), CInterval::set_t(), and CInterval::step_play().
void CInterval::priv_reverse_finalize | ( | ) | [virtual, inherited] |
Called generally following a priv_reverse_initialize(), this indicates the interval should set itself to the initial state.
Reimplemented in CMetaInterval.
Definition at line 472 of file cInterval.cxx.
References CInterval::check_started(), and CInterval::priv_step().
Referenced by CInterval::priv_do_event(), and CInterval::step_play().
void CInterval::priv_reverse_initialize | ( | double | t | ) | [virtual, inherited] |
Similar to priv_initialize(), but this is called when the interval is being played backwards; it indicates that the interval should start at the finishing state and undo any intervening intervals.
Reimplemented in CLerpNodePathInterval, and CMetaInterval.
Definition at line 439 of file cInterval.cxx.
References CInterval::check_stopped(), CInterval::priv_step(), and CInterval::recompute().
Referenced by CInterval::priv_do_event(), CInterval::set_t(), and CInterval::step_play().
void CInterval::priv_reverse_instant | ( | ) | [virtual, inherited] |
This is called in lieu of priv_reverse_initialize()
. priv_step() .. priv_reverse_finalize(), when everything is to happen within one frame. The interval should initialize itself, then leave itself in the initial state.
Reimplemented in CLerpNodePathInterval, CMetaInterval, HideInterval, and ShowInterval.
Definition at line 456 of file cInterval.cxx.
References CInterval::check_stopped(), CInterval::priv_step(), and CInterval::recompute().
Referenced by CInterval::priv_do_event(), and CInterval::step_play().
void CConstrainPosInterval::priv_step | ( | double | t | ) | [virtual] |
Advances the time on the interval.
The time may either increase (the normal case) or decrease (e.g. if the interval is being played by a slider).
Reimplemented from CInterval.
Definition at line 52 of file cConstrainPosInterval.cxx.
References CInterval::check_started(), NodePath::get_name(), NodePath::get_pos(), NodePath::is_empty(), NodePath::is_same_graph(), NodePath::set_pos(), and LVector3f::zero().
void CInterval::recompute | ( | ) | const [inline, protected, inherited] |
Calls do_recompute() if the dirty flag has been set.
Definition at line 246 of file cInterval.I.
Referenced by CInterval::get_duration(), CMetaInterval::get_interval_end_time(), CMetaInterval::get_interval_start_time(), CMetaInterval::priv_initialize(), CLerpNodePathInterval::priv_initialize(), CInterval::priv_initialize(), CMetaInterval::priv_instant(), CLerpNodePathInterval::priv_instant(), CInterval::priv_instant(), CMetaInterval::priv_reverse_initialize(), CLerpNodePathInterval::priv_reverse_initialize(), CInterval::priv_reverse_initialize(), CMetaInterval::priv_reverse_instant(), CLerpNodePathInterval::priv_reverse_instant(), CInterval::priv_reverse_instant(), and CMetaInterval::timeline().
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 CInterval::resume | ( | ) | [inherited] |
Restarts the interval from its current point after a previous call to pause().
Definition at line 200 of file cInterval.cxx.
References CIntervalManager::add_c_interval(), and CInterval::setup_resume().
Referenced by CInterval::set_play_rate().
void CInterval::resume | ( | double | start_t | ) | [inherited] |
Restarts the interval from the indicated point after a previous call to pause().
Definition at line 212 of file cInterval.cxx.
References CIntervalManager::add_c_interval(), CInterval::set_t(), and CInterval::setup_resume().
void CInterval::resume_until | ( | double | end_t | ) | [inherited] |
Restarts the interval from the current point after a previous call to pause() (or a previous play-to-point-and-stop), to play until the indicated point and then stop.
Definition at line 227 of file cInterval.cxx.
References CIntervalManager::add_c_interval(), and CInterval::setup_resume_until().
void CInterval::set_auto_finish | ( | bool | auto_finish | ) | [inline, inherited] |
Changes the state of the 'auto_finish' flag.
If this is true, the interval may be arbitrarily finished when the system needs to reset due to some external event by calling CIntervalManager::interrupt(). If this is false (the default), the interval must always be explicitly finished or paused.
Definition at line 154 of file cInterval.I.
void CInterval::set_auto_pause | ( | bool | auto_pause | ) | [inline, inherited] |
Changes the state of the 'auto_pause' flag.
If this is true, the interval may be arbitrarily interrupted when the system needs to reset due to some external event by calling CIntervalManager::interrupt(). If this is false (the default), the interval must always be explicitly finished or paused.
Definition at line 127 of file cInterval.I.
void CInterval::set_done_event | ( | const string & | event | ) | [inline, inherited] |
Sets the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own.
Definition at line 86 of file cInterval.I.
void CInterval::set_manager | ( | CIntervalManager * | manager | ) | [inline, inherited] |
Indicates the CIntervalManager object which will be responsible for playing this interval.
This defaults to the global CIntervalManager; you should need to change this only if you have special requirements for playing this interval.
Definition at line 205 of file cInterval.I.
void CInterval::set_play_rate | ( | double | play_rate | ) | [inherited] |
Changes the play rate of the interval.
If the interval is already started, this changes its speed on-the-fly. Note that since play_rate is a parameter to start() and loop(), the next call to start() or loop() will reset this parameter.
Definition at line 308 of file cInterval.cxx.
References CInterval::is_playing(), CInterval::pause(), and CInterval::resume().
void CInterval::set_t | ( | double | t | ) | [inherited] |
Explicitly sets the time within the interval.
Normally, you would use start() .. finish() to let the time play normally, but this may be used to set the time to some particular value.
Definition at line 95 of file cInterval.cxx.
References CInterval::get_state(), CInterval::is_playing(), CInterval::priv_initialize(), CInterval::priv_interrupt(), CInterval::priv_reverse_initialize(), CInterval::priv_step(), and CInterval::setup_resume().
Referenced by CInterval::resume().
void CInterval::set_wants_t_callback | ( | bool | wants_t_callback | ) | [inline, inherited] |
Changes the state of the 'wants_t_callback' flag.
If this is true, the interval will be returned by CIntervalManager::get_event() each time the interval's time value has been changed, regardless of whether it has any external events.
Definition at line 179 of file cInterval.I.
void CInterval::setup_play | ( | double | start_t, |
double | end_t, | ||
double | play_rate, | ||
bool | do_loop | ||
) | [inherited] |
Called to prepare the interval for automatic timed playback, e.g.
via a Python task. The interval will be played from start_t to end_t, at a time factor specified by play_rate. start_t must always be less than end_t (except for the exception for end_t == -1, below), but if play_rate is negative the interval will be played backwards.
Specify end_t of -1 to play the entire interval from start_t.
Call step_play() repeatedly to execute the interval.
Definition at line 538 of file cInterval.cxx.
References CInterval::get_duration(), ClockObject::get_frame_time(), and ClockObject::get_global_clock().
Referenced by CInterval::loop(), and CInterval::start().
void CInterval::setup_resume | ( | ) | [inherited] |
Called to prepare the interval for restarting at the current point within the interval after an interruption.
Definition at line 577 of file cInterval.cxx.
References ClockObject::get_frame_time(), ClockObject::get_global_clock(), and CInterval::get_t().
Referenced by CInterval::resume(), CInterval::set_t(), and CInterval::setup_resume_until().
void CInterval::setup_resume_until | ( | double | end_t | ) | [inherited] |
Called to prepare the interval for restarting from the current point after a previous call to pause() (or a previous play-to-point-and-stop), to play until the indicated point and then stop.
Definition at line 597 of file cInterval.cxx.
References CInterval::get_duration(), and CInterval::setup_resume().
Referenced by CInterval::resume_until().
void CInterval::start | ( | double | start_t = 0.0 , |
double | end_t = -1.0 , |
||
double | play_rate = 1.0 |
||
) | [inherited] |
Starts the interval playing by registering it with the current CIntervalManager.
The interval will play to the end and stop.
If end_t is less than zero, it indicates the end of the interval.
Definition at line 151 of file cInterval.cxx.
References CIntervalManager::add_c_interval(), and CInterval::setup_play().
bool CInterval::step_play | ( | ) | [inherited] |
Should be called once per frame to execute the automatic timed playback begun with setup_play().
Returns true if the interval should continue, false if it is done and should stop.
Definition at line 621 of file cInterval.cxx.
References CInterval::get_duration(), ClockObject::get_frame_time(), ClockObject::get_global_clock(), CInterval::get_open_ended(), CInterval::is_stopped(), CInterval::priv_finalize(), CInterval::priv_initialize(), CInterval::priv_instant(), CInterval::priv_interrupt(), CInterval::priv_reverse_finalize(), CInterval::priv_reverse_initialize(), CInterval::priv_reverse_instant(), and CInterval::priv_step().
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 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().