SoftBody3D: Fix infinite delivery of transform notifications #107830
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR #105901 changed the behavior of how transform notifications are delivered to
VisualInstance3Dsubclasses, 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 becauseVisualInstance3Dhad called_set_notify_transform_when_fti_off(true).This updates the
SoftBody3Dconstructor to explicitly enable transform notifications, and to call_set_notify_transform_when_fti_off(false)so that it can still useset_notify_transform(false)to prevent receiving notifications about its own changes.Additionally, I also changed the
NOTIFICATION_TRANSFORM_CHANGEDprocessing 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.