Browse Source

Merge pull request #107949 from lawnjelly/revert_reduce_xform_changed

[3.x] Revert "FTI - Reduce `VisualInstance` xform notifications"
lawnjelly 1 month ago
parent
commit
1a7d99e37d
4 changed files with 4 additions and 26 deletions
  1. 0 1
      scene/3d/camera.cpp
  2. 1 14
      scene/3d/spatial.cpp
  3. 0 6
      scene/3d/spatial.h
  4. 3 5
      scene/3d/visual_instance.cpp

+ 0 - 1
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) {

+ 1 - 14
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;
 }
 

+ 0 - 6
scene/3d/spatial.h

@@ -117,9 +117,6 @@ private:
 		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 @@ protected:
 	// (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.

+ 3 - 5
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() {