18WeakNodePath(
const NodePath &node_path) :
19 _head(node_path._head),
30 _backup_key(copy._backup_key)
44INLINE
void WeakNodePath::
45operator = (
const NodePath &node_path) {
46 _head = node_path._head;
53INLINE
void WeakNodePath::
56 _backup_key = copy._backup_key;
73operator 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();
125INLINE
bool WeakNodePath::
126operator == (
const NodePath &other)
const {
127 return _head.get_orig() == other._head && !_head.was_deleted();
133INLINE
bool WeakNodePath::
134operator != (
const NodePath &other)
const {
135 return !operator == (other);
144INLINE
bool WeakNodePath::
145operator < (
const NodePath &other)
const {
146 return _head.owner_before(other._head);
159INLINE
int WeakNodePath::
160compare_to(
const NodePath &other)
const {
161 if (
operator != (other)) {
162 return _head.owner_before(other._head) ? -1 : 1;
171INLINE
bool WeakNodePath::
173 return !_head.owner_before(other._head) && !other._head.owner_before(_head);
179INLINE
bool WeakNodePath::
181 return _head.owner_before(other._head) || other._head.owner_before(_head);
190INLINE
bool WeakNodePath::
192 return _head.owner_before(other._head);
205INLINE
int WeakNodePath::
207 return other._head.owner_before(_head) - _head.owner_before(other._head);
213INLINE
int WeakNodePath::
215 if (
auto head = _head.lock()) {
216 _backup_key = head->get_key();
221INLINE std::ostream &operator << (std::ostream &out,
const WeakNodePath &node_path) {
222 node_path.output(out);
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
A basic node of the scene graph or data graph.
This class is a wrapper around a NodePath that, unlike the actual NodePath class, doesn't hold a refe...
void clear()
Sets this NodePath to the empty NodePath.
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 is_empty() const
Returns true if the NodePath contains no nodes, or if it has been deleted.
bool was_deleted() const
Returns true if the NodePath we were referencing has been quietly deleted outside of the WeakNodePath...
PT(PandaNode) WeakNodePath
Returns the PandaNode held within this object, or nullptr if the object was deleted.