PartGroup

class PartGroup

Bases: TypedWritableReferenceCount, Namable

This is the base class for PartRoot and MovingPart. It defines a hierarchy of MovingParts.

Inheritance diagram

Inheritance diagram of PartGroup

enum HierarchyMatchFlags

This enum defines bits which may be passed into check_hierarchy() and PartBundle::bind_anim() to allow an inexact match of channel hierarchies. This specifies conditions that we don’t care about enforcing.

enumerator HMF_ok_part_extra = 1
enumerator HMF_ok_anim_extra = 2
enumerator HMF_ok_wrong_root_name = 4
explicit PartGroup(PartGroup *parent, std::string const &name)

This is the normal PartGroup constructor.

This constructor is only intended for interal use and for derived classes. You should normally use the non-default constructor, below.

This constructor is only intended for interal use and for derived classes. You should normally use the make_copy() interface to make copies..

Creates the PartGroup, and adds it to the indicated parent. The only way to delete it subsequently is to delete the entire hierarchy.

virtual bool apply_control(PandaNode *node)

Specifies a node to influence this particular joint so that it will always hold the node’s transform. Returns true if this is a joint that can be so controlled, false otherwise.

This is normally only called internally by PartBundle::control_joint(), but you may also call it directly.

bool apply_freeze(TransformState const *transform)

Freezes this particular joint so that it will always hold the specified transform. Returns true if this is a joint that can be so frozen, false otherwise.

This is normally only called internally by PartBundle::freeze_joint(), but you may also call it directly.

virtual bool apply_freeze_matrix(LVecBase3 const &pos, LVecBase3 const &hpr, LVecBase3 const &scale)

Freezes this particular joint so that it will always hold the specified transform. Returns true if this is a joint that can be so frozen, false otherwise.

This is normally only called internally by PartBundle::freeze_joint(), but you may also call it directly.

virtual bool apply_freeze_scalar(PN_stdfloat value)

Freezes this particular joint so that it will always hold the specified transform. Returns true if this is a joint that can be so frozen, false otherwise.

This is normally only called internally by PartBundle::freeze_joint(), but you may also call it directly.

virtual bool clear_forced_channel(void)

Undoes the effect of a previous call to apply_freeze() or apply_control(). Returns true if the joint was modified, false otherwise.

This is normally only called internally by PartBundle::release_joint(), but you may also call it directly.

PartGroup *copy_subgraph(void) const

Allocates and returns a new copy of this node and of all of its children.

PartGroup *find_child(std::string const &name) const

Returns the first descendant found with the indicated name, or NULL if no such descendant exists. This method searches the entire graph beginning at this PartGroup; see also get_child_named().

PartGroup *get_child(int n) const

Returns the nth child of the group.

PartGroup *get_child_named(std::string const &name) const

Returns the first child found with the indicated name, or NULL if no such child exists. This method searches only the children of this particular PartGroup; it does not recursively search the entire graph. See also find_child().

static TypeHandle get_class_type(void)
virtual AnimChannelBase *get_forced_channel(void) const

Returns the AnimChannelBase that has been forced to this joint by a previous call to apply_freeze() or apply_control(), or NULL if no such channel has been applied.

int get_num_children(void) const

Returns the number of child nodes of the group.

virtual bool is_character_joint(void) const

Returns true if this part is a CharacterJoint, false otherwise. This is a tiny optimization over is_of_type(CharacterType::get_class_type()).

virtual PartGroup *make_copy(void) const

Allocates and returns a new copy of the node. Children are not copied, but see copy_subgraph().

void sort_descendants(void)

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.

virtual void write(std::ostream &out, int indent_level) const

Writes a brief description of the group and all of its descendants.

virtual void write_with_value(std::ostream &out, int indent_level) const

Writes a brief description of the group, showing its current value, and that of all of its descendants.