diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-06-27 12:02:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 12:02:19 +0200 |
commit | 11f5d2141a9ffd3a0a98c59d2d24682d9e3f4c8f (patch) | |
tree | e1319894d3db17e2a80318f73283cd7605fc9911 /scene/main/node.cpp | |
parent | fbc37774675f7bf6daabf667eaf2124e9d662f9d (diff) | |
parent | 8e5ad7be46c21361d435d4d76e7ac09b7ee1e94e (diff) |
Merge pull request #61577 from YuriSizov/core-fix-events-for-moved-nodes
Diffstat (limited to 'scene/main/node.cpp')
-rw-r--r-- | scene/main/node.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index a30eb036db..545ff68b72 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -384,11 +384,7 @@ void Node::_move_child(Node *p_child, int p_pos, bool p_ignore_end) { for (int i = motion_from; i <= motion_to; i++) { data.children[i]->notification(NOTIFICATION_MOVED_IN_PARENT); } - for (const KeyValue<StringName, GroupData> &E : p_child->data.grouped) { - if (E.value.group) { - E.value.group->changed = true; - } - } + p_child->_propagate_groups_dirty(); data.blocked--; } @@ -408,6 +404,18 @@ void Node::raise() { } } +void Node::_propagate_groups_dirty() { + for (const KeyValue<StringName, GroupData> &E : data.grouped) { + if (E.value.group) { + E.value.group->changed = true; + } + } + + for (int i = 0; i < data.children.size(); i++) { + data.children[i]->_propagate_groups_dirty(); + } +} + void Node::add_child_notify(Node *p_child) { // to be used when not wanted } |