1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-03 16:55:53 +00:00

Optimize scene tree groups

This commit is contained in:
dementive
2025-07-10 22:09:56 -05:00
parent c6d130abd9
commit 56fa8caef4
8 changed files with 35 additions and 43 deletions

View File

@@ -1565,22 +1565,20 @@ Node *SceneTree::get_first_node_in_group(const StringName &p_group) {
return E->value.nodes[0];
}
void SceneTree::get_nodes_in_group(const StringName &p_group, List<Node *> *p_list) {
Vector<Node *> SceneTree::get_nodes_in_group(const StringName &p_group) {
_THREAD_SAFE_METHOD_
HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (!E) {
return;
return {};
}
_update_group_order(E->value); //update order just in case
int nc = E->value.nodes.size();
if (nc == 0) {
return;
}
Node **ptr = E->value.nodes.ptrw();
for (int i = 0; i < nc; i++) {
p_list->push_back(ptr[i]);
return {};
}
return E->value.nodes;
}
void SceneTree::_flush_delete_queue() {