Panda3D
 All Classes Functions Variables Enumerations
nodePathCollection.h
1 // Filename: nodePathCollection.h
2 // Created by: drose (06Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef NODEPATHCOLLECTION_H
16 #define NODEPATHCOLLECTION_H
17 
18 #include "pandabase.h"
19 #include "nodePath.h"
20 #include "pointerToArray.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : NodePathCollection
24 // Description : This is a set of zero or more NodePaths. It's handy
25 // for returning from functions that need to return
26 // multiple NodePaths (for instance,
27 // NodePaths::get_children).
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_PANDA_PGRAPH NodePathCollection {
30 PUBLISHED:
33  void operator = (const NodePathCollection &copy);
34  INLINE ~NodePathCollection();
35 
36 #ifdef HAVE_PYTHON
37  EXTENSION(NodePathCollection(PyObject *self, PyObject *sequence));
38  EXTENSION(PyObject *__reduce__(PyObject *self) const);
39 #endif
40 
41  void add_path(const NodePath &node_path);
42  bool remove_path(const NodePath &node_path);
43  void add_paths_from(const NodePathCollection &other);
44  void remove_paths_from(const NodePathCollection &other);
45  void remove_duplicate_paths();
46  bool has_path(const NodePath &path) const;
47  void clear();
48  void reserve(size_t num);
49 
50  bool is_empty() const;
51  int get_num_paths() const;
52  NodePath get_path(int index) const;
53  MAKE_SEQ(get_paths, get_num_paths, get_path);
54  NodePath operator [] (int index) const;
55  int size() const;
56  INLINE void operator += (const NodePathCollection &other);
57  INLINE NodePathCollection operator + (const NodePathCollection &other) const;
58 
59  // Method names to satisfy Python's conventions.
60  INLINE void append(const NodePath &node_path);
61  INLINE void extend(const NodePathCollection &other);
62 
63  // Handy operations on many NodePaths at once.
64  INLINE void ls() const;
65  void ls(ostream &out, int indent_level = 0) const;
66 
67  NodePathCollection find_all_matches(const string &path) const;
68  void reparent_to(const NodePath &other);
69  void wrt_reparent_to(const NodePath &other);
70 
71  void show();
72  void hide();
73  void stash();
74  void unstash();
75  void detach();
76 
77  CollideMask get_collide_mask() const;
78  void set_collide_mask(CollideMask new_mask, CollideMask bits_to_change = CollideMask::all_on(),
79  TypeHandle node_type = TypeHandle::none());
80 
81  bool calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point) const;
82 
83  EXTENSION(PyObject *get_tight_bounds() const);
84 
85  void set_texture(Texture *tex, int priority = 0);
86  void set_texture(TextureStage *stage, Texture *tex, int priority = 0);
87  void set_texture_off(int priority = 0);
88  void set_texture_off(TextureStage *stage, int priority = 0);
89 
90  INLINE void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a = 1.0,
91  int priority = 0);
92  void set_color(const LColor &color, int priority = 0);
93 
94  INLINE void set_color_scale(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a = 1.0,
95  int priority = 0);
96  void set_color_scale(const LVecBase4 &scale, int priority = 0);
97 
98  INLINE void compose_color_scale(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a = 1.0,
99  int priority = 0);
100  void compose_color_scale(const LVecBase4 &scale, int priority = 0);
101 
102  void set_attrib(const RenderAttrib *attrib, int priority = 0);
103 
104  void output(ostream &out) const;
105  void write(ostream &out, int indent_level = 0) const;
106 
107 private:
108  typedef PTA(NodePath) NodePaths;
109  NodePaths _node_paths;
110 
111  // This typedef is used in set_attrib() and similar methods.
113 };
114 
115 INLINE ostream &operator << (ostream &out, const NodePathCollection &col) {
116  col.output(out);
117  return out;
118 }
119 
120 #include "nodePathCollection.I"
121 
122 #endif
123 
124 
This is our own Panda specialization on the default STL map.
Definition: pmap.h:52
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:60
static TypeHandle none()
Returns a special zero-valued TypeHandle that is used to indicate no type.
Definition: typeHandle.I:274
static BitMask< WType, nbits > all_on()
Returns a BitMask whose bits are all on.
Definition: bitMask.I:73
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:75
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
void output(ostream &out) const
Writes a brief one-line description of the NodePathCollection to the indicated output stream...
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
Defines the properties of a named stage of the multitexture pipeline.
Definition: textureStage.h:38
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165
This is a set of zero or more NodePaths.