Remove scene context from errors/warnings in Jolt Physics module #102717
+155
−219
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.
Fixes #102638.
Supersedes #102726.
Warning
This PR is entirely untested as of writing this.
This PR removes any mention of specific scene nodes in the various error/warning messages found in
modules/jolt_physics
, due to calls toObject::to_string
being problematic when usingphysics/3d/run_on_separate_thread
.This PR also changes most of these warnings to be
WARN_PRINT_ONCE
instead, since there's no real context provided anymore, and therefore no point in spamming the warning continuously.I've also gone ahead and removed most of the errors related to invalid scaling (e.g. scaling a cylinder on anything but its height axis) as previously emitted by the
JOLT_ENSURE_SCALE_VALID
macro, as they were already adding some friction for some users, and without context they're likely to cause even more friction, especially when emitted during runtime.Now instead we only do a
WARN_PRINT_ONCE
inside ofJoltShape3D::make_scale_valid
if a significant invalid scale is detected, and only forDEV_ENABLED
builds. This should allow us to catch these kinds of errors when bugs are reported that suffer from this, but they won't bother end users.I've left in the errors for zero-scaled transforms, as emitted by the
JOLT_ENSURE_SCALE_NOT_ZERO
macro, as they will typically cause a lot of problems and thus should be dealt with in some way, which I currently do by just resetting the entireBasis
to identity. That seems to me like a significant enough of an intervention to warrant emitting an error, even without any context.