# EggGroupNode

from pandac.PandaModules import EggGroupNode

Class : EggGroupNode
Description : A base class for nodes in the hierarchy that are not leaf nodes. (See also EggGroup, which is specifically the "<Group>" node in egg.)
An EggGroupNode is an STL-style container of pointers to EggNodes, like a vector. Functions push_back()/pop_back() and insert()/erase() are provided to manipulate the list. The list may also be operated on (read-only) via iterators and begin()/end().

## Inheritance:

EggGroupNode: EggNode
EggNode: EggNamedObject
EggNamedObject: EggObject Namable
EggObject: TypedReferenceCount
TypedReferenceCount: TypedObject ReferenceCount
TypedObject:
ReferenceCount:
Namable:

## Methods of EggGroupNode:

addChild
applyFirstAttribute
applyLastAttribute
clear
clearConnectedShading
empty
findChild
forceFilenames
getClassType
getConnectedShading
getFirstChild
getNextChild
hasAbsolutePathnames
meshTriangles
operator =
postApplyFlatAttribute
rebuildVertexPool
recomputePolygonNormals
recomputeTangentBinormal
recomputeVertexNormals
removeChild
removeInvalidPrimitives
removeUnusedVertices
renameNodes
resolveFilenames
reverseVertexOrdering
size
stealChildren
stripNormals
triangulatePolygons
unifyAttributes

## Methods of EggNode:

applyTexmats
determineAlphaMode
determineBin
determineDecal
determineDepthTestMode
determineDepthWriteMode
determineDrawOrder
determineIndexed
determineVisibilityMode
flattenTransforms
getClassType
getDepth
getNodeFrame
getNodeFrameInv
getNodeFrameInvPtr
getNodeFramePtr
getNodeToVertex
getNodeToVertexPtr
getParent
getVertexFrame
getVertexFrameInv
getVertexFrameInvPtr
getVertexFramePtr
getVertexToNode
getVertexToNodePtr
isAnimMatrix
isJoint
isLocalCoord
isUnderInstance
isUnderTransform
operator =
parseEgg
renameNode
testUnderIntegrity
transform
transformVerticesOnly
write

## Methods of EggNamedObject:

getClassType
operator =
output

## Methods of EggObject:

clearUserData
getClassType
getUserData
hasUserData
operator =
setUserData

## Methods of TypedReferenceCount:

getClassType

## Methods of TypedObject:

getBestParentFromSet
getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
unref

## Methods of Namable:

clearName
getClassType
getName
hasName
operator =
output
setName

## Constants in EggGroupNode:

TPolygon | (TriangulateFlags)
TConvex | (TriangulateFlags)
TComposite | (TriangulateFlags)
TRecurse | (TriangulateFlags)
TFlatShaded | (TriangulateFlags)

addChild EggNode *EggGroupNode::add_child(EggNode *node); Description: Adds the indicated child to the group and returns it. If the child node is already a child of some other node, removes it first.

applyFirstAttribute void EggGroupNode::apply_first_attribute(bool recurse); Description: Sets the first vertex of the triangle (or each component) to the primitive normal and/or color, if the primitive is flat-shaded. This reflects the DirectX convention of storing flat-shaded properties on the first vertex, although it is not usually a convention in Egg. This may create redundant vertices in the vertex pool, so it may be a good idea to follow this up with remove_unused_vertices().

applyLastAttribute void EggGroupNode::apply_last_attribute(bool recurse); Description: Sets the last vertex of the triangle (or each component) to the primitive normal and/or color, if the primitive is flat-shaded. This reflects the OpenGL convention of storing flat-shaded properties on the last vertex, although it is not usually a convention in Egg. This may create redundant vertices in the vertex pool, so it may be a good idea to follow this up with remove_unused_vertices().

clear void EggGroupNode::clear(void); Description:

clearConnectedShading void EggGroupNode::clear_connected_shading(void); Description: Resets the connected_shading information on all primitives at this node and below, so that it may be accurately rederived by the next call to get_connected_shading(). It may be a good idea to call remove_unused_vertices() as well, to establish the correct connectivity between common vertices.

empty bool EggGroupNode::empty(void) const; Description:

findChild EggNode *EggGroupNode::find_child(string const &name) const; Description: Returns the child of this node whose name is the indicated string, or NULL if there is no child of this node by that name. Does not search recursively.

forceFilenames void EggGroupNode::force_filenames(Filename const &directory); Description: Similar to resolve_filenames, but each non-absolute filename encountered is arbitrarily taken to be in the indicated directory, whether or not the so-named filename exists.

getClassType static TypeHandle EggGroupNode::get_class_type(void); Undocumented function.

getConnectedShading void EggGroupNode::get_connected_shading(void); Description: Queries the connected_shading information on all primitives at this node and below, to ensure that it has been completely filled in before we start mucking around with vertices.

getFirstChild EggNode *EggGroupNode::get_first_child(void); This is an alternate way to traverse the list of children. It is mainly provided for scripting code, which can't use the iterators defined above (they don't export through interrogate very well). These are, of course, non-thread-safe. Description: Returns the first child in the group's list of children, or NULL if the list of children is empty. Can be used with get_next_child() to return the complete list of children without using the iterator class; however, this is non-thread-safe, and so is not recommended except for languages other than C++ which cannot use the iterators.

getNextChild EggNode *EggGroupNode::get_next_child(void); This is an alternate way to traverse the list of children. It is mainly provided for scripting code, which can't use the iterators defined above (they don't export through interrogate very well). These are, of course, non-thread-safe. Description: Returns the next child in the group's list of children since the last call to get_first_child() or get_next_child(), or NULL if the last child has been returned. Can be used with get_first_child() to return the complete list of children without using the iterator class; however, this is non-thread-safe, and so is not recommended except for languages other than C++ which cannot use the iterators. It is an error to call this without previously calling get_first_child().

hasAbsolutePathnames bool EggGroupNode::has_absolute_pathnames(void) const; Description: Returns true if any nodes at this level and below include a reference to a file via an absolute pathname, or false if all references are relative.

meshTriangles void EggGroupNode::mesh_triangles(int flags); Description: Combine triangles together into triangle strips, at this group and below.

operator = EggGroupNode &EggGroupNode::operator =(EggGroupNode const &copy); Description:

postApplyFlatAttribute void EggGroupNode::post_apply_flat_attribute(bool recurse); Description: Intended as a followup to apply_last_attribute(), this also sets an attribute on the first vertices of the primitive, if they don't already have an attribute set, just so they end up with *something*.

rebuildVertexPool void EggGroupNode::rebuild_vertex_pool(EggVertexPool *vertex_pool, bool recurse); Description: Copies vertices used by the primitives at this group node (and below, if recurse is true) into the indicated vertex pool, and updates the primitives to reference this pool. It is up to the caller to parent the new vertex pool somewhere appropriate in the egg hierarchy.

recomputePolygonNormals void EggGroupNode::recompute_polygon_normals(CoordinateSystem cs = (CS_default)); Description: Recomputes all the polygon normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions. Normals are removed from the vertices and defined only on polygons, giving the geometry a faceted appearance. This function also removes degenerate polygons that do not have enough vertices to define a normal. It does not affect normals for other kinds of primitives like Nurbs or Points. This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the normals removed. Thus, it is a good idea to call remove_unused_vertices() after calling this.

recomputeTangentBinormal void EggGroupNode::recompute_tangent_binormal(GlobPattern const &uv_name); Description: This function recomputes the tangent and binormal for the named texture coordinate set for all vertices at this level and below. Use the empty string for the default texture coordinate set. It is necessary for each vertex to already have a normal (or at least a polygon normal), as well as a texture coordinate in the named texture coordinate set, before calling this function. You might precede this with recompute_vertex_normals() to ensure that the normals exist. Like recompute_vertex_normals(), this function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the new tangents and binormals computed. Thus, it is a good idea to call remove_unused_vertices() after calling this.

recomputeVertexNormals void EggGroupNode::recompute_vertex_normals(double threshold, CoordinateSystem cs = (CS_default)); Description: Recomputes all the vertex normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions. A shared edge between two polygons (even in different groups) is considered smooth if the angle between the two edges is less than threshold degrees. This function also removes degenerate polygons that do not have enough vertices to define a normal. It does not affect normals for other kinds of primitives like Nurbs or Points. This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the correct normals. Thus, it is a good idea to call remove_unused_vertices() after calling this.

removeChild PointerTo< EggNode > EggGroupNode::remove_child(EggNode *node); Description: Removes the indicated child node from the group and returns it. If the child was not already in the group, does nothing and returns NULL.

removeInvalidPrimitives int EggGroupNode::remove_invalid_primitives(bool recurse); Description: Removes primitives at this level and below which appear to be degenerate; e.g. polygons with fewer than 3 vertices, etc. Returns the number of primitives removed.

removeUnusedVertices int EggGroupNode::remove_unused_vertices(bool recurse); Description: Removes all vertices from VertexPools within this group or below that are not referenced by at least one primitive. Also collapses together equivalent vertices, and renumbers all vertices after the operation so their indices are consecutive, beginning at zero. Returns the total number of vertices removed. Note that this operates on the VertexPools within this group level, without respect to primitives that reference these vertices (unlike other functions like strip_normals()). It is therefore most useful to call this on the EggData root, rather than on a subgroup within the hierarchy, since a VertexPool may appear anywhere in the hierarchy.

renameNodes int EggGroupNode::rename_nodes(vector< string > strip_prefix, bool recurse); Description: Rename by stripping out the prefix

resolveFilenames void EggGroupNode::resolve_filenames(DSearchPath const &searchpath); Description: Walks the tree and attempts to resolve any filenames encountered. This looks up filenames in the search path, etc. It does not automatically search the egg_path for missing files.

reverseVertexOrdering void EggGroupNode::reverse_vertex_ordering(void); Description: Reverses the vertex ordering of all polygons defined at this node and below. Does not change the surface normals, if any.

size unsigned int EggGroupNode::size(void) const; Description:

stealChildren void EggGroupNode::steal_children(EggGroupNode &other); Description: Moves all the children from the other node to this one. This is especially useful because the group node copy assignment operator does not copy children.

stripNormals void EggGroupNode::strip_normals(void); Description: Removes all normals from primitives, and the vertices they reference, at this node and below. This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the normal removed. Thus, it is a good idea to call remove_unused_vertices() after calling this.

triangulatePolygons int EggGroupNode::triangulate_polygons(int flags); Description: Replace all higher-order polygons at this point in the scene graph and below with triangles. Returns the total number of new triangles produced, less degenerate polygons removed. If flags contains T_polygon and T_convex, both concave and convex polygons will be subdivided into triangles; with only T_polygon, only concave polygons will be subdivided, and convex polygons will be largely unchanged.

unifyAttributes void EggGroupNode::unify_attributes(bool use_connected_shading, bool allow_per_primitive, bool recurse); Description: Applies per-vertex normal and color to all vertices, if they are in fact per-vertex (and different for each vertex), or moves them to the primitive if they are all the same. After this call, either the primitive will have normals or its vertices will, but not both. Ditto for colors. If use_connected_shading is true, each polygon is considered in conjunction with all connected polygons; otherwise, each polygon is considered individually. If allow_per_primitive is false, S_per_face or S_overall will treated like S_per_vertex: normals and colors will always be assigned to the vertices. In this case, there will never be per-primitive colors or normals after this call returns. On the other hand, if allow_per_primitive is true, then S_per_face means that normals and colors should be assigned to the primitives, and removed from the vertices, as described above. This may create redundant vertices in the vertex pool, so it may be a good idea to follow this up with remove_unused_vertices().

applyTexmats void EggNode::apply_texmats(void); Description: Applies the texture matrices to the UV's of the vertices that reference them, and then removes the texture matrices from the textures themselves.

determineAlphaMode virtual EggRenderMode *EggNode::determine_alpha_mode(void); Description: Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has an alpha_mode other than AM_unspecified. Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

determineBin virtual EggRenderMode *EggNode::determine_bin(void); Description: Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a bin specified. Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

determineDecal virtual bool EggNode::determine_decal(void); Description: Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag set. Returns the value of the decal flag if it is found, or false if it is not. In other words, returns true if the "decal" flag is in effect for the indicated node, false otherwise.

determineDepthTestMode virtual EggRenderMode *EggNode::determine_depth_test_mode(void); Description: Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_test_mode other than DTM_unspecified. Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

determineDepthWriteMode virtual EggRenderMode *EggNode::determine_depth_write_mode(void); Description: Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_write_mode other than DWM_unspecified. Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

determineDrawOrder virtual EggRenderMode *EggNode::determine_draw_order(void); Description: Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a draw_order specified. Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

determineIndexed virtual bool EggNode::determine_indexed(void); Description: Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" scalar set. Returns the value of the indexed scalar if it is found, or false if it is not. In other words, returns true if the "indexed" flag is in effect for the indicated node, false otherwise.

determineVisibilityMode virtual EggRenderMode *EggNode::determine_visibility_mode(void); Description: Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a visibility_mode other than VM_unspecified. Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

flattenTransforms void EggNode::flatten_transforms(void); Description: Removes any transform and instance records from this node in the scene graph and below. If an instance node is encountered, removes the instance and applies the transform to its vertices, duplicating vertices if necessary. Since this function may result in duplicated vertices, it may be a good idea to call remove_unused_vertices() after calling this.

getClassType static TypeHandle EggNode::get_class_type(void); Undocumented function.

getDepth int EggNode::get_depth(void) const; Description: Returns the number of nodes above this node in the egg hierarchy.

getNodeFrame LMatrix4d const &EggNode::get_node_frame(void) const; Description: Returns the coordinate frame of the node itself. This is simply the net product of all transformations up to the root.

getNodeFrameInv LMatrix4d const &EggNode::get_node_frame_inv(void) const; Description: Returns the inverse of the matrix returned by get_node_frame(). See get_node_frame().

getNodeFrameInvPtr LMatrix4d const *EggNode::get_node_frame_inv_ptr(void) const; Description: Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame_inv() matrix.

getNodeFramePtr LMatrix4d const *EggNode::get_node_frame_ptr(void) const; Description: Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame() matrix.

getNodeToVertex LMatrix4d const &EggNode::get_node_to_vertex(void) const; Description: Returns the transformation matrix suitable for converting vertices in the coordinate space of the node to the appropriate coordinate space for storing in the egg file. This is the same thing as: get_node_frame() * get_vertex_frame_inv()

getNodeToVertexPtr LMatrix4d const *EggNode::get_node_to_vertex_ptr(void) const; Description: Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_to_vertex() matrix.

getParent EggGroupNode *EggNode::get_parent(void) const; Description:

getVertexFrame LMatrix4d const &EggNode::get_vertex_frame(void) const; Description: Returns the coordinate frame of the vertices referenced by primitives at or under this node. This is not the same as get_node_frame(). Generally, vertices in an egg file are stored in the global coordinate space, regardless of the transforms defined at each node. Thus, get_vertex_frame() will usually return the identity transform (global coordinate space). However, primitives under an <Instance> entry reference their vertices in the coordinate system under effect at the time of the <Instance>. Thus, nodes under an <Instance> entry may return this non-identity matrix. Specifically, this may return a non-identity matrix only if is_local_coord() is true.

getVertexFrameInv LMatrix4d const &EggNode::get_vertex_frame_inv(void) const; Description: Returns the inverse of the matrix returned by get_vertex_frame(). See get_vertex_frame().

getVertexFrameInvPtr LMatrix4d const *EggNode::get_vertex_frame_inv_ptr(void) const; Description: Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame_inv() matrix.

getVertexFramePtr LMatrix4d const *EggNode::get_vertex_frame_ptr(void) const; Description: Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame() matrix.

getVertexToNode LMatrix4d const &EggNode::get_vertex_to_node(void) const; Description: Returns the transformation matrix suitable for converting the vertices as read from the egg file into the coordinate space of the node. This is the same thing as: get_vertex_frame() * get_node_frame_inv()

getVertexToNodePtr LMatrix4d const *EggNode::get_vertex_to_node_ptr(void) const; Description: Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_to_node() matrix.

isAnimMatrix virtual bool EggNode::is_anim_matrix(void) const; Description: Returns true if this node represents a table of animation transformation data, false otherwise.

isJoint virtual bool EggNode::is_joint(void) const; Description: Returns true if this particular node represents a <Joint> entry or not. This is a handy thing to know since Joints are sorted to the end of their sibling list when writing an egg file. See EggGroupNode::write().

isLocalCoord bool EggNode::is_local_coord(void) const; Description: Returns true if this node's vertices are not in the global coordinate space. This will be the case if there was an <Instance> node under a transform at or above this node.

isUnderInstance bool EggNode::is_under_instance(void) const; Description: Returns true if there is an <Instance> node somewhere in the egg tree at or above this node, false otherwise.

isUnderTransform bool EggNode::is_under_transform(void) const; Description: Returns true if there is a <Transform> entry somewhere in the egg tree at or above this node, false otherwise.

operator = EggNode &EggNode::operator =(EggNode const &copy); Description:

parseEgg bool EggNode::parse_egg(string const &egg_syntax); Description: Parses the egg syntax given in the indicate string as if it had been read from the egg file within this object's definition. Updates the object accordingly. Returns true if successful, false if there was some parse error or if the object does not support this functionality.

renameNode int EggNode::rename_node(vector< string > strip_prefix); Description: Rename by stripping out the prefix

testUnderIntegrity void EggNode::test_under_integrity(void) const; Description: Recursively checks the integrity of the _under_flags, _parent, and _depth members of this node and all of its ancestors.

transform void EggNode::transform(LMatrix4d const &mat); Description: Applies the indicated transformation to the node and all of its descendants.

transformVerticesOnly void EggNode::transform_vertices_only(LMatrix4d const &mat); Description: Applies the indicated transformation only to vertices that appear in global space within vertex pools at this node and below. Joints and other transforms are not affected, nor are local vertices.

write virtual void EggNode::write(ostream &out, int indent_level) const = 0; Undocumented function.

getClassType static TypeHandle EggNamedObject::get_class_type(void); Undocumented function.

operator = EggNamedObject &EggNamedObject::operator =(EggNamedObject const &copy); Description:

output void EggNamedObject::output(ostream &out) const; Description:

clearUserData void EggObject::clear_user_data(void); Description: Removes *all* user data pointers from the node. Description: Removes the user data pointer of the indicated type.

getClassType static TypeHandle EggObject::get_class_type(void); Undocumented function.

getUserData EggUserData *EggObject::get_user_data(void) const; Description: Returns the user data pointer most recently stored on this object, or NULL if nothing was previously stored. Description: Returns the user data pointer of the indicated type, if it exists, or NULL if it does not.

hasUserData bool EggObject::has_user_data(void) const; Description: Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise. Description: Returns true if the user data pointer of the indicated type has been set, false otherwise.

operator = EggObject &EggObject::operator =(EggObject const &copy); Description:

setUserData void EggObject::set_user_data(EggUserData *user_data); Description: Sets the user data associated with this object. This may be any EggUserData-derived object. The egg library will do nothing with this pointer, except to hold its reference count and return the pointer on request. The EggObject maintains multiple different EggUserData pointers, one for each unique type (as reported by get_type()). If you know that only one type of EggUserData object will be added in your application, you may use the query functions that accept no parameters, but it is recommended that in general you pass in the type of your particular user data, to allow multiple applications to coexist in the same egg data. This pointer is also copied by the copy assignment operator and copy constructor.

getClassType static TypeHandle TypedReferenceCount::get_class_type(void); Undocumented function.

getBestParentFromSet int TypedObject::get_best_parent_from_Set(set< int > const &) const; Description: Returns true if the current object is the indicated type exactly.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: 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().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.

getClassType static TypeHandle ReferenceCount::get_class_type(void); Undocumented function.

getRefCount int ReferenceCount::get_ref_count(void) const; Description: Returns the current reference count.

ref void ReferenceCount::ref(void) const; Description: 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.

testRefCountIntegrity bool ReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

unref bool ReferenceCount::unref(void) const; Description: 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 true if the new reference count is nonzero, false if it is zero.

clearName void Namable::clear_name(void); Description: Resets the Namable's name to empty.

getClassType static TypeHandle Namable::get_class_type(void); Undocumented function.

getName string const &Namable::get_name(void) const; Description:

hasName bool Namable::has_name(void) const; Description: Returns true if the Namable has a nonempty name set, false if the name is empty.

operator = Namable &Namable::operator =(Namable const &other); Description:

output void Namable::output(ostream &out) const; In the absence of any definition to the contrary, outputting a Namable will write out its name. Description: Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

setName void Namable::set_name(string const &name); Description: