FTI - Add reset on setting top_level

This commit is contained in:
lawnjelly
2025-06-29 16:55:15 +01:00
parent e1b4101e34
commit 2d3dedb12d
3 changed files with 4 additions and 1 deletions

View File

@ -1028,6 +1028,7 @@ void Node3D::set_as_top_level(bool p_enabled) {
} }
} }
data.top_level = p_enabled; data.top_level = p_enabled;
reset_physics_interpolation();
} }
void Node3D::set_as_top_level_keep_local(bool p_enabled) { void Node3D::set_as_top_level_keep_local(bool p_enabled) {
@ -1037,6 +1038,7 @@ void Node3D::set_as_top_level_keep_local(bool p_enabled) {
} }
data.top_level = p_enabled; data.top_level = p_enabled;
_propagate_transform_changed(this); _propagate_transform_changed(this);
reset_physics_interpolation();
} }
bool Node3D::is_set_as_top_level() const { bool Node3D::is_set_as_top_level() const {

View File

@ -519,6 +519,7 @@ void CanvasItem::set_as_top_level(bool p_top_level) {
if (get_viewport()) { if (get_viewport()) {
get_viewport()->canvas_item_top_level_changed(); get_viewport()->canvas_item_top_level_changed();
} }
reset_physics_interpolation();
} }
void CanvasItem::_top_level_changed() { void CanvasItem::_top_level_changed() {

View File

@ -952,7 +952,7 @@ void Node::set_physics_interpolation_mode(PhysicsInterpolationMode p_mode) {
} }
void Node::reset_physics_interpolation() { void Node::reset_physics_interpolation() {
if (is_inside_tree()) { if (SceneTree::is_fti_enabled() && is_inside_tree()) {
propagate_notification(NOTIFICATION_RESET_PHYSICS_INTERPOLATION); propagate_notification(NOTIFICATION_RESET_PHYSICS_INTERPOLATION);
// If `reset_physics_interpolation()` is called explicitly by the user // If `reset_physics_interpolation()` is called explicitly by the user