Panda3D
|
This is a set of zero or more NodePaths. More...
#include "nodePathCollection.h"
Public Member Functions | |
NodePathCollection (const NodePathCollection ©) | |
void | add_path (const NodePath &node_path) |
Adds a new NodePath to the collection. More... | |
void | add_paths_from (const NodePathCollection &other) |
Adds all the NodePaths indicated in the other collection to this path. More... | |
void | append (const NodePath &node_path) |
Adds a new NodePath to the collection. More... | |
bool | calc_tight_bounds (LPoint3 &min_point, LPoint3 &max_point) const |
Calculates the minimum and maximum vertices of all Geoms at these NodePath's bottom nodes and below This is a tight bounding box; it will generally be tighter than the bounding volume returned by get_bounds() (but it is more expensive to compute). More... | |
void | clear () |
Removes all NodePaths from the collection. More... | |
void | compose_color_scale (PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a=1.0, int priority=0) |
Applies color scales to all NodePaths in the collection. More... | |
void | compose_color_scale (const LVecBase4 &scale, int priority=0) |
Applies color scales to all NodePaths in the collection. More... | |
void | detach () |
Detaches all NodePaths in the collection. More... | |
void | extend (const NodePathCollection &other) |
Appends the other list onto the end of this one. More... | |
NodePathCollection | find_all_matches (const string &path) const |
Returns the complete set of all NodePaths that begin with any NodePath in this collection and can be extended by path. More... | |
CollideMask | get_collide_mask () const |
Returns the union of all of the into_collide_masks for nodes at this level and below. More... | |
int | get_num_paths () const |
Returns the number of NodePaths in the collection. More... | |
NodePath | get_path (int index) const |
Returns the nth NodePath in the collection. More... | |
bool | has_path (const NodePath &path) const |
Returns true if the indicated NodePath appears in this collection, false otherwise. More... | |
void | hide () |
Hides all NodePaths in the collection. More... | |
bool | is_empty () const |
Returns true if there are no NodePaths in the collection, false otherwise. More... | |
void | ls () const |
Lists all the nodes at and below each node in the collection hierarchically. More... | |
void | ls (ostream &out, int indent_level=0) const |
Lists all the nodes at and below each node in the collection hierarchically. More... | |
MAKE_SEQ (get_paths, get_num_paths, get_path) | |
NodePathCollection | operator+ (const NodePathCollection &other) const |
Returns a NodePathCollection representing the concatenation of the two lists. More... | |
void | operator+= (const NodePathCollection &other) |
Appends the other list onto the end of this one. More... | |
void | operator= (const NodePathCollection ©) |
NodePath | operator[] (int index) const |
Returns the nth NodePath in the collection. More... | |
void | output (ostream &out) const |
Writes a brief one-line description of the NodePathCollection to the indicated output stream. More... | |
void | remove_duplicate_paths () |
Removes any duplicate entries of the same NodePaths on this collection. More... | |
bool | remove_path (const NodePath &node_path) |
Removes the indicated NodePath from the collection. More... | |
void | remove_paths_from (const NodePathCollection &other) |
Removes from this collection all of the NodePaths listed in the other collection. More... | |
void | reparent_to (const NodePath &other) |
Reparents all the NodePaths in the collection to the indicated node. More... | |
void | reserve (size_t num) |
This is a hint to Panda to allocate enough memory to hold the given number of NodePaths, if you know ahead of time how many you will be adding. More... | |
void | set_attrib (const RenderAttrib *attrib, int priority=0) |
Applies the indicated RenderAttrib to all NodePaths in the collection. More... | |
void | set_collide_mask (CollideMask new_mask, CollideMask bits_to_change=CollideMask::all_on(), TypeHandle node_type=TypeHandle::none()) |
Recursively applies the indicated CollideMask to the into_collide_masks for all nodes at this level and below. More... | |
void | set_color (PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a=1.0, int priority=0) |
Colors all NodePaths in the collection. More... | |
void | set_color (const LColor &color, int priority=0) |
Colors all NodePaths in the collection. More... | |
void | set_color_scale (PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a=1.0, int priority=0) |
Applies color scales to all NodePaths in the collection. More... | |
void | set_color_scale (const LVecBase4 &scale, int priority=0) |
Applies color scales to all NodePaths in the collection. More... | |
void | set_texture (Texture *tex, int priority=0) |
Adds the indicated texture to the list of textures that will be rendered on the default texture stage. More... | |
void | set_texture (TextureStage *stage, Texture *tex, int priority=0) |
Adds the indicated texture to the list of textures that will be rendered on the indicated multitexture stage. More... | |
void | set_texture_off (int priority=0) |
Sets the geometry at this level and below to render using no texture, on any stage. More... | |
void | set_texture_off (TextureStage *stage, int priority=0) |
Sets the geometry at this level and below to render using no texture, on the indicated stage. More... | |
void | show () |
Shows all NodePaths in the collection. More... | |
int | size () const |
Returns the number of paths in the collection. More... | |
void | stash () |
Stashes all NodePaths in the collection. More... | |
void | unstash () |
Unstashes all NodePaths in the collection. More... | |
void | write (ostream &out, int indent_level=0) const |
Writes a complete multi-line description of the NodePathCollection to the indicated output stream. More... | |
void | wrt_reparent_to (const NodePath &other) |
Reparents all the NodePaths in the collection to the indicated node, adjusting each transform so as not to move in world coordinates. More... | |
This is a set of zero or more NodePaths.
It's handy for returning from functions that need to return multiple NodePaths (for instance, NodePaths::get_children).
Definition at line 29 of file nodePathCollection.h.
void NodePathCollection::add_path | ( | const NodePath & | node_path | ) |
Adds a new NodePath to the collection.
Definition at line 59 of file nodePathCollection.cxx.
References remove_path().
Referenced by append(), FindApproxLevelEntry::consider_node(), NodePath::get_children(), CharacterJoint::get_local_transforms(), CharacterJoint::get_net_transforms(), NodePath::get_stashed_children(), and SpriteParticleRenderer::make_copy().
void NodePathCollection::add_paths_from | ( | const NodePathCollection & | other | ) |
Adds all the NodePaths indicated in the other collection to this path.
The other paths are simply appended to the end of the paths in this list; duplicates are not automatically removed.
Definition at line 119 of file nodePathCollection.cxx.
References get_num_paths(), get_path(), and remove_paths_from().
Referenced by operator+=(), and remove_path().
|
inline |
Adds a new NodePath to the collection.
This method duplicates the add_path() method; it is provided to satisfy Python's naming convention.
Definition at line 56 of file nodePathCollection.I.
References add_path(), and extend().
Referenced by operator+().
Calculates the minimum and maximum vertices of all Geoms at these NodePath's bottom nodes and below This is a tight bounding box; it will generally be tighter than the bounding volume returned by get_bounds() (but it is more expensive to compute).
The return value is true if any points are within the bounding volume, or false if none are.
Definition at line 457 of file nodePathCollection.cxx.
References set_texture().
Referenced by set_collide_mask().
void NodePathCollection::clear | ( | ) |
Removes all NodePaths from the collection.
Definition at line 197 of file nodePathCollection.cxx.
References reserve().
Referenced by has_path(), and SpriteParticleRenderer::make_copy().
|
inline |
Applies color scales to all NodePaths in the collection.
The existing color scale, if any, is multiplied by the specified color scale.
Definition at line 112 of file nodePathCollection.I.
Referenced by set_color_scale().
void NodePathCollection::compose_color_scale | ( | const LVecBase4 & | scale, |
int | priority = 0 |
||
) |
Applies color scales to all NodePaths in the collection.
The existing color scale, if any, is multiplied by the specified color scale.
Definition at line 629 of file nodePathCollection.cxx.
References NodePath::compose_color_scale(), NodePath::get_state(), set_attrib(), and NodePath::set_state().
void NodePathCollection::detach | ( | ) |
Detaches all NodePaths in the collection.
Definition at line 397 of file nodePathCollection.cxx.
References get_collide_mask().
Referenced by unstash().
|
inline |
Appends the other list onto the end of this one.
This method duplicates the += operator; it is provided to satisfy Python's naming convention.
Definition at line 68 of file nodePathCollection.I.
References ls(), and operator+=().
Referenced by append().
NodePathCollection NodePathCollection::find_all_matches | ( | const string & | path | ) | const |
Returns the complete set of all NodePaths that begin with any NodePath in this collection and can be extended by path.
The shortest paths will be listed first.
Definition at line 296 of file nodePathCollection.cxx.
References FindApproxPath::add_string(), NodePath::is_empty(), and reparent_to().
Referenced by ls().
CollideMask NodePathCollection::get_collide_mask | ( | ) | const |
Returns the union of all of the into_collide_masks for nodes at this level and below.
This is the same thing as node()->get_net_collide_mask().
If you want to return what the into_collide_mask of this node itself is, without regard to its children, use node()->get_into_collide_mask().
Definition at line 415 of file nodePathCollection.cxx.
References set_collide_mask().
Referenced by detach().
int NodePathCollection::get_num_paths | ( | ) | const |
Returns the number of NodePaths in the collection.
Definition at line 230 of file nodePathCollection.cxx.
References get_path().
Referenced by add_paths_from(), FindApproxLevelEntry::consider_node(), MeshDrawer::geometry(), is_empty(), PhysxConvexMeshDesc::set_from_node_path(), PhysxCcdSkeletonDesc::set_from_node_path(), PhysxTriangleMeshDesc::set_from_node_path(), and PhysxClothMeshDesc::set_from_node_path().
NodePath NodePathCollection::get_path | ( | int | index | ) | const |
Returns the nth NodePath in the collection.
Definition at line 240 of file nodePathCollection.cxx.
References NodePath::NodePath(), and operator[]().
Referenced by add_paths_from(), NodePath::find(), NodePath::find_path_to(), MeshDrawer::geometry(), get_num_paths(), PhysxConvexMeshDesc::set_from_node_path(), PhysxCcdSkeletonDesc::set_from_node_path(), PhysxTriangleMeshDesc::set_from_node_path(), and PhysxClothMeshDesc::set_from_node_path().
bool NodePathCollection::has_path | ( | const NodePath & | path | ) | const |
Returns true if the indicated NodePath appears in this collection, false otherwise.
Definition at line 182 of file nodePathCollection.cxx.
References clear().
Referenced by remove_duplicate_paths(), and remove_paths_from().
void NodePathCollection::hide | ( | ) |
Hides all NodePaths in the collection.
Definition at line 361 of file nodePathCollection.cxx.
References stash().
Referenced by show().
bool NodePathCollection::is_empty | ( | ) | const |
Returns true if there are no NodePaths in the collection, false otherwise.
Definition at line 220 of file nodePathCollection.cxx.
References get_num_paths().
Referenced by NodePath::find(), NodePath::find_path_to(), and reserve().
|
inline |
Lists all the nodes at and below each node in the collection hierarchically.
Definition at line 79 of file nodePathCollection.I.
References set_color().
void NodePathCollection::ls | ( | ostream & | out, |
int | indent_level = 0 |
||
) | const |
Lists all the nodes at and below each node in the collection hierarchically.
Definition at line 278 of file nodePathCollection.cxx.
References find_all_matches(), and NodePath::ls().
|
inline |
Returns a NodePathCollection representing the concatenation of the two lists.
Definition at line 42 of file nodePathCollection.I.
References append().
Referenced by operator+=().
|
inline |
Appends the other list onto the end of this one.
Definition at line 31 of file nodePathCollection.I.
References add_paths_from(), and operator+().
Referenced by extend().
NodePath NodePathCollection::operator[] | ( | int | index | ) | const |
Returns the nth NodePath in the collection.
This is the same as get_path(), but it may be a more convenient way to access it.
Definition at line 254 of file nodePathCollection.cxx.
References NodePath::NodePath(), and size().
Referenced by get_path().
void NodePathCollection::output | ( | ostream & | out | ) | const |
Writes a brief one-line description of the NodePathCollection to the indicated output stream.
Definition at line 686 of file nodePathCollection.cxx.
References write().
Referenced by set_attrib().
void NodePathCollection::remove_duplicate_paths | ( | ) |
Removes any duplicate entries of the same NodePaths on this collection.
If a NodePath appears multiple times, the first appearance is retained; subsequent appearances are removed.
Definition at line 155 of file nodePathCollection.cxx.
References has_path().
Referenced by remove_paths_from().
bool NodePathCollection::remove_path | ( | const NodePath & | node_path | ) |
Removes the indicated NodePath from the collection.
Returns true if the path was removed, false if it was not a member of the collection.
Definition at line 82 of file nodePathCollection.cxx.
References add_paths_from().
Referenced by add_path().
void NodePathCollection::remove_paths_from | ( | const NodePathCollection & | other | ) |
Removes from this collection all of the NodePaths listed in the other collection.
Definition at line 134 of file nodePathCollection.cxx.
References has_path(), and remove_duplicate_paths().
Referenced by add_paths_from().
void NodePathCollection::reparent_to | ( | const NodePath & | other | ) |
Reparents all the NodePaths in the collection to the indicated node.
Definition at line 323 of file nodePathCollection.cxx.
References wrt_reparent_to().
Referenced by find_all_matches().
void NodePathCollection::reserve | ( | size_t | num | ) |
This is a hint to Panda to allocate enough memory to hold the given number of NodePaths, if you know ahead of time how many you will be adding.
Definition at line 209 of file nodePathCollection.cxx.
References is_empty().
Referenced by clear().
void NodePathCollection::set_attrib | ( | const RenderAttrib * | attrib, |
int | priority = 0 |
||
) |
Applies the indicated RenderAttrib to all NodePaths in the collection.
An effort is made to apply the attrib to many NodePaths as quickly as possible; redundant RenderState compositions are not duplicated.
Definition at line 659 of file nodePathCollection.cxx.
References NodePath::get_state(), output(), and NodePath::set_state().
Referenced by compose_color_scale().
void NodePathCollection::set_collide_mask | ( | CollideMask | new_mask, |
CollideMask | bits_to_change = CollideMask::all_on() , |
||
TypeHandle | node_type = TypeHandle::none() |
||
) |
Recursively applies the indicated CollideMask to the into_collide_masks for all nodes at this level and below.
The default is to change all bits, but if bits_to_change is not all bits on, then only the bits that are set in bits_to_change are modified, allowing this call to change only a subset of the bits in the subgraph.
Definition at line 437 of file nodePathCollection.cxx.
References calc_tight_bounds().
Referenced by get_collide_mask().
|
inline |
Colors all NodePaths in the collection.
Definition at line 89 of file nodePathCollection.I.
References set_color(), and set_color_scale().
Referenced by ls(), set_color(), and set_texture_off().
void NodePathCollection::set_color | ( | const LColor & | color, |
int | priority = 0 |
||
) |
Colors all NodePaths in the collection.
Definition at line 590 of file nodePathCollection.cxx.
References set_color_scale().
|
inline |
Applies color scales to all NodePaths in the collection.
The existing color scale is replaced.
Definition at line 100 of file nodePathCollection.I.
References compose_color_scale().
Referenced by set_color().
void NodePathCollection::set_color_scale | ( | const LVecBase4 & | scale, |
int | priority = 0 |
||
) |
Applies color scales to all NodePaths in the collection.
The existing color scale is replaced.
Definition at line 601 of file nodePathCollection.cxx.
References compose_color_scale(), NodePath::get_state(), NodePath::set_color_scale(), and NodePath::set_state().
void NodePathCollection::set_texture | ( | Texture * | tex, |
int | priority = 0 |
||
) |
Adds the indicated texture to the list of textures that will be rendered on the default texture stage.
This is the deprecated single-texture variant of this method; it is now superceded by set_texture() that accepts a stage and texture. However, this method may be used in the presence of multitexture if you just want to adjust the default stage.
Definition at line 500 of file nodePathCollection.cxx.
References TextureStage::get_default(), and NodePath::set_texture().
Referenced by calc_tight_bounds().
void NodePathCollection::set_texture | ( | TextureStage * | stage, |
Texture * | tex, | ||
int | priority = 0 |
||
) |
Adds the indicated texture to the list of textures that will be rendered on the indicated multitexture stage.
If there are multiple texture stages specified (possibly on multiple different nodes at different levels), they will all be applied to geometry together, according to the stage specification set up in the TextureStage object.
Definition at line 517 of file nodePathCollection.cxx.
References NodePath::get_state(), NodePath::set_state(), NodePath::set_texture(), and set_texture_off().
void NodePathCollection::set_texture_off | ( | int | priority = 0 | ) |
Sets the geometry at this level and below to render using no texture, on any stage.
This is different from not specifying a texture; rather, this specifically contradicts set_texture() at a higher node level (or, with a priority, overrides a set_texture() at a lower level).
Definition at line 548 of file nodePathCollection.cxx.
References NodePath::is_empty().
Referenced by set_texture().
void NodePathCollection::set_texture_off | ( | TextureStage * | stage, |
int | priority = 0 |
||
) |
Sets the geometry at this level and below to render using no texture, on the indicated stage.
This is different from not specifying a texture; rather, this specifically contradicts set_texture() at a higher node level (or, with a priority, overrides a set_texture() at a lower level).
Definition at line 564 of file nodePathCollection.cxx.
References NodePath::get_state(), set_color(), NodePath::set_state(), and NodePath::set_texture_off().
void NodePathCollection::show | ( | ) |
Shows all NodePaths in the collection.
Definition at line 349 of file nodePathCollection.cxx.
References hide().
Referenced by wrt_reparent_to().
int NodePathCollection::size | ( | ) | const |
Returns the number of paths in the collection.
This is the same thing as get_num_paths().
Definition at line 267 of file nodePathCollection.cxx.
References ls().
Referenced by operator[]().
void NodePathCollection::stash | ( | ) |
Stashes all NodePaths in the collection.
Definition at line 373 of file nodePathCollection.cxx.
References unstash().
Referenced by hide().
void NodePathCollection::unstash | ( | ) |
Unstashes all NodePaths in the collection.
Definition at line 385 of file nodePathCollection.cxx.
References detach().
Referenced by stash(), and NodePath::unstash_all().
void NodePathCollection::write | ( | ostream & | out, |
int | indent_level = 0 |
||
) | const |
Writes a complete multi-line description of the NodePathCollection to the indicated output stream.
Definition at line 701 of file nodePathCollection.cxx.
Referenced by output().
void NodePathCollection::wrt_reparent_to | ( | const NodePath & | other | ) |
Reparents all the NodePaths in the collection to the indicated node, adjusting each transform so as not to move in world coordinates.
Definition at line 337 of file nodePathCollection.cxx.
References show().
Referenced by reparent_to().