From 3b84a64a364704dea347a5565b5aac931e444647 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 7 Aug 2022 15:32:28 +0200 Subject: [PATCH] Ported: Mark node groups as dirty for every children if parent is moved - YuriSizov https://github.com/godotengine/godot/commit/6d53c60bf75f0070e8d5bd42e9470abb986e008c --- scene/main/node.cpp | 19 ++++++++++++++----- scene/main/node.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 1549804cb..07025038d 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -433,11 +433,8 @@ void Node::move_child(Node *p_child, int p_pos) { for (int i = motion_from; i <= motion_to; i++) { data.children[i]->notification(NOTIFICATION_MOVED_IN_PARENT); } - for (const Map::Element *E = p_child->data.grouped.front(); E; E = E->next()) { - if (E->get().group) { - E->get().group->changed = true; - } - } + + p_child->_propagate_groups_dirty(); data.blocked--; } @@ -548,6 +545,18 @@ void Node::_propagate_pause_owner(Node *p_owner) { } } +void Node::_propagate_groups_dirty() { + for (const Map::Element *E = data.grouped.front(); E; E = E->next()) { + if (E->get().group) { + E->get().group->changed = true; + } + } + + for (int i = 0; i < data.children.size(); i++) { + data.children[i]->_propagate_groups_dirty(); + } +} + void Node::set_network_master(int p_peer_id, bool p_recursive) { data.network_master = p_peer_id; diff --git a/scene/main/node.h b/scene/main/node.h index f79cb3bde..c3cca9e33 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -197,6 +197,7 @@ private: void _propagate_physics_interpolation_reset_requested(); void _print_stray_nodes(); void _propagate_pause_owner(Node *p_owner); + void _propagate_groups_dirty(); Array _get_node_and_resource(const NodePath &p_path); void _duplicate_signals(const Node *p_original, Node *p_copy) const;