diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-08-31 12:52:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-31 12:52:36 +0200 |
commit | ccf3c2d0e10b448bde938f471ed19cc2f33d281a (patch) | |
tree | 450628e2ab31af20a7e9b06315a70a0c1681a5fd | |
parent | 5e4ccc56d8595fb4d9a80141a632938084940195 (diff) | |
parent | ab2f41f5985bf4a877d8bee0fa22bc8e53f3397d (diff) |
Merge pull request #41077 from Calinou/doc-find-node-find-parent
Mention performance caveats about `find_node()` and `find_parent()`
-rw-r--r-- | doc/classes/Node.xml | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 8f66c9df38..d31e336ea3 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -194,6 +194,7 @@ Finds a descendant of this 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. 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. + [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] instead. To avoid using [method find_node] too often, consider caching the node reference into a variable. </description> </method> <method name="find_parent" qualifiers="const"> @@ -204,6 +205,7 @@ <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. </description> </method> <method name="get_child" qualifiers="const"> |