Skip to content

FTI - Reduce VisualInstance3D xform notifications (reverted) #105901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

lawnjelly
Copy link
Member

VisualInstance3D transforms are already not sent to the RenderingServer when physics interpolation is active, so there is actually no need for them to have NOTIFICATION_TRANSFORM_CHANGED called.
This PR manages the notify_transform state while respecting calls to set_notify_transform() in derived classes.

Forward port of #105681

Notes

  • Small optimization from [3.x] FTI - Fix 3D auto-resets #105463 I left for a separate PR because of the risk of regressions. So far it seems fine in testing.
  • Has to manage a separate request to be notified by derived classes, it does this by maintaining two state bools and calculating the actual notify_transform state from these when required.
  • I'm not absolutely sure how much real world performance will be gained here, but needless notifications are always good to remove.

@lawnjelly lawnjelly force-pushed the fti_reduce_xform_notifications4 branch from 1a5cd3f to e10003c Compare May 30, 2025 05:32
@akien-mga akien-mga merged commit 0e9a59b into godotengine:master Jun 12, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@simpkins
Copy link
Contributor

This changed the semantics of set_notify_transform(). SoftBody3D was previously relying on set_notify_transform(false) to prevent it from receiving transform notifications, but now this call no longer actually disables the notifications if notify_transform_when_fti_off is on.

SoftBody3D can be updated to work around this behavior, but I'm not sure if there is also any other code that expects set_notify_transform(false) to disable transform notifications.

simpkins added a commit to simpkins/godot that referenced this pull request Jun 22, 2025
PR godotengine#105901 changed the behavior of how transform notifications are
delivered to `VisualInstance3D` subclasses, which resulted in SoftBody3D
receiving an infinite stream of transform notifications.

SoftBody3D attempts to always keep its global transform at (0, 0, 0),
and does so by listening for transform notifications and resetting it
its transform back to 0 whenever it is changed externally.  It called
`set_notify_transform(false)` before making its own change, so that it
would not receive new notifications about its own change.  However,
after PR godotengine#105901, transform notifications were still delivered anyway
because `VisualInstance3D` had called
`_set_notify_transform_when_fti_off(true)`.

This updates the `SoftBody3D` constructor to explicitly enable transform
notifications, and to call `_set_notify_transform_when_fti_off(false)`
so that it can still use `set_notify_transform(false)` to prevent
receiving notifications about its own changes.

Additionally, I also changed the NOTIFICATION_TRANSFORM_CHANGED
processing to ignore the notification if the global transform is already
0.  This should also be sufficient to stop the infinite notification
change even if somehow it does receive a notification about its own
change.

This fixes godotengine#107829.
@akien-mga akien-mga changed the title FTI - Reduce VisualInstance3D xform notifications FTI - Reduce VisualInstance3D xform notifications (reverted) Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants