Skip to content

Commit

Permalink
Merge pull request #75767 from spanzeri/missing-node-index-update-on-…
Browse files Browse the repository at this point in the history
…deletion

Update sibling indices after a node is removed.
  • Loading branch information
clayjohn authored Apr 6, 2023
2 parents 92b7a96 + 404f24b commit 132000f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scene/main/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,10 @@ void Node::remove_child(Node *p_child) {
child_count = data.children.size();
children = data.children.ptrw();

for (int i = idx; i < child_count; i++) {
children[i]->data.index = i;
}

notification(NOTIFICATION_CHILD_ORDER_CHANGED);
emit_signal(SNAME("child_order_changed"));

Expand Down

0 comments on commit 132000f

Please sign in to comment.