From 8c6198a58f1eee067983490f91d7c92055de9dc5 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Tue, 24 Jun 2025 20:16:52 +0100 Subject: [PATCH] Revert "FTI - Reduce `VisualInstance` xform notifications" This reverts commit 5ec4fd38fa94dd4b01c222de4829a932edca30d1. --- scene/3d/camera.cpp | 1 - scene/3d/spatial.cpp | 15 +-------------- scene/3d/spatial.h | 6 ------ scene/3d/visual_instance.cpp | 8 +++----- 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index c11ee5bd774c..70b564d3a0f3 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -168,7 +168,6 @@ void Camera::_update_camera() { void Camera::_physics_interpolated_changed() { _update_process_mode(); - Spatial::_physics_interpolated_changed(); } void Camera::set_desired_process_modes(bool p_process_internal, bool p_physics_process_internal) { diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 7ec10dd23f65..803948bb001e 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -1076,18 +1076,8 @@ Vector3 Spatial::to_global(Vector3 p_local) const { return get_global_transform().xform(p_local); } -void Spatial::_physics_interpolated_changed() { - data.notify_transform = data.notify_transform_requested || (data.notify_transform_when_fti_off && !is_physics_interpolated_and_enabled()); -} - -void Spatial::_set_notify_transform_when_fti_off(bool p_enable) { - data.notify_transform_when_fti_off = p_enable; - data.notify_transform = data.notify_transform_requested || (data.notify_transform_when_fti_off && !is_physics_interpolated_and_enabled()); -} - void Spatial::set_notify_transform(bool p_enable) { - data.notify_transform_requested = p_enable; - data.notify_transform = data.notify_transform_requested || (data.notify_transform_when_fti_off && !is_physics_interpolated_and_enabled()); + data.notify_transform = p_enable; } bool Spatial::is_transform_notification_enabled() const { @@ -1289,9 +1279,6 @@ Spatial::Spatial() : #endif data.notify_local_transform = false; data.notify_transform = false; - data.notify_transform_requested = false; - data.notify_transform_when_fti_off = false; - data.parent = nullptr; } diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h index 6d4b609859ab..240cf9ce0333 100644 --- a/scene/3d/spatial.h +++ b/scene/3d/spatial.h @@ -117,9 +117,6 @@ class Spatial : public Node { bool notify_local_transform : 1; bool notify_transform : 1; - bool notify_transform_requested : 1; - bool notify_transform_when_fti_off : 1; - bool visible : 1; bool visible_in_tree : 1; bool disable_scale : 1; @@ -179,9 +176,6 @@ class Spatial : public Node { // (e.g. changing Camera zoom even if position hasn't changed). void fti_notify_node_changed(bool p_transform_changed = true); - void _set_notify_transform_when_fti_off(bool p_enable); - virtual void _physics_interpolated_changed(); - // Opportunity after FTI to update the servers // with global_transform_interpolated, // and any custom interpolated data in derived classes. diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 6c7427f83e82..1c1db6b76b36 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -102,10 +102,8 @@ void VisualInstance::_notification(int p_what) { } break; case NOTIFICATION_TRANSFORM_CHANGED: { - // NOTIFICATION normally turned off for physics interpolated cases (via - // `notify_transform_when_fti_off`), however derived classes can still turn this back on, - // so always wrap with is_physics_interpolation_enabled(). - if (is_visible_in_tree() && !(is_inside_tree() && get_tree()->is_physics_interpolation_enabled()) && !_is_using_identity_transform()) { + // ToDo : Can we turn off notify transform for physics interpolated cases? + if (is_visible_in_tree() && !SceneTree::is_fti_enabled() && !_is_using_identity_transform()) { // Physics interpolation global off, always send. VisualServer::get_singleton()->instance_set_transform(instance, get_global_transform()); } @@ -209,7 +207,7 @@ VisualInstance::VisualInstance() { layers = 1; sorting_offset = 0.0f; sorting_use_aabb_center = true; - _set_notify_transform_when_fti_off(true); + set_notify_transform(true); } VisualInstance::~VisualInstance() {