pub struct NodePath(_);
Expand description

A reference-counted relative or absolute path in a scene tree, for use with Node.get_node() and similar functions. It can reference a node, a resource within a node, or a property of a node or resource.

"Path2D/PathFollow2D/Sprite:texture:size" would refer to the size property of the texture resource on the node named “Sprite” which is a child of the other named nodes in the path. Note that if you want to get a resource, you must end the path with a colon, otherwise the last element will be used as a property name.

If a string is passed to Node.get_node(), it will be automatically converted to a NodePath, but NodePath can be parsed ahead of time with NodePath::from_str or NodePath::new.

A NodePath consists of node names, “sub-node” (resource) names, and the name of a property in the final node or resource.

More info at Godot’s official documentation

Implementations

Create a NodePath from a string, e.g. "Path2D/PathFollow2D/Sprite:texture:size". A path is absolute if it starts with a slash. Absolute paths are only valid in the global scene tree, not within individual scenes. In a relative path, "." and ".." indicate the current node and its parent.

Create a NodePath from a GodotString.

Returns true if the node path is empty.

Returns true if the node path is absolute.

Get the number of node names which make up the path.

Returns the resource name of the specified idx, 0 to subname_count()

Returns the number of resource names in the path.

Returns the NodePath as a GodotString

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Executes the destructor for this type. Read more
A type-specific hint type that is valid for the type being exported. Read more
Returns ExportInfo given an optional typed hint.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Creates a new reference to the underlying object.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more
Converts the given value to a String. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.