Mark node groups as dirty for every children if parent is moved

This commit is contained in:
Yuri Sizov 2022-05-31 21:28:04 +03:00
parent d8b0a8cd29
commit 8e5ad7be46
2 changed files with 14 additions and 5 deletions

View File

@ -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
}

View File

@ -174,6 +174,7 @@ private:
void _propagate_after_exit_tree();
void _print_orphan_nodes();
void _propagate_process_owner(Node *p_owner, int p_pause_notification, int p_enabled_notification);
void _propagate_groups_dirty();
Array _get_node_and_resource(const NodePath &p_path);
void _duplicate_signals(const Node *p_original, Node *p_copy) const;