Fix stuck editor cameras and fix 3D error spam for non-finite transforms #103845
+43
−27
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 #80755 in a better way, fixes #96824, supersedes #102966.
Before #81076, in Godot 4.1 and earlier, Godot allowed INF/NAN in Range. This meant that it was possible to use INF/NAN for node transforms. The problem is that the editor code doesn't have any checks to handle this case. In both 2D and 3D, focusing a node at a non-finite position would break the editor camera. Additionally, in 3D, selecting a node with a non-finite transform would cause lots of errors to print to the console.
After #81076, in Godot 4.2 to 4.4, Godot does not allow INF/NAN in Range. This meant that the user could not type INF/NAN to set a node to a non-finite transform. However, this broke the ability to use INF/NAN values elsewhere, and broke the display of existing INF/NAN values.
More importantly, #81076 did not actually fix the underlying bug, so #80755 is actually not fixed yet. If you set a node to have a non-finite transform through means other than the editor inspector, such as editing a
.tscn
file or using a@tool
script, then the same bug is still present in Godot 4.4-stable: you can break the editor camera and get error spam.In PR #100414 I proposed to allow Range to use INF/NAN again, but this would make the underlying bug #80755 easier to trigger, so I am making this PR which should be merged first.
This PR adds checks to the 2D and 3D editor code to skip non-finite transforms when focusing the editor camera, calculating bounding boxes, and positioning gizmos. This fixes the camera breaking and fixes the error spam in 3D.