summaryrefslogtreecommitdiffstats
path: root/scene/main/node.cpp
diff options
context:
space:
mode:
authorClay John <claynjohn@gmail.com>2023-04-06 14:43:35 -0700
committerGitHub <noreply@github.com>2023-04-06 14:43:35 -0700
commit132000f58d545cbf537cb751cb787d48c0b2085b (patch)
tree59fae1c03c5dfd6867e891503ff1d22652ea5ad5 /scene/main/node.cpp
parent92b7a9603aa2395be6bf361067096538ba393c45 (diff)
parent404f24b5c417909bb30a2b8d06d17dab19bd450c (diff)
downloadredot-engine-132000f58d545cbf537cb751cb787d48c0b2085b.tar.gz
Merge pull request #75767 from spanzeri/missing-node-index-update-on-deletion
Update sibling indices after a node is removed.
Diffstat (limited to 'scene/main/node.cpp')
-rw-r--r--scene/main/node.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index d8375dbc9f..352c8eb77f 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -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"));