Panda3D
Loading...
Searching...
No Matches
workingNodePath.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file workingNodePath.I
10 * @author drose
11 * @date 2002-03-16
12 */
13
14/**
15 * Creates a WorkingNodePath that is the same as the indicated NodePath. This
16 * is generally used to begin the traversal of a scene graph with the root
17 * NodePath.
18 */
20WorkingNodePath(const NodePath &start) {
21 nassertv(!start.is_empty());
22 _next = nullptr;
23 _start = start._head;
24 _node = start.node();
25}
26
27/**
28 *
29 */
32 _next(copy._next),
33 _start(copy._start),
34 _node(copy._node)
35{
36 nassertv(_next != nullptr ||
37 _start != nullptr);
38}
39
40/**
41 * Creates a WorkingNodePath that is the same as the indicated
42 * WorkingNodePath, plus one node. This is generally used to continue the
43 * traversal to the next node.
44 */
46WorkingNodePath(const WorkingNodePath &parent, PandaNode *child) :
47 _next(&parent),
48 _start(nullptr),
49 _node(child) {
50 nassertv(_node != _next->_node);
51}
52
53/**
54 *
55 */
56INLINE WorkingNodePath::
57~WorkingNodePath() {
58}
59
60/**
61 *
62 */
63INLINE void WorkingNodePath::
64operator = (const WorkingNodePath &copy) {
65 _next = copy._next;
66 _start = copy._start;
67 _node = copy._node;
68
69 nassertv(_next != nullptr ||
70 _start != nullptr);
71}
72
73/**
74 * Constructs and returns an actual NodePath that represents the same path we
75 * have just traversed.
76 */
78get_node_path() const {
79 NodePath result;
80 result._head = r_get_node_path();
81 nassertr(result._head != nullptr, NodePath::fail());
82 return result;
83}
84
85/**
86 * Returns the node traversed to so far.
87 */
89node() const {
90 return _node;
91}
92
93INLINE std::ostream &
94operator << (std::ostream &out, const WorkingNodePath &node_path) {
95 node_path.output(out);
96 return out;
97}
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
bool is_empty() const
Returns true if the NodePath contains no nodes.
Definition nodePath.I:188
PandaNode * node() const
Returns the referenced node of the path.
Definition nodePath.I:227
static NodePath fail()
Creates a NodePath with the ET_fail error type set.
Definition nodePath.I:149
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
This is a class designed to support low-overhead traversals of the complete scene graph,...
PandaNode * node() const
Returns the node traversed to so far.
get_node_path
Constructs and returns an actual NodePath that represents the same path we have just traversed.
WorkingNodePath(const NodePath &start)
Creates a WorkingNodePath that is the same as the indicated NodePath.