Skip to content

Commit

Permalink
Merge pull request #88785 from KoBeWi/list_cringe
Browse files Browse the repository at this point in the history
Fix inefficient list iteration in Node
  • Loading branch information
akien-mga committed Feb 25, 2024
2 parents ec901ae + 75ba837 commit 81f3d43
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scene/main/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2963,12 +2963,12 @@ void Node::replace_by(Node *p_node, bool p_keep_groups) {
}

p_node->set_owner(owner);
for (int i = 0; i < owned.size(); i++) {
owned[i]->set_owner(p_node);
for (Node *E : owned) {
E->set_owner(p_node);
}

for (int i = 0; i < owned_by_owner.size(); i++) {
owned_by_owner[i]->set_owner(owner);
for (Node *E : owned_by_owner) {
E->set_owner(owner);
}

p_node->set_scene_file_path(get_scene_file_path());
Expand Down

0 comments on commit 81f3d43

Please sign in to comment.