-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Limit the editor zoom and freelook speed based on camera settings #39743
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aaronfranke
changed the title
Limit the zoom and freelook speed based on camera settings
Limit the editor zoom and freelook speed based on camera settings
Jun 22, 2020
aaronfranke
force-pushed
the
limit-zoom
branch
from
August 27, 2020 05:59
2859724
to
451f959
Compare
aaronfranke
force-pushed
the
limit-zoom
branch
from
September 23, 2020 07:02
451f959
to
7f70981
Compare
aaronfranke
force-pushed
the
limit-zoom
branch
from
October 20, 2020 04:13
7f70981
to
df0fa6d
Compare
aaronfranke
force-pushed
the
limit-zoom
branch
from
November 4, 2020 09:42
df0fa6d
to
0009520
Compare
aaronfranke
added
the
cherrypick:3.x
Considered for cherry-picking into a future 3.x release
label
Nov 17, 2020
aaronfranke
force-pushed
the
limit-zoom
branch
from
November 17, 2020 10:21
0009520
to
eb083f4
Compare
aaronfranke
force-pushed
the
limit-zoom
branch
from
December 1, 2020 20:49
eb083f4
to
3f2addc
Compare
aaronfranke
force-pushed
the
limit-zoom
branch
from
December 1, 2020 21:46
3f2addc
to
896a297
Compare
Calinou
approved these changes
Dec 2, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, it works as intended.
Thanks! |
Cherry-picked for 3.2.4. |
akien-mga
removed
the
cherrypick:3.x
Considered for cherry-picking into a future 3.x release
label
Dec 2, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Just for fun, I recently decided to zoom out as far as Godot would allow me to. After zooming out such that the indicator says about 4 quadrillion, Godot started using gigabytes of RAM and my Linux computer froze due to running out of memory. So, I set out to add some limits to the zooming to prevent this, but I realized we could do much better than just limiting to a quadrillion or so, we could actually set some sensible and dynamic limits.
This PR sets a limit for zoom and freelook speed based on the camera's near and far clipping planes, while also having some hard-coded limits (10 thousand for single precision, which allows fitting the usable area in the whole screen with some margin, and 1 trillion for double precision, which is slightly smaller than double's usable area).
With this PR, the focused point is guaranteed(*) to be inside of the camera's clipping area, while previously it was super easy to zoom in a way that made the object invisible.
Also, since there is now both a minimum and maximum, the bars now have an accurate top and bottom end. Previously, zooming out would just exponentially get closer to the bottom of the bar.
I requested a review from @Calinou and @Zylann since they have touched this code before.
(* technically it can get out of the clipping area if the near and far planes are extremely close together but that's not normal usage of the editor camera and at that point you'll have a hard time fitting anything into the clipping area anyway)
This fixes #37034, fixes #40014, fixes #43467.
3.2 version: https://github.com/aaronfranke/godot/tree/3.2-limit-zoom