#include <partGroup.h>
Inheritance diagram for PartGroup:
Public Types | |
enum | HierarchyMatchFlags { HMF_ok_part_extra = 0x01, HMF_ok_anim_extra = 0x02, HMF_ok_wrong_root_name = 0x04 } |
Public Member Functions | |
PartGroup (PartGroup *parent, const string &name) | |
Creates the PartGroup, and adds it to the indicated parent. | |
virtual | ~PartGroup () |
virtual PartGroup * | make_copy () const |
Allocates and returns a new copy of the node. | |
PartGroup * | copy_subgraph () const |
Allocates and returns a new copy of this node and of all of its children. | |
int | get_num_children () const |
Returns the number of child nodes of the group. | |
PartGroup * | get_child (int n) const |
Returns the nth child of the group. | |
PartGroup * | find_child (const string &name) const |
Returns the first descendant found with the indicated name, or NULL if no such descendant exists. | |
virtual void | write (ostream &out, int indent_level) const |
Writes a brief description of the group and all of its descendants. | |
virtual void | write_with_value (ostream &out, int indent_level) const |
Writes a brief description of the group, showing its current value, and that of all of its descendants. | |
virtual TypeHandle | get_value_type () const |
Returns the TypeHandle associated with the ValueType we are concerned with. | |
void | sort_descendants () |
Sorts the children nodes at each level of the hierarchy into alphabetical order. | |
bool | check_hierarchy (const AnimGroup *anim, const PartGroup *parent, int hierarchy_match_flags=0) const |
Walks the part hierarchy in tandem with the indicated anim hierarchy, and returns true if the hierarchies match, false otherwise. | |
virtual bool | do_update (PartBundle *root, PartGroup *parent, bool parent_changed, bool anim_changed) |
Recursively update this particular part and all of its descendents for the current frame. | |
virtual void | write_datagram (BamWriter *manager, Datagram &me) |
Function to write the important information in the particular object to a Datagram. | |
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager) |
Takes in a vector of pointes to TypedWritable objects that correspond to all the requests for pointers that this object made to BamReader. | |
virtual TypeHandle | get_type () const |
virtual TypeHandle | force_init_type () |
virtual void | finalize () |
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. | |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
int | get_ref_count () const |
Returns the current reference count. | |
int | ref () const |
Explicitly increments the reference count. | |
int | unref () const |
Explicitly decrements the reference count. | |
void | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
void | set_name (const string &name) |
void | clear_name () |
Resets the Namable's name to empty. | |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. | |
const string & | get_name () const |
void | output (ostream &out) const |
Outputs the Namable. | |
Static Public Member Functions | |
void | register_with_read_factory (void) |
Factory method to generate a PartGroup object. | |
TypedWritable * | make_PartGroup (const FactoryParams ¶ms) |
Factory method to generate a PartGroup object. | |
TypeHandle | get_class_type () |
void | init_type () |
Static Public Attributes | |
TypedWritable *const | Null = (TypedWritable*)0L |
Protected Types | |
typedef pvector< PointerTo< PartGroup > > | Children |
Protected Member Functions | |
PartGroup (const string &name="") | |
This constructor is only intended for interal use and for derived classes. | |
PartGroup (const PartGroup ©) | |
This constructor is only intended for interal use and for derived classes. | |
void | write_descendants (ostream &out, int indent_level) const |
Writes a brief description of all of the group's descendants. | |
void | write_descendants_with_value (ostream &out, int indent_level) const |
Writes a brief description of all of the group's descendants and their values. | |
virtual void | pick_channel_index (plist< int > &holes, int &next) const |
Walks the part hierarchy, looking for a suitable channel index number to use. | |
virtual void | bind_hierarchy (AnimGroup *anim, int channel_index) |
Binds the indicated anim hierarchy to the part hierarchy, at the given channel index number. | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place. | |
Protected Attributes | |
Children | _children |
Private Attributes | |
int | _num_children |
Static Private Attributes | |
TypeHandle | _type_handle |
Friends | |
class | Character |
It defines a hierarchy of MovingParts.
Definition at line 49 of file partGroup.h.
|
Definition at line 103 of file partGroup.h. |
|
Definition at line 55 of file partGroup.h. |
|
This constructor is only intended for interal use and for derived classes. You should normally use the non-default constructor, below. Definition at line 36 of file partGroup.I. References INLINE. Referenced by ~PartGroup(). |
|
This constructor is only intended for interal use and for derived classes. You should normally use the make_copy() interface to make copies.. Definition at line 54 of file partGroup.I. |
|
Creates the PartGroup, and adds it to the indicated parent. The only way to delete it subsequently is to delete the entire hierarchy. Definition at line 50 of file partGroup.cxx. |
|
Definition at line 64 of file partGroup.cxx. References PartGroup(). |
|
Binds the indicated anim hierarchy to the part hierarchy, at the given channel index number.
Reimplemented in MovingPartBase. Definition at line 526 of file partGroup.cxx. Referenced by MovingPartBase::pick_channel_index(). |
|
Walks the part hierarchy in tandem with the indicated anim hierarchy, and returns true if the hierarchies match, false otherwise. If hierarchy_match_flags is 0, only an exact match is accepted; otherwise, it may contain a union of PartGroup::HierarchyMatchFlags values indicating conditions that will be tolerated (but warnings will still be issued). If there is a discrepancy, it is reported to the indicated output stream, if it is non-null. Definition at line 251 of file partGroup.cxx. |
|
Resets the Namable's name to empty.
Definition at line 82 of file namable.I. References Namable::_name, and INLINE. |
|
Takes in a vector of pointes to TypedWritable objects that correspond to all the requests for pointers that this object made to BamReader.
Reimplemented from TypedWritable. Reimplemented in CharacterJoint. Definition at line 618 of file partGroup.cxx. Referenced by CharacterJoint::clear_local_transforms(). |
|
Allocates and returns a new copy of this node and of all of its children.
Definition at line 93 of file partGroup.cxx. References _children. |
|
Recursively update this particular part and all of its descendents for the current frame. This is not really public and is not intended to be called directly; it is called from the top of the tree by PartBundle::update(). The return value is true if any part has changed, false otherwise. Reimplemented in MovingPartBase. Definition at line 436 of file partGroup.cxx. References NULL. Referenced by PartBundle::bind_anim(). |
|
Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.
Reimplemented from TypedWritable. Reimplemented in MovingPart< SwitchType >, CharacterJoint, MovingPart< ACScalarSwitchType >, and MovingPart< ACMatrixSwitchType >. Definition at line 594 of file partGroup.cxx. Referenced by CharacterJointBundle::make_copy(), and MovingPart< SwitchType >::output_value(). |
|
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.
Reimplemented in PartBundle, RenderAttrib, RenderEffect, RenderEffects, RenderState, and TransformState. Definition at line 112 of file typedWritable.cxx. Referenced by BamReader::skip_pointer(). |
|
Returns the first descendant found with the indicated name, or NULL if no such descendant exists.
Definition at line 150 of file partGroup.cxx. References Namable::get_name(), PartGroupAlphabeticalOrder::operator()(), and PT. Referenced by get_num_children(). |
|
Reimplemented from TypedWritableReferenceCount. Reimplemented in MovingPart< SwitchType >, MovingPartBase, MovingPartMatrix, MovingPartScalar, PartBundle, CharacterJoint, CharacterJointBundle, CharacterSlider, MovingPart< ACScalarSwitchType >, and MovingPart< ACMatrixSwitchType >. Definition at line 125 of file partGroup.h. |
|
Returns the nth child of the group.
Definition at line 134 of file partGroup.cxx. References NULL. |
|
Reimplemented from Namable. Reimplemented in MovingPart< SwitchType >, MovingPartBase, MovingPartMatrix, MovingPartScalar, PartBundle, CharacterJoint, CharacterJointBundle, CharacterSlider, MovingPart< ACScalarSwitchType >, and MovingPart< ACMatrixSwitchType >. Definition at line 126 of file partGroup.h. |
|
|
Returns the number of child nodes of the group.
Definition at line 120 of file partGroup.cxx. References _children, find_child(), Namable::get_name(), and NULL. |
|
Returns the current reference count.
Definition at line 183 of file referenceCount.I. Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture(). |
|
Reimplemented from TypedWritableReferenceCount. Reimplemented in MovingPart< SwitchType >, MovingPartBase, MovingPartMatrix, MovingPartScalar, PartBundle, CharacterJoint, CharacterJointBundle, CharacterSlider, MovingPart< ACScalarSwitchType >, and MovingPart< ACMatrixSwitchType >. Definition at line 122 of file partGroup.h. Referenced by make_copy(), pick_channel_index(), and Character::update_to_now(). |
|
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 71 of file typedObject.I. References TypeHandle::get_name(), TypedObject::get_type(), and INLINE. |
|
Returns the TypeHandle associated with the ValueType we are concerned with. This is provided to allow a bit of run-time checking that joints and channels are matching properly in type. Reimplemented in MovingPart< SwitchType >, MovingPartBase, MovingPart< ACScalarSwitchType >, and MovingPart< ACMatrixSwitchType >. Definition at line 181 of file partGroup.cxx. |
|
Returns true if the Namable has a nonempty name set, false if the name is empty.
Definition at line 97 of file namable.I. References Namable::get_name(), and INLINE. Referenced by EggGroupUniquifier::EggGroupUniquifier(), Texture::read(), and Texture::Texture(). |
|
Reimplemented from Namable. Reimplemented in MovingPart< SwitchType >, MovingPartBase, MovingPartMatrix, MovingPartScalar, PartBundle, CharacterJoint, CharacterJointBundle, CharacterSlider, MovingPart< ACScalarSwitchType >, and MovingPart< ACMatrixSwitchType >. Definition at line 131 of file partGroup.h. |
|
Returns true if the current object is the indicated type exactly.
Definition at line 101 of file typedObject.I. Referenced by PT(), and CollisionNode::xform(). |
|
|
Allocates and returns a new copy of the node. Children are not copied, but see copy_subgraph(). Reimplemented in PartBundle, CharacterJoint, CharacterJointBundle, and CharacterSlider. Definition at line 78 of file partGroup.cxx. References get_type(), and root. Referenced by Character::update_to_now(). |
|
Factory method to generate a PartGroup object.
Definition at line 646 of file partGroup.cxx. |
|
Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this. Reimplemented in BuilderBucket, AnimBundle, AnimChannelBase, AnimChannelFixed< SwitchType >, AnimGroup, PartBundle, CollisionNode, ButtonNode, HermiteCurve, RopeNode, Fog, GeomNode, LensNode, LightLensNode, LightNode, LODNode, PandaNode, PlaneNode, MouseWatcher, and MouseWatcherRegion. |
|
Walks the part hierarchy, looking for a suitable channel index number to use. Available index numbers are the elements of the holes set, as well as next to infinity. Reimplemented in MovingPartBase. Definition at line 507 of file partGroup.cxx. References _children, _num_children, DCAST, TypeHandle::get_name(), get_type(), and TypedWritable::Null. |
|
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. The return value is the new reference count. Definition at line 225 of file referenceCount.I. Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering(). |
|
Factory method to generate a PartGroup object.
Reimplemented in MovingPartMatrix, MovingPartScalar, PartBundle, CharacterJoint, CharacterJointBundle, and CharacterSlider. Definition at line 666 of file partGroup.cxx. |
|
Definition at line 69 of file namable.I. References Namable::_name. Referenced by BuilderBucket::BuilderBucket(), SceneGraphReducer::do_flatten_siblings(), Texture::read(), PandaNode::reparent(), and Texture::Texture(). |
|
Sorts the children nodes at each level of the hierarchy into alphabetical order. This should be done after creating the hierarchy, to guarantee that the correct names will match up together when the AnimBundle is later bound to a PlayerRoot. Definition at line 211 of file partGroup.cxx. References AnimGroup::get_num_children(). |
|
Does some easy checks to make sure that the reference count isn't completely bogus.
Definition at line 328 of file referenceCount.I. References INLINE. Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount(). |
|
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; plus, we don't have a virtual destructor anyway.) 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 the new reference count. Definition at line 293 of file referenceCount.I. References INLINE. Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds(). |
|
Writes a brief description of the group and all of its descendants.
Reimplemented in MovingPartBase, and PartBundle. Definition at line 387 of file partGroup.cxx. References _children. |
|
Function to write the important information in the particular object to a Datagram.
Implements TypedWritableReferenceCount. Reimplemented in MovingPart< SwitchType >, CharacterJoint, MovingPart< ACScalarSwitchType >, and MovingPart< ACMatrixSwitchType >. Definition at line 568 of file partGroup.cxx. Referenced by MovingPart< SwitchType >::make_initial_channel(). |
|
Writes a brief description of all of the group's descendants.
Definition at line 462 of file partGroup.cxx. Referenced by MovingPartBase::MovingPartBase(). |
|
Writes a brief description of all of the group's descendants and their values.
Definition at line 481 of file partGroup.cxx. Referenced by MovingPartBase::write(). |
|
Writes a brief description of the group, showing its current value, and that of all of its descendants.
Reimplemented in MovingPartBase. Definition at line 405 of file partGroup.cxx. |
|
Reimplemented in CharacterJoint. Definition at line 140 of file partGroup.h. |
|
Definition at line 104 of file partGroup.h. Referenced by copy_subgraph(), get_num_children(), MovingPartBase::MovingPartBase(), pick_channel_index(), Character::update_to_now(), write(), and MovingPartBase::write(). |
|
Definition at line 118 of file partGroup.h. Referenced by pick_channel_index(). |
|
Reimplemented from Namable. Reimplemented in MovingPart< SwitchType >, MovingPartBase, MovingPartMatrix, MovingPartScalar, PartBundle, CharacterJoint, CharacterJointBundle, CharacterSlider, MovingPart< ACScalarSwitchType >, and MovingPart< ACMatrixSwitchType >. Definition at line 35 of file partGroup.cxx. |
|
Definition at line 25 of file typedWritable.cxx. Referenced by Child::complete_pointers(), Parent::complete_pointers(), Person::complete_pointers(), LoaderFileTypeBam::get_extension(), pick_channel_index(), BamReader::read_pointer(), and AnimGroup::write_datagram(). |