summaryrefslogtreecommitdiff
path: root/doc/classes/Node.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Node.xml')
-rw-r--r--doc/classes/Node.xml57
1 files changed, 39 insertions, 18 deletions
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 7079036879..c9795856d5 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -193,28 +193,45 @@
[b]Note:[/b] It will not work properly if the node contains a script with constructor arguments (i.e. needs to supply arguments to [method Object._init] method). In that case, the node will be duplicated without a script.
</description>
</method>
- <method name="find_nodes" qualifiers="const">
+ <method name="find_child" qualifiers="const">
+ <return type="Node" />
+ <argument index="0" name="pattern" type="String" />
+ <argument index="1" name="recursive" type="bool" default="true" />
+ <argument index="2" name="owned" type="bool" default="true" />
+ <description>
+ Finds the first descendant of this node whose name matches [code]pattern[/code] as in [method String.match].
+ [code]pattern[/code] does not match against the full path, just against individual node names. It is case-sensitive, with [code]"*"[/code] matching zero or more characters and [code]"?"[/code] matching any single character except [code]"."[/code]).
+ If [code]recursive[/code] is [code]true[/code], all child nodes are included, even if deeply nested. Nodes are checked in tree order, so this node's first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. If [code]recursive[/code] is [code]false[/code], only this node's direct children are matched.
+ If [code]owned[/code] is [code]true[/code], this method only finds nodes who have an assigned [member Node.owner]. This is especially important for scenes instantiated through a script, because those scenes don't have an owner.
+ Returns [code]null[/code] if no matching [Node] is found.
+ [b]Note:[/b] As this method walks through all the descendants of the node, it is the slowest way to get a reference to another node. Whenever possible, consider using [method get_node] with unique names instead (see [member unique_name_in_owner]), or caching the node references into variable.
+ [b]Note:[/b] To find all descendant nodes matching a pattern or a class type, see [method find_children].
+ </description>
+ </method>
+ <method name="find_children" qualifiers="const">
<return type="Node[]" />
- <argument index="0" name="mask" type="String" />
+ <argument index="0" name="pattern" type="String" />
<argument index="1" name="type" type="String" default="&quot;&quot;" />
<argument index="2" name="recursive" type="bool" default="true" />
<argument index="3" name="owned" type="bool" default="true" />
<description>
- Finds descendants of this node whose, name matches [code]mask[/code] as in [method String.match], and/or type matches [code]type[/code] as in [method Object.is_class].
- [code]mask[/code] does not match against the full path, just against individual node names. It is case-sensitive, with [code]"*"[/code] matching zero or more characters and [code]"?"[/code] matching any single character except [code]"."[/code]).
- [code]type[/code] will check equality or inheritance. It is case-sensitive, [code]"Object"[/code] will match a node whose type is [code]"Node"[/code] but not the other way around.
- If [code]owned[/code] is [code]true[/code], this method only finds nodes whose owner is this node. This is especially important for scenes instantiated through a script, because those scenes don't have an owner.
- Returns an empty array, if no matching nodes are found.
- [b]Note:[/b] As this method walks through all the descendants of the node, it is the slowest way to get references to other nodes. To avoid using [method find_nodes] too often, consider caching the node references into variables.
+ Finds descendants of this node whose name matches [code]pattern[/code] as in [method String.match], and/or type matches [code]type[/code] as in [method Object.is_class].
+ [code]pattern[/code] does not match against the full path, just against individual node names. It is case-sensitive, with [code]"*"[/code] matching zero or more characters and [code]"?"[/code] matching any single character except [code]"."[/code]).
+ [code]type[/code] will check equality or inheritance, and is case-sensitive. [code]"Object"[/code] will match a node whose type is [code]"Node"[/code] but not the other way around.
+ If [code]recursive[/code] is [code]true[/code], all child nodes are included, even if deeply nested. Nodes are checked in tree order, so this node's first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. If [code]recursive[/code] is [code]false[/code], only this node's direct children are matched.
+ If [code]owned[/code] is [code]true[/code], this method only finds nodes who have an assigned [member Node.owner]. This is especially important for scenes instantiated through a script, because those scenes don't have an owner.
+ Returns an empty array if no matching nodes are found.
+ [b]Note:[/b] As this method walks through all the descendants of the node, it is the slowest way to get references to other nodes. Whenever possible, consider caching the node references into variables.
+ [b]Note:[/b] If you only want to find the first descendant node that matches a pattern, see [method find_child].
</description>
</method>
<method name="find_parent" qualifiers="const">
<return type="Node" />
- <argument index="0" name="mask" type="String" />
+ <argument index="0" name="pattern" type="String" />
<description>
- Finds the first parent of the current node whose name matches [code]mask[/code] as in [method String.match] (i.e. case-sensitive, but [code]"*"[/code] matches zero or more characters and [code]"?"[/code] matches any single character except [code]"."[/code]).
- [b]Note:[/b] It does not match against the full path, just against individual node names.
- [b]Note:[/b] As this method walks upwards in the scene tree, it can be slow in large, deeply nested scene trees. Whenever possible, consider using [method get_node] instead. To avoid using [method find_parent] too often, consider caching the node reference into a variable.
+ Finds the first parent of the current node whose name matches [code]pattern[/code] as in [method String.match].
+ [code]pattern[/code] does not match against the full path, just against individual node names. It is case-sensitive, with [code]"*"[/code] matching zero or more characters and [code]"?"[/code] matching any single character except [code]"."[/code]).
+ [b]Note:[/b] As this method walks upwards in the scene tree, it can be slow in large, deeply nested scene trees. Whenever possible, consider using [method get_node] with unique names instead (see [member unique_name_in_owner]), or caching the node references into variable.
</description>
</method>
<method name="get_child" qualifiers="const">
@@ -728,14 +745,11 @@
</method>
</methods>
<members>
- <member name="custom_multiplayer" type="MultiplayerAPI" setter="set_custom_multiplayer" getter="get_custom_multiplayer">
- The override to the default [MultiplayerAPI]. Set to [code]null[/code] to use the default [SceneTree] one.
- </member>
<member name="editor_description" type="String" setter="set_editor_description" getter="get_editor_description" default="&quot;&quot;">
Add a custom description to a node. It will be displayed in a tooltip when hovered in editor's scene tree.
</member>
<member name="multiplayer" type="MultiplayerAPI" setter="" getter="get_multiplayer">
- The [MultiplayerAPI] instance associated with this node. Either the [member custom_multiplayer], or the default SceneTree one (if inside tree).
+ The [MultiplayerAPI] instance associated with this node. See [method SceneTree.get_multiplayer].
</member>
<member name="name" type="StringName" setter="set_name" getter="get_name">
The name of the node. This name is unique among the siblings (other child nodes from the same parent). When set to an existing name, the node will be automatically renamed.
@@ -754,6 +768,10 @@
<member name="scene_file_path" type="String" setter="set_scene_file_path" getter="get_scene_file_path">
If a scene is instantiated from a file, its topmost node contains the absolute file path from which it was loaded in [member scene_file_path] (e.g. [code]res://levels/1.tscn[/code]). Otherwise, [member scene_file_path] is set to an empty string.
</member>
+ <member name="unique_name_in_owner" type="bool" setter="set_unique_name_in_owner" getter="is_unique_name_in_owner" default="false">
+ Sets this node's name as a unique name in its [member owner]. This allows the node to be accessed as [code]%Name[/code] instead of the full path, from any node within that scene.
+ If another node with the same owner already had that name declared as unique, that other node's name will no longer be set as having a unique name.
+ </member>
</members>
<signals>
<signal name="child_entered_tree">
@@ -830,10 +848,13 @@
Notification received when the node is instantiated.
</constant>
<constant name="NOTIFICATION_DRAG_BEGIN" value="21">
- Notification received when a drag begins.
+ Notification received when a drag operation begins. All nodes receive this notification, not only the dragged one.
+ Can be triggered either by dragging a [Control] that provides drag data (see [method Control._get_drag_data]) or using [method Control.force_drag].
+ Use [method Viewport.gui_get_drag_data] to get the dragged data.
</constant>
<constant name="NOTIFICATION_DRAG_END" value="22">
- Notification received when a drag ends.
+ Notification received when a drag operation ends.
+ Use [method Viewport.gui_is_drag_successful] to check if the drag succeeded.
</constant>
<constant name="NOTIFICATION_PATH_RENAMED" value="23">
Notification received when the node's name or one of its parents' name is changed. This notification is [i]not[/i] received when the node is removed from the scene tree to be added to another parent later on.