18 WeakNodePath(
const NodePath &node_path) :
19 _head(node_path._head),
30 _backup_key(copy._backup_key)
44 INLINE
void WeakNodePath::
45 operator = (
const NodePath &node_path) {
46 _head = node_path._head;
53 INLINE
void WeakNodePath::
56 _backup_key = copy._backup_key;
73 operator bool ()
const {
74 return _head.is_valid_pointer();
82 return _head ==
nullptr || _head.was_deleted();
91 return _head !=
nullptr && _head.was_deleted();
101 result._head = _head.lock();
102 if (!_head.is_null() && result._head ==
nullptr) {
103 result._error_type = NodePath::ET_fail;
114 if (
auto head = _head.lock()) {
115 return head->get_node();
125 INLINE
bool WeakNodePath::
126 operator == (
const NodePath &other)
const {
127 return _head.get_orig() == other._head && !_head.was_deleted();
133 INLINE
bool WeakNodePath::
134 operator != (
const NodePath &other)
const {
144 INLINE
bool WeakNodePath::
145 operator < (
const NodePath &other)
const {
146 return _head.owner_before(other._head);
159 INLINE
int WeakNodePath::
160 compare_to(
const NodePath &other)
const {
161 if (
operator != (other)) {
162 return _head.owner_before(other._head) ? -1 : 1;
171 INLINE
bool WeakNodePath::
173 return !_head.owner_before(other._head) && !other._head.owner_before(_head);
179 INLINE
bool WeakNodePath::
181 return _head.owner_before(other._head) || other._head.owner_before(_head);
190 INLINE
bool WeakNodePath::
192 return _head.owner_before(other._head);
205 INLINE
int WeakNodePath::
207 return other._head.owner_before(_head) - _head.owner_before(other._head);
213 INLINE
int WeakNodePath::
215 if (
auto head = _head.lock()) {
216 _backup_key = head->get_key();
221 INLINE std::ostream &operator << (std::ostream &out,
const WeakNodePath &node_path) {
222 node_path.output(out);
A basic node of the scene graph or data graph.
void clear()
Sets this NodePath to the empty NodePath.
PT(PandaNode) WeakNodePath
Returns the PandaNode held within this object, or nullptr if the object was deleted.
bool is_empty() const
Returns true if the NodePath contains no nodes, or if it has been deleted.
NodePath get_node_path() const
Returns the NodePath held within this object, or an empty NodePath with the error flag set if the obj...
bool operator==(const NodePath &other) const
Returns true if the two paths are equivalent; that is, if they contain the same list of nodes in the ...
This class is a wrapper around a NodePath that, unlike the actual NodePath class, doesn't hold a refe...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
bool was_deleted() const
Returns true if the NodePath we were referencing has been quietly deleted outside of the WeakNodePath...