diff options
author | kobewi <kobewi4e@gmail.com> | 2022-04-29 16:14:48 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-04-29 16:14:48 +0200 |
commit | 8187a777cea6715b8dddb160de2fa8aedc808817 (patch) | |
tree | f75670614e1fd4af052635cec90776093a8e892f | |
parent | a817bd96c02c79e504a4b8666e6f869862ba34ed (diff) |
Small improvements to get_first_node_in_group()
-rw-r--r-- | doc/classes/SceneTree.xml | 1 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index ddff766b17..970f5125cd 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -91,6 +91,7 @@ <return type="Node" /> <argument index="0" name="group" type="StringName" /> <description> + Returns the first node in the specified group, or [code]null[/code] if the group is empty or does not exist. </description> </method> <method name="get_frame" qualifiers="const"> diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 82f18d1a42..a151d3cb33 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -981,12 +981,12 @@ bool SceneTree::has_group(const StringName &p_identifier) const { Node *SceneTree::get_first_node_in_group(const StringName &p_group) { Map<StringName, Group>::Element *E = group_map.find(p_group); if (!E) { - return nullptr; //no group + return nullptr; // No group. } - _update_group_order(E->get()); //update order just in case + _update_group_order(E->get()); // Update order just in case. - if (E->get().nodes.size() == 0) { + if (E->get().nodes.is_empty()) { return nullptr; } |