Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
NodePathCollection Class Reference

This is a set of zero or more NodePaths. More...

#include "nodePathCollection.h"

Public Member Functions

void add_path (const NodePath &node_path)
 Adds a new NodePath to the collection.
 
void add_paths_from (const NodePathCollection &other)
 Adds all the NodePaths indicated in the other collection to this path.
 
void append (const NodePath &node_path)
 Adds a new NodePath to the collection.
 
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).
 
void clear ()
 Removes all NodePaths from the collection.
 
void compose_color_scale (const LVecBase4 &scale, int priority=0)
 Applies color scales to all NodePaths in the collection.
 
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.
 
void detach ()
 Detaches all NodePaths in the collection.
 
void extend (const NodePathCollection &other)
 Appends the other list onto the end of this one.
 
NodePathCollection find_all_matches (const std::string &path) const
 Returns the complete set of all NodePaths that begin with any NodePath in this collection and can be extended by path.
 
CollideMask get_collide_mask () const
 Returns the union of all of the into_collide_masks for nodes at this level and below.
 
int get_num_paths () const
 
NodePath get_path (int index) const
 
bool has_path (const NodePath &path) const
 Returns true if the indicated NodePath appears in this collection, false otherwise.
 
void hide ()
 Hides all NodePaths in the collection.
 
bool is_empty () const
 Returns true if there are no NodePaths in the collection, false otherwise.
 
void ls () const
 Lists all the nodes at and below each node in the collection hierarchically.
 
void ls (std::ostream &out, int indent_level=0) const
 Lists all the nodes at and below each node in the collection hierarchically.
 
NodePathCollection operator+ (const NodePathCollection &other) const
 Returns a NodePathCollection representing the concatenation of the two lists.
 
void operator+= (const NodePathCollection &other)
 Appends the other list onto the end of this one.
 
NodePath operator[] (size_t index) const
 Returns the nth NodePath in the collection.
 
void output (std::ostream &out) const
 Writes a brief one-line description of the NodePathCollection to the indicated output stream.
 
void remove_duplicate_paths ()
 Removes any duplicate entries of the same NodePaths on this collection.
 
bool remove_path (const NodePath &node_path)
 Removes the indicated NodePath from the collection.
 
void remove_paths_from (const NodePathCollection &other)
 Removes from this collection all of the NodePaths listed in the other collection.
 
void reparent_to (const NodePath &other)
 Reparents all the NodePaths in the collection to the indicated node.
 
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.
 
void set_attrib (const RenderAttrib *attrib, int priority=0)
 Applies the indicated RenderAttrib to all NodePaths in the collection.
 
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.
 
void set_color (const LColor &color, int priority=0)
 Colors all NodePaths in the collection.
 
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.
 
void set_color_scale (const LVecBase4 &scale, int priority=0)
 Applies color scales to all NodePaths in the collection.
 
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.
 
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.
 
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.
 
void set_texture_off (int priority=0)
 Sets the geometry at this level and below to render using no texture, on any stage.
 
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.
 
void show ()
 Shows all NodePaths in the collection.
 
size_t size () const
 Returns the number of paths in the collection.
 
void stash ()
 Stashes all NodePaths in the collection.
 
void unstash ()
 Unstashes all NodePaths in the collection.
 
void write (std::ostream &out, int indent_level=0) const
 Writes a complete multi-line description of the NodePathCollection to the indicated output stream.
 
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.
 

Public Attributes

 get_num_paths
 Returns the number of NodePaths in the collection.
 
 get_path
 Returns the nth NodePath in the collection.
 

Detailed Description

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 26 of file nodePathCollection.h.

Member Function Documentation

◆ add_path()

void NodePathCollection::add_path ( const NodePath & node_path)

◆ add_paths_from()

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 80 of file nodePathCollection.cxx.

References add_path(), get_num_paths, and get_path.

Referenced by operator+=().

◆ append()

void NodePathCollection::append ( const NodePath & node_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 37 of file nodePathCollection.I.

References add_path().

◆ calc_tight_bounds()

bool NodePathCollection::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).

The return value is true if any points are within the bounding volume, or false if none are.

Definition at line 361 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

◆ clear()

void NodePathCollection::clear ( )

Removes all NodePaths from the collection.

Definition at line 149 of file nodePathCollection.cxx.

◆ compose_color_scale() [1/2]

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 511 of file nodePathCollection.cxx.

References NodePath::compose_color_scale(), NodePath::get_state(), and NodePath::set_state().

◆ compose_color_scale() [2/2]

void NodePathCollection::compose_color_scale ( PN_stdfloat r,
PN_stdfloat g,
PN_stdfloat b,
PN_stdfloat a = 1.0,
int priority = 0 )
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 81 of file nodePathCollection.I.

References compose_color_scale().

Referenced by compose_color_scale().

◆ detach()

void NodePathCollection::detach ( )

Detaches all NodePaths in the collection.

Definition at line 313 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

◆ extend()

void NodePathCollection::extend ( const NodePathCollection & other)
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 46 of file nodePathCollection.I.

References operator+=().

◆ find_all_matches()

NodePathCollection NodePathCollection::find_all_matches ( const std::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 228 of file nodePathCollection.cxx.

References FindApproxPath::add_string(), get_num_paths, get_path, and is_empty().

◆ get_collide_mask()

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 327 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

◆ has_path()

bool NodePathCollection::has_path ( const NodePath & path) const

Returns true if the indicated NodePath appears in this collection, false otherwise.

Definition at line 136 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

Referenced by remove_paths_from().

◆ hide()

void NodePathCollection::hide ( )

Hides all NodePaths in the collection.

Definition at line 283 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

◆ is_empty()

bool NodePathCollection::is_empty ( ) const

Returns true if there are no NodePaths in the collection, false otherwise.

Definition at line 166 of file nodePathCollection.cxx.

Referenced by NodePath::find(), find_all_matches(), NodePath::find_path_to(), and set_texture_off().

◆ ls() [1/2]

void NodePathCollection::ls ( ) const
inline

Lists all the nodes at and below each node in the collection hierarchically.

Definition at line 55 of file nodePathCollection.I.

References ls().

Referenced by ls().

◆ ls() [2/2]

void NodePathCollection::ls ( std::ostream & out,
int indent_level = 0 ) const

Lists all the nodes at and below each node in the collection hierarchically.

Definition at line 213 of file nodePathCollection.cxx.

References get_num_paths, get_path, indent(), and NodePath::ls().

◆ operator+()

NodePathCollection NodePathCollection::operator+ ( const NodePathCollection & other) const
inline

Returns a NodePathCollection representing the concatenation of the two lists.

Definition at line 26 of file nodePathCollection.I.

◆ operator+=()

void NodePathCollection::operator+= ( const NodePathCollection & other)
inline

Appends the other list onto the end of this one.

Definition at line 17 of file nodePathCollection.I.

References add_paths_from().

Referenced by extend().

◆ operator[]()

NodePath NodePathCollection::operator[] ( size_t 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 193 of file nodePathCollection.cxx.

◆ output()

void NodePathCollection::output ( std::ostream & out) const

Writes a brief one-line description of the NodePathCollection to the indicated output stream.

Definition at line 562 of file nodePathCollection.cxx.

References get_num_paths.

◆ remove_duplicate_paths()

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 111 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

◆ remove_path()

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 47 of file nodePathCollection.cxx.

◆ remove_paths_from()

void NodePathCollection::remove_paths_from ( const NodePathCollection & other)

Removes from this collection all of the NodePaths listed in the other collection.

Definition at line 93 of file nodePathCollection.cxx.

References get_num_paths, get_path, and has_path().

◆ reparent_to()

void NodePathCollection::reparent_to ( const NodePath & other)

Reparents all the NodePaths in the collection to the indicated node.

Definition at line 252 of file nodePathCollection.cxx.

References get_num_paths, get_path, and reparent_to().

Referenced by reparent_to().

◆ reserve()

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 158 of file nodePathCollection.cxx.

◆ set_attrib()

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 537 of file nodePathCollection.cxx.

References NodePath::get_state(), and NodePath::set_state().

Referenced by set_color(), and set_texture_off().

◆ set_collide_mask()

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 344 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

◆ set_color() [1/2]

void NodePathCollection::set_color ( const LColor & color,
int priority = 0 )

Colors all NodePaths in the collection.

Definition at line 477 of file nodePathCollection.cxx.

References set_attrib().

◆ set_color() [2/2]

void NodePathCollection::set_color ( PN_stdfloat r,
PN_stdfloat g,
PN_stdfloat b,
PN_stdfloat a = 1.0,
int priority = 0 )
inline

Colors all NodePaths in the collection.

Definition at line 63 of file nodePathCollection.I.

References set_color().

Referenced by set_color().

◆ set_color_scale() [1/2]

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 486 of file nodePathCollection.cxx.

References NodePath::get_state(), NodePath::set_color_scale(), and NodePath::set_state().

◆ set_color_scale() [2/2]

void NodePathCollection::set_color_scale ( PN_stdfloat r,
PN_stdfloat g,
PN_stdfloat b,
PN_stdfloat a = 1.0,
int priority = 0 )
inline

Applies color scales to all NodePaths in the collection.

The existing color scale is replaced.

Definition at line 72 of file nodePathCollection.I.

References set_color_scale().

Referenced by set_color_scale().

◆ set_texture() [1/2]

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 401 of file nodePathCollection.cxx.

References TextureStage::get_default, and set_texture().

Referenced by set_texture().

◆ set_texture() [2/2]

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 414 of file nodePathCollection.cxx.

References NodePath::get_state(), NodePath::set_state(), and NodePath::set_texture().

◆ set_texture_off() [1/2]

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 441 of file nodePathCollection.cxx.

References is_empty(), and set_attrib().

◆ set_texture_off() [2/2]

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 453 of file nodePathCollection.cxx.

References NodePath::get_state(), NodePath::set_state(), and NodePath::set_texture_off().

◆ show()

void NodePathCollection::show ( )

Shows all NodePaths in the collection.

Definition at line 273 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

◆ size()

size_t NodePathCollection::size ( ) const

Returns the number of paths in the collection.

This is the same thing as get_num_paths().

Definition at line 204 of file nodePathCollection.cxx.

◆ stash()

void NodePathCollection::stash ( )

Stashes all NodePaths in the collection.

Definition at line 293 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

◆ unstash()

void NodePathCollection::unstash ( )

Unstashes all NodePaths in the collection.

Definition at line 303 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

Referenced by NodePath::unstash_all().

◆ write()

void NodePathCollection::write ( std::ostream & out,
int indent_level = 0 ) const

Writes a complete multi-line description of the NodePathCollection to the indicated output stream.

Definition at line 575 of file nodePathCollection.cxx.

References get_num_paths, get_path, and indent().

◆ wrt_reparent_to()

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 263 of file nodePathCollection.cxx.

References get_num_paths, and get_path.

Member Data Documentation

◆ get_num_paths

int NodePathCollection::get_num_paths

◆ get_path

NodePath NodePathCollection::get_path

The documentation for this class was generated from the following files: