Merge pull request #61578 from YuriSizov/core-fix-events-for-moved-nodes-3.x

This commit is contained in:
Rémi Verschelde 2022-08-05 19:33:25 +02:00 committed by GitHub
commit 25c87e99cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -429,11 +429,7 @@ 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<StringName, GroupData>::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--;
}
@ -446,6 +442,18 @@ void Node::raise() {
data.parent->move_child(this, data.parent->data.children.size() - 1);
}
void Node::_propagate_groups_dirty() {
for (const Map<StringName, GroupData>::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::add_child_notify(Node *p_child) {
// to be used when not wanted
}

View File

@ -207,6 +207,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;