34 if (_node_paths.get_ref_count() > 1) {
35 NodePaths old_node_paths = _node_paths;
36 _node_paths = NodePaths::empty_array(0);
37 _node_paths.v() = old_node_paths.v();
40 _node_paths.push_back(node_path);
50 for (
int i = 0; path_index == -1 && i < (int)_node_paths.size(); i++) {
51 if (_node_paths[i] == node_path) {
56 if (path_index == -1) {
65 if (_node_paths.get_ref_count() > 1) {
66 NodePaths old_node_paths = _node_paths;
67 _node_paths = NodePaths::empty_array(0);
68 _node_paths.v() = old_node_paths.v();
71 _node_paths.erase(_node_paths.begin() + path_index);
83 for (
int i = 0; i < other_num_paths; i++) {
97 for (
int i = 0; i < num_paths; i++) {
100 new_paths.push_back(path);
103 _node_paths = new_paths;
116 for (
int i = 0; i < num_paths; i++) {
118 bool duplicated =
false;
120 for (
int j = 0; j < i && !duplicated; j++) {
125 new_paths.push_back(path);
129 _node_paths = new_paths;
160 _node_paths.reserve(num);
168 return _node_paths.empty();
176 return _node_paths.size();
184 nassertr(index >= 0 && index < (
int)_node_paths.size(),
NodePath());
186 return _node_paths[index];
195 nassertr(index < _node_paths.size(),
NodePath());
197 return _node_paths[index];
206 return _node_paths.size();
214 ls(std::ostream &out,
int indent_level)
const {
217 indent(out, indent_level) << path <<
"\n";
218 path.
ls(out, indent_level + 2);
239 start->_next = level;
242 get_path(0).find_matches(result, level, -1);
331 collide_mask |=
get_path(i).get_collide_mask();
348 get_path(i).set_collide_mask(new_mask, bits_to_change, node_type);
363 bool have_bounds =
false;
373 if (
get_path(i).calc_tight_bounds(tmp_min, tmp_max)) {
379 min_point.set(min(min_point._v(0), tmp_min._v(0)),
380 min(min_point._v(1), tmp_min._v(1)),
381 min(min_point._v(2), tmp_min._v(2)));
382 max_point.set(max(max_point._v(0), tmp_max._v(0)),
383 max(max_point._v(1), tmp_max._v(1)),
384 max(max_point._v(2), tmp_max._v(2)));
418 NodePaths::iterator npi;
419 for (npi = _node_paths.begin(); npi != _node_paths.end(); ++npi) {
422 StateMap::iterator smi = state_map.find(orig_state);
423 if (smi != state_map.end()) {
444 set_attrib(TextureAttrib::make_all_off(), priority);
457 NodePaths::iterator npi;
458 for (npi = _node_paths.begin(); npi != _node_paths.end(); ++npi) {
461 StateMap::iterator smi = state_map.find(orig_state);
462 if (smi != state_map.end()) {
478 set_color(
const LColor &color,
int priority) {
479 set_attrib(ColorAttrib::make_flat(color), priority);
490 NodePaths::iterator npi;
491 for (npi = _node_paths.begin(); npi != _node_paths.end(); ++npi) {
494 StateMap::iterator smi = state_map.find(orig_state);
495 if (smi != state_map.end()) {
515 NodePaths::iterator npi;
516 for (npi = _node_paths.begin(); npi != _node_paths.end(); ++npi) {
519 StateMap::iterator smi = state_map.find(orig_state);
520 if (smi != state_map.end()) {
541 NodePaths::iterator npi;
542 for (npi = _node_paths.begin(); npi != _node_paths.end(); ++npi) {
545 StateMap::iterator smi = state_map.find(orig_state);
546 if (smi != state_map.end()) {
552 np.set_attrib(attrib, priority);
563 output(std::ostream &out)
const {
576 write(std::ostream &out,
int indent_level)
const {
This class is local to this package only; it doesn't get exported.
This class is local to this package only; it doesn't get exported.
bool add_string(const std::string &str_path)
Adds a sequence of components separated by slashes, followed optionally by a semicolon and a sequence...
This is a set of zero or more NodePaths.
NodePath operator[](size_t index) const
Returns the nth NodePath in the collection.
void reparent_to(const NodePath &other)
Reparents all the NodePaths in the collection to the indicated node.
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 unstash()
Unstashes all NodePaths in the collection.
void add_path(const NodePath &node_path)
Adds a new NodePath to the collection.
void set_attrib(const RenderAttrib *attrib, int priority=0)
Applies the indicated RenderAttrib to 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 add_paths_from(const NodePathCollection &other)
Adds all the NodePaths indicated in the other collection to this path.
size_t size() const
Returns the number of paths 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 a...
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 ls() const
Lists all the nodes at and below each node in the collection hierarchically.
void detach()
Detaches all NodePaths in the collection.
void remove_paths_from(const NodePathCollection &other)
Removes from this collection all of the NodePaths listed in the other collection.
void set_texture_off(int priority=0)
Sets the geometry at this level and below to render using no texture, on any stage.
void remove_duplicate_paths()
Removes any duplicate entries of the same NodePaths on this collection.
void show()
Shows all NodePaths in the collection.
CollideMask get_collide_mask() const
Returns the union of all of the into_collide_masks for nodes at this level and below.
void reserve(size_t num)
This is a hint to Panda to allocate enough memory to hold the given number of NodePaths,...
bool remove_path(const NodePath &node_path)
Removes the indicated NodePath from the collection.
bool is_empty() const
Returns true if there are no NodePaths in the collection, false otherwise.
void stash()
Stashes all NodePaths in the collection.
void hide()
Hides all NodePaths in the collection.
get_num_paths
Returns the number of NodePaths in the collection.
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 ...
void output(std::ostream &out) const
Writes a brief one-line description of the NodePathCollection to the indicated output stream.
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 wrt_reparent_to(const NodePath &other)
Reparents all the NodePaths in the collection to the indicated node, adjusting each transform so as n...
bool has_path(const NodePath &path) const
Returns true if the indicated NodePath appears in this collection, false otherwise.
get_path
Returns the nth NodePath 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...
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 T...
void clear()
Removes all NodePaths from the collection.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void compose_color_scale(const LVecBase4 &scale, int priority=0)
multiplies the color scale component of the transform, with previous color scale leaving translation ...
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 ls() const
Lists the hierarchy at and below the referenced node.
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_state(const RenderState *state, Thread *current_thread=Thread::get_current_thread())
Changes the complete state object on this node.
const RenderState * get_state(Thread *current_thread=Thread::get_current_thread()) const
Returns the complete state object set on this node.
void set_color_scale(const LVecBase4 &scale, int priority=0)
Sets the color scale component of the transform, leaving translation and rotation untouched.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Defines the properties of a named stage of the multitexture pipeline.
get_default
Returns the default TextureStage that will be used for all texturing that does not name a particular ...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
TypeHandle is the identifier used to differentiate C++ class types.
This is our own Panda specialization on the default STL map.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.