diff options
Diffstat (limited to 'doc/classes/Node.xml')
-rw-r--r-- | doc/classes/Node.xml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 1fb2e7350f..e8b43ead85 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -268,6 +268,14 @@ <argument index="0" name="path" type="NodePath"> </argument> <description> + Fetches a node and one of its resources as specified by the [NodePath]'s subname (e.g. [code]Area2D/CollisionShape2D:shape[/code]). If several nested resources are specified in the [NodePath], the last one will be fetched. + The return value is an array of size 3: the first index points to the [Node] (or [code]null[/code] if not found), the second index points to the [Resource] (or [code]null[/code] if not found), and the third index is the remaining [NodePath], if any. + For example, assuming that [code]Area2D/CollisionShape2D[/code] is a valid node and that its [code]shape[/code] property has been assigned a [RectangleShape2D] resource, one could have this kind of output: + [codeblock] + print(get_node_and_resource("Area2D/CollisionShape2D")) # [[CollisionShape2D:1161], Null, ] + print(get_node_and_resource("Area2D/CollisionShape2D:shape")) # [[CollisionShape2D:1161], [RectangleShape2D:1156], ] + print(get_node_and_resource("Area2D/CollisionShape2D:shape:extents")) # [[CollisionShape2D:1161], [RectangleShape2D:1156], :extents] + [/codeblock] </description> </method> <method name="get_node_or_null" qualifiers="const"> @@ -359,6 +367,7 @@ <argument index="0" name="path" type="NodePath"> </argument> <description> + Returns [code]true[/code] if the [NodePath] points to a valid node and its subname points to a valid resource, e.g. [code]Area2D/CollisionShape2D:shape[/code]. Properties with a non-[Resource] type (e.g. nodes or primitive math types) are not considered resources. </description> </method> <method name="is_a_parent_of" qualifiers="const"> |