Skip to content

Conversation

@simpkins
Copy link
Contributor

PR #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 #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 #107829.

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.
@simpkins simpkins requested review from a team as code owners June 22, 2025 00:20
@akien-mga akien-mga added this to the 4.5 milestone Jun 22, 2025
@akien-mga akien-mga changed the title SoftBody3D: fix infinite delivery of transform notifications SoftBody3D: Fix infinite delivery of transform notifications Jun 22, 2025
@akien-mga akien-mga requested a review from lawnjelly June 22, 2025 07:50
@lawnjelly
Copy link
Member

This is a pretty good fix, but decided on balance it's better to just revert #105901 for now, and I'll have a better think how we can reduce these in VisualInstances without affecting other derived nodes.

@simpkins
Copy link
Contributor Author

Abandoning in favor of #107854.

@simpkins simpkins closed this Jun 23, 2025
@akien-mga akien-mga removed this from the 4.5 milestone Jun 23, 2025
@simpkins simpkins deleted the soft_body_fix branch June 26, 2025 02:58
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.

SoftBody3D broken in 4.5-beta1

3 participants