Panda3D
Public Member Functions | List of all members
WeakNodePath Class Reference

This class is a wrapper around a NodePath that, unlike the actual NodePath class, doesn't hold a reference count to the node. More...

Public Member Functions

 __init__ (const NodePath node_path)
 
 __init__ (const WeakNodePath copy)
 
 clear ()
 Sets this NodePath to the empty NodePath. More...
 
int compareTo (const NodePath other)
 Returns a number less than zero if this NodePath sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent. More...
 
int compareTo (const WeakNodePath other)
 Returns a number less than zero if this WeakNodePath sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent. More...
 
int getKey ()
 Returns the same values as NodePath::get_key(). More...
 
NodePath getNodePath ()
 Returns the NodePath held within this object, or an empty NodePath with the error flag set if the object was deleted. More...
 
bool isEmpty ()
 Returns true if the NodePath contains no nodes, or if it has been deleted. More...
 
PandaNode node ()
 Returns the PandaNode held within this object, or nullptr if the object was deleted. More...
 
bool operator != (const NodePath other)
 
bool operator != (const WeakNodePath other)
 
bool operator< (const NodePath other)
 
bool operator< (const WeakNodePath other)
 
WeakNodePath operator= (const NodePath node_path)
 
WeakNodePath operator= (const WeakNodePath copy)
 
bool operator== (const NodePath other)
 
bool operator== (const WeakNodePath other)
 
 output (Ostream out)
 
bool wasDeleted ()
 Returns true if the NodePath we were referencing has been quietly deleted outside of the WeakNodePath. More...
 

Detailed Description

This class is a wrapper around a NodePath that, unlike the actual NodePath class, doesn't hold a reference count to the node.

Thus the node may be detached from the scene graph and destructed at any time.

You can call is_valid() or was_deleted() at any time to determine whether the node is still around; if it is, get_node_path() will return the associated NodePath.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( const NodePath  node_path)

◆ __init__() [2/2]

__init__ ( const WeakNodePath  copy)

◆ clear()

clear ( )

Sets this NodePath to the empty NodePath.

It will no longer point to any node.

◆ compareTo() [1/2]

int compareTo ( const NodePath  other)

Returns a number less than zero if this NodePath sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent.

Two NodePaths are considered equivalent if they consist of exactly the same list of nodes in the same order. Otherwise, they are different; different NodePaths will be ranked in a consistent but undefined ordering; the ordering is useful only for placing the NodePaths in a sorted container like an STL set.

◆ compareTo() [2/2]

int compareTo ( const WeakNodePath  other)

Returns a number less than zero if this WeakNodePath sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent.

Two WeakNodePaths are considered equivalent if they consist of exactly the same list of nodes in the same order. Otherwise, they are different; different WeakNodePaths will be ranked in a consistent but undefined ordering; the ordering is useful only for placing the WeakNodePaths in a sorted container like an STL set.

◆ getKey()

int getKey ( )

Returns the same values as NodePath::get_key().

◆ getNodePath()

NodePath getNodePath ( )

Returns the NodePath held within this object, or an empty NodePath with the error flag set if the object was deleted.

◆ isEmpty()

bool isEmpty ( )

Returns true if the NodePath contains no nodes, or if it has been deleted.

◆ node()

PandaNode node ( )

Returns the PandaNode held within this object, or nullptr if the object was deleted.

◆ operator !=() [1/2]

bool operator != ( const NodePath  other)

◆ operator !=() [2/2]

bool operator != ( const WeakNodePath  other)

◆ operator<() [1/2]

bool operator< ( const NodePath  other)

◆ operator<() [2/2]

bool operator< ( const WeakNodePath  other)

◆ operator=() [1/2]

WeakNodePath operator= ( const NodePath  node_path)

◆ operator=() [2/2]

WeakNodePath operator= ( const WeakNodePath  copy)

◆ operator==() [1/2]

bool operator== ( const NodePath  other)

◆ operator==() [2/2]

bool operator== ( const WeakNodePath  other)

◆ output()

output ( Ostream  out)

◆ wasDeleted()

bool wasDeleted ( )

Returns true if the NodePath we were referencing has been quietly deleted outside of the WeakNodePath.