EggGroupNode
from panda3d.egg import EggGroupNode
- class EggGroupNode
Bases:
EggNode
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 diagram
- TComposite = 4
- TConvex = 2
- TFlatShaded = 16
- TPolygon = 1
- TRecurse = 8
- T_composite = 4
- T_convex = 2
- T_flat_shaded = 16
- T_polygon = 1
- T_recurse = 8
- __init__(*args, **kwargs)
- addChild()
C++ Interface: add_child(const EggGroupNode self, EggNode node)
- /**
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.
*/
- add_child()
C++ Interface: add_child(const EggGroupNode self, EggNode node)
- /**
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()
C++ Interface: apply_first_attribute(const EggGroupNode self, bool recurse)
- /**
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()
C++ Interface: apply_last_attribute(const EggGroupNode self, bool recurse)
- /**
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().
*/
- apply_first_attribute()
C++ Interface: apply_first_attribute(const EggGroupNode self, bool recurse)
- /**
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().
*/
- apply_last_attribute()
C++ Interface: apply_last_attribute(const EggGroupNode self, bool recurse)
- /**
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().
*/
- children
- clearConnectedShading()
C++ Interface: clear_connected_shading(const EggGroupNode self)
- /**
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.
*/
- clear_connected_shading()
C++ Interface: clear_connected_shading(const EggGroupNode self)
- /**
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.
*/
- findChild()
C++ Interface: find_child(EggGroupNode self, str name)
- /**
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.
*/
- find_child()
C++ Interface: find_child(EggGroupNode self, str name)
- /**
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()
C++ Interface: force_filenames(const EggGroupNode self, const Filename directory)
- /**
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.
*/
- force_filenames()
C++ Interface: force_filenames(const EggGroupNode self, const Filename directory)
- /**
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.
*/
- getChildren()
C++ Interface: get_children(EggGroupNode self)
- getClassType()
C++ Interface: get_class_type()
- getConnectedShading()
C++ Interface: get_connected_shading(const EggGroupNode self)
- /**
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()
C++ Interface: get_first_child(const EggGroupNode self)
// 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.
- /**
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()
C++ Interface: get_next_child(const EggGroupNode self)
- /**
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().
*/
- get_children()
C++ Interface: get_children(EggGroupNode self)
- get_class_type()
C++ Interface: get_class_type()
- get_connected_shading()
C++ Interface: get_connected_shading(const EggGroupNode self)
- /**
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.
*/
- get_first_child()
C++ Interface: get_first_child(const EggGroupNode self)
// 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.
- /**
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.
*/
- get_next_child()
C++ Interface: get_next_child(const EggGroupNode self)
- /**
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()
C++ Interface: has_absolute_pathnames(EggGroupNode self)
- /**
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.
*/
- hasNormals()
C++ Interface: has_normals(EggGroupNode self)
- /**
Returns true if any of the primitives (e.g. polygons) defined within this
group or below have either face or vertex normals defined, false otherwise.
*/
- hasPrimitives()
C++ Interface: has_primitives(EggGroupNode self)
- /**
Returns true if there are any primitives (e.g. polygons) defined within
this group or below, false otherwise.
*/
- has_absolute_pathnames()
C++ Interface: has_absolute_pathnames(EggGroupNode self)
- /**
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.
*/
- has_normals()
C++ Interface: has_normals(EggGroupNode self)
- /**
Returns true if any of the primitives (e.g. polygons) defined within this
group or below have either face or vertex normals defined, false otherwise.
*/
- has_primitives()
C++ Interface: has_primitives(EggGroupNode self)
- /**
Returns true if there are any primitives (e.g. polygons) defined within
this group or below, false otherwise.
*/
- isRight()
C++ Interface: is_right(const LVector2d v1, const LVector2d v2)
- /**
Returns true if the 2-d v1 is to the right of v2.
*/
- is_right()
C++ Interface: is_right(const LVector2d v1, const LVector2d v2)
- /**
Returns true if the 2-d v1 is to the right of v2.
*/
- jointHasPrimitives()
C++ Interface: joint_has_primitives(EggGroupNode self)
- /**
Returns true if there are any primitives (e.g. polygons) defined within
this group or below, but the search does not include nested joints.
*/
- joint_has_primitives()
C++ Interface: joint_has_primitives(EggGroupNode self)
- /**
Returns true if there are any primitives (e.g. polygons) defined within
this group or below, but the search does not include nested joints.
*/
- makePointPrimitives()
C++ Interface: make_point_primitives(const EggGroupNode self)
- /**
Creates PointLight primitives to reference any otherwise unreferences
vertices discovered in this group or below.
*/
- make_point_primitives()
C++ Interface: make_point_primitives(const EggGroupNode self)
- /**
Creates PointLight primitives to reference any otherwise unreferences
vertices discovered in this group or below.
*/
- meshTriangles()
C++ Interface: mesh_triangles(const EggGroupNode self, int flags)
- /**
Combine triangles together into triangle strips, at this group and below.
*/
- mesh_triangles()
C++ Interface: mesh_triangles(const EggGroupNode self, int flags)
- /**
Combine triangles together into triangle strips, at this group and below.
*/
- postApplyFlatAttribute()
C++ Interface: post_apply_flat_attribute(const EggGroupNode self, bool recurse)
- /**
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.
*/
- post_apply_flat_attribute()
C++ Interface: post_apply_flat_attribute(const EggGroupNode self, bool recurse)
- /**
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.
*/
- recomputePolygonNormals()
C++ Interface: recompute_polygon_normals(const EggGroupNode self, int cs)
- /**
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()
C++ Interface: recompute_tangent_binormal(const EggGroupNode self, const GlobPattern uv_name)
- /**
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.
*/
- /**
This function recomputes the tangent and binormal for the named texture
coordinate sets. Returns true if anything was done.
*/
- recomputeTangentBinormalAuto()
C++ Interface: recompute_tangent_binormal_auto(const EggGroupNode self)
- /**
This function recomputes the tangent and binormal for any texture
coordinate set that affects a normal map. Returns true if anything was
done.
*/
- recomputeVertexNormals()
C++ Interface: recompute_vertex_normals(const EggGroupNode self, double threshold, int cs)
- /**
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.
*/
- recompute_polygon_normals()
C++ Interface: recompute_polygon_normals(const EggGroupNode self, int cs)
- /**
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.
*/
- recompute_tangent_binormal()
C++ Interface: recompute_tangent_binormal(const EggGroupNode self, const GlobPattern uv_name)
- /**
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.
*/
- /**
This function recomputes the tangent and binormal for the named texture
coordinate sets. Returns true if anything was done.
*/
- recompute_tangent_binormal_auto()
C++ Interface: recompute_tangent_binormal_auto(const EggGroupNode self)
- /**
This function recomputes the tangent and binormal for any texture
coordinate set that affects a normal map. Returns true if anything was
done.
*/
- recompute_vertex_normals()
C++ Interface: recompute_vertex_normals(const EggGroupNode self, double threshold, int cs)
- /**
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()
C++ Interface: remove_child(const EggGroupNode self, EggNode node)
- /**
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()
C++ Interface: remove_invalid_primitives(const EggGroupNode self, bool recurse)
- /**
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()
C++ Interface: remove_unused_vertices(const EggGroupNode self, bool recurse)
- /**
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.
*/
- remove_child()
C++ Interface: remove_child(const EggGroupNode self, EggNode node)
- /**
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.
*/
- remove_invalid_primitives()
C++ Interface: remove_invalid_primitives(const EggGroupNode self, bool recurse)
- /**
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.
*/
- remove_unused_vertices()
C++ Interface: remove_unused_vertices(const EggGroupNode self, bool recurse)
- /**
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.
*/
- resolveFilenames()
C++ Interface: resolve_filenames(const EggGroupNode self, const DSearchPath searchpath)
- /**
Walks the tree and attempts to resolve any filenames encountered. This
looks up filenames along the specified search path; it does not
automatically search the model_path for missing files.
*/
- resolve_filenames()
C++ Interface: resolve_filenames(const EggGroupNode self, const DSearchPath searchpath)
- /**
Walks the tree and attempts to resolve any filenames encountered. This
looks up filenames along the specified search path; it does not
automatically search the model_path for missing files.
*/
- reverseVertexOrdering()
C++ Interface: reverse_vertex_ordering(const EggGroupNode self)
- /**
Reverses the vertex ordering of all polygons defined at this node and
below. Does not change the surface normals, if any.
*/
- reverse_vertex_ordering()
C++ Interface: reverse_vertex_ordering(const EggGroupNode self)
- /**
Reverses the vertex ordering of all polygons defined at this node and
below. Does not change the surface normals, if any.
*/
- stealChildren()
C++ Interface: steal_children(const EggGroupNode self, EggGroupNode other)
- /**
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.
*/
- steal_children()
C++ Interface: steal_children(const EggGroupNode self, EggGroupNode other)
- /**
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()
C++ Interface: strip_normals(const EggGroupNode self)
- /**
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.
*/
- strip_normals()
C++ Interface: strip_normals(const EggGroupNode self)
- /**
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()
C++ Interface: triangulate_polygons(const EggGroupNode self, int flags)
- /**
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.
*/
- triangulate_polygons()
C++ Interface: triangulate_polygons(const EggGroupNode self, int flags)
- /**
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()
C++ Interface: unify_attributes(const EggGroupNode self, bool use_connected_shading, bool allow_per_primitive, bool recurse)
- /**
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().
*/
- unify_attributes()
C++ Interface: unify_attributes(const EggGroupNode self, bool use_connected_shading, bool allow_per_primitive, bool recurse)
- /**
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().
*/