Merge pull request #75767 from spanzeri/missing-node-index-update-on-deletion

Update sibling indices after a node is removed.
This commit is contained in:
Clay John 2023-04-06 14:43:35 -07:00 committed by GitHub
commit 132000f58d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1215,6 +1215,10 @@ void Node::remove_child(Node *p_child) {
child_count = data.children.size(); child_count = data.children.size();
children = data.children.ptrw(); children = data.children.ptrw();
for (int i = idx; i < child_count; i++) {
children[i]->data.index = i;
}
notification(NOTIFICATION_CHILD_ORDER_CHANGED); notification(NOTIFICATION_CHILD_ORDER_CHANGED);
emit_signal(SNAME("child_order_changed")); emit_signal(SNAME("child_order_changed"));