diff options
Diffstat (limited to 'doc/classes/Node.xml')
-rw-r--r-- | doc/classes/Node.xml | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 87edc7de0a..24df5977f9 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -39,7 +39,7 @@ <method name="_get_configuration_warnings" qualifiers="virtual const"> <return type="PackedStringArray" /> <description> - The elements in the array returned from this method are displayed as warnings in the Scene Dock if the script that overrides it is a [code]tool[/code] script. + The elements in the array returned from this method are displayed as warnings in the Scene dock if the script that overrides it is a [code]tool[/code] script. Returning an empty array produces no warnings. Call [method update_configuration_warnings] when the warnings need to be updated for this node. </description> @@ -110,22 +110,23 @@ <return type="void" /> <param index="0" name="event" type="InputEvent" /> <description> - Called when an [InputEventKey] or [InputEventShortcut] hasn't been consumed by [method _input] or any GUI [Control] item. The input event propagates up through the node tree until a node consumes it. + Called when an [InputEventKey] hasn't been consumed by [method _input] or any GUI [Control] item. The input event propagates up through the node tree until a node consumes it. It is only called if unhandled key input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_key_input]. To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called. This method can be used to handle Unicode character input with [kbd]Alt[/kbd], [kbd]Alt + Ctrl[/kbd], and [kbd]Alt + Shift[/kbd] modifiers, after shortcuts were handled. For gameplay input, this and [method _unhandled_input] are usually a better fit than [method _input] as they allow the GUI to intercept the events first. + This method also performs better than [method _unhandled_input], since unrelated events such as [InputEventMouseMotion] are automatically filtered. [b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not an orphan). </description> </method> <method name="add_child"> <return type="void" /> <param index="0" name="node" type="Node" /> - <param index="1" name="legible_unique_name" type="bool" default="false" /> + <param index="1" name="force_readable_name" type="bool" default="false" /> <param index="2" name="internal" type="int" enum="Node.InternalMode" default="0" /> <description> - Adds a child node. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node. - If [param legible_unique_name] is [code]true[/code], the child node will have a human-readable name based on the name of the node being instantiated instead of its type. + Adds a child [param node]. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node. + If [param force_readable_name] is [code]true[/code], improves the readability of the added [param node]. If not named, the [param node] is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to [code]false[/code], which assigns a dummy name featuring [code]@[/code] in both situations. If [param internal] is different than [constant INTERNAL_MODE_DISABLED], the child will be added as internal node. Such nodes are ignored by methods like [method get_children], unless their parameter [code]include_internal[/code] is [code]true[/code].The intended usage is to hide the internal nodes from the user, so the user won't accidentally delete or modify them. Used by some GUI nodes, e.g. [ColorPicker]. See [enum InternalMode] for available modes. [b]Note:[/b] If the child node already has a parent, the function will fail. Use [method remove_child] first to remove the node from its current parent. For example: [codeblocks] @@ -145,16 +146,16 @@ [/csharp] [/codeblocks] If you need the child node to be added below a specific node in the list of children, use [method add_sibling] instead of this method. - [b]Note:[/b] If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=$DOCS_URL/tutorials/misc/running_code_in_the_editor.html]tool scripts[/url] and [url=$DOCS_URL/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view. + [b]Note:[/b] If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=$DOCS_URL/tutorials/plugins/running_code_in_the_editor.html]tool scripts[/url] and [url=$DOCS_URL/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view. </description> </method> <method name="add_sibling"> <return type="void" /> <param index="0" name="sibling" type="Node" /> - <param index="1" name="legible_unique_name" type="bool" default="false" /> + <param index="1" name="force_readable_name" type="bool" default="false" /> <description> Adds a [param sibling] node to current's node parent, at the same level as that node, right below it. - If [param legible_unique_name] is [code]true[/code], the child node will have a human-readable name based on the name of the node being instantiated instead of its type. + If [param force_readable_name] is [code]true[/code], improves the readability of the added [param sibling]. If not named, the [param sibling] is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to [code]false[/code], which assigns a dummy name featuring [code]@[/code] in both situations. Use [method add_child] instead of this method if you don't need the child node to be added below a specific node in the list of children. [b]Note:[/b] If this node is internal, the new sibling will be internal too (see [code]internal[/code] parameter in [method add_child]). </description> @@ -179,9 +180,14 @@ <return type="Tween" /> <description> Creates a new [Tween] and binds it to this node. This is equivalent of doing: - [codeblock] + [codeblocks] + [gdscript] get_tree().create_tween().bind_node(self) - [/codeblock] + [/gdscript] + [csharp] + GetTree().CreateTween().BindNode(this); + [/csharp] + [/codeblocks] </description> </method> <method name="duplicate" qualifiers="const"> @@ -267,13 +273,24 @@ Returns an array listing the groups that the node is a member of. [b]Note:[/b] For performance reasons, the order of node groups is [i]not[/i] guaranteed. The order of node groups should not be relied upon as it can vary across project runs. [b]Note:[/b] The engine uses some group names internally (all starting with an underscore). To avoid conflicts with internal groups, do not add custom groups whose name starts with an underscore. To exclude internal groups while looping over [method get_groups], use the following snippet: - [codeblock] + [codeblocks] + [gdscript] # Stores the node's non-internal groups only (as an array of Strings). var non_internal_groups = [] for group in get_groups(): if not group.begins_with("_"): non_internal_groups.push_back(group) - [/codeblock] + [/gdscript] + [csharp] + // Stores the node's non-internal groups only (as a List of strings). + List<string> nonInternalGroups = new List<string>(); + foreach (string group in GetGroups()) + { + if (!group.BeginsWith("_")) + nonInternalGroups.Add(group); + } + [/csharp] + [/codeblocks] </description> </method> <method name="get_index" qualifiers="const"> @@ -367,8 +384,11 @@ <method name="get_path_to" qualifiers="const"> <return type="NodePath" /> <param index="0" name="node" type="Node" /> + <param index="1" name="use_unique_path" type="bool" default="false" /> <description> Returns the relative [NodePath] from this node to the specified [param node]. Both nodes must be in the same scene or the function will fail. + If [param use_unique_path] is [code]true[/code], returns the shortest path considering unique node. + [b]Note:[/b] If you get a relative path which starts from a unique node, the path may be longer than a normal relative path due to the addition of the unique node's name. </description> </method> <method name="get_physics_process_delta_time" qualifiers="const"> @@ -512,13 +532,13 @@ <method name="move_child"> <return type="void" /> <param index="0" name="child_node" type="Node" /> - <param index="1" name="to_position" type="int" /> + <param index="1" name="to_index" type="int" /> <description> - Moves a child node to a different position (order) among the other children. Since calls, signals, etc are performed by tree order, changing the order of children nodes may be useful. + Moves a child node to a different index (order) among the other children. Since calls, signals, etc. are performed by tree order, changing the order of children nodes may be useful. If [param to_index] is negative, the index will be counted from the end. [b]Note:[/b] Internal children can only be moved within their expected "internal range" (see [code]internal[/code] parameter in [method add_child]). </description> </method> - <method name="print_orphan_nodes"> + <method name="print_orphan_nodes" qualifiers="static"> <return type="void" /> <description> Prints all orphan nodes (nodes outside the [SceneTree]). Used for debugging. @@ -543,7 +563,7 @@ <method name="print_tree_pretty"> <return type="void" /> <description> - Similar to [method print_tree], this prints the tree to stdout. This version displays a more graphical representation similar to what is displayed in the scene inspector. It is useful for inspecting larger trees. + Similar to [method print_tree], this prints the tree to stdout. This version displays a more graphical representation similar to what is displayed in the Scene Dock. It is useful for inspecting larger trees. [b]Example output:[/b] [codeblock] ┖╴TheGame @@ -577,18 +597,6 @@ Queues a node for deletion at the end of the current frame. When deleted, all of its child nodes will be deleted as well. This method ensures it's safe to delete the node, contrary to [method Object.free]. Use [method Object.is_queued_for_deletion] to check whether a node will be deleted at the end of the frame. </description> </method> - <method name="raise"> - <return type="void" /> - <description> - Moves this node to the bottom of parent node's children hierarchy. This is often useful in GUIs ([Control] nodes), because their order of drawing depends on their order in the tree. The top Node is drawn first, then any siblings below the top Node in the hierarchy are successively drawn on top of it. After using [code]raise[/code], a Control will be drawn on top of its siblings. - </description> - </method> - <method name="remove_and_skip"> - <return type="void" /> - <description> - Removes a node and sets all its children as children of the parent node (if it exists). All event subscriptions that pass by the removed node will be unsubscribed. - </description> - </method> <method name="remove_child"> <return type="void" /> <param index="0" name="node" type="Node" /> @@ -601,7 +609,7 @@ <return type="void" /> <param index="0" name="group" type="StringName" /> <description> - Removes a node from a group. See notes in the description, and the group methods in [SceneTree]. + Removes a node from the [param group]. Does nothing if the node is not in the [param group]. See notes in the description, and the group methods in [SceneTree]. </description> </method> <method name="replace_by"> @@ -625,7 +633,7 @@ <return type="int" enum="Error" /> <param index="0" name="method" type="StringName" /> <description> - Sends a remote procedure call request for the given [param method] to peers on the network (and locally), optionally sending all additional arguments as arguments to the method called by the RPC. The call request will only be received by nodes with the same [NodePath], including the exact same node name. Behaviour depends on the RPC configuration for the given method, see [method rpc_config]. Methods are not exposed to RPCs by default. Returns [code]null[/code]. + Sends a remote procedure call request for the given [param method] to peers on the network (and locally), optionally sending all additional arguments as arguments to the method called by the RPC. The call request will only be received by nodes with the same [NodePath], including the exact same node name. Behavior depends on the RPC configuration for the given method, see [method rpc_config]. Methods are not exposed to RPCs by default. Returns [code]null[/code]. [b]Note:[/b] You can only safely use RPCs on clients after you received the [code]connected_to_server[/code] signal from the [MultiplayerAPI]. You also need to keep track of the connection state, either by the [MultiplayerAPI] signals like [code]server_disconnected[/code] or by checking [code]get_multiplayer().peer.get_connection_status() == CONNECTION_CONNECTED[/code]. </description> </method> @@ -763,7 +771,7 @@ </member> <member name="owner" type="Node" setter="set_owner" getter="get_owner"> The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using [PackedScene]), all the nodes it owns will be saved with it. This allows for the creation of complex [SceneTree]s, with instancing and subinstancing. - [b]Note:[/b] If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=$DOCS_URL/tutorials/misc/running_code_in_the_editor.html]tool scripts[/url] and [url=$DOCS_URL/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view. + [b]Note:[/b] If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=$DOCS_URL/tutorials/plugins/running_code_in_the_editor.html]tool scripts[/url] and [url=$DOCS_URL/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view. </member> <member name="process_mode" type="int" setter="set_process_mode" getter="get_process_mode" enum="Node.ProcessMode" default="0"> Can be used to pause or unpause the node, or make the node paused based on the [SceneTree], or make it inherit the process mode from its parent (default). @@ -986,7 +994,7 @@ <constant name="DUPLICATE_SCRIPTS" value="4" enum="DuplicateFlags"> Duplicate the node's scripts. </constant> - <constant name="DUPLICATE_USE_INSTANCING" value="8" enum="DuplicateFlags"> + <constant name="DUPLICATE_USE_INSTANTIATION" value="8" enum="DuplicateFlags"> Duplicate using instancing. An instance stays linked to the original so when the original changes, the instance changes too. </constant> |