-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Animation Player FPS shows rounded integer but still internally stores float converted from Seconds #97548
Comments
Looks possibly related to #92670 Gonna perform a bisect to be certain, but it also appears that it is intentional. It also seems likely this was the PR that produced the issue given this function given that swapping from seconds to FPS just uses the |
I am wondering if a solution would be to allow fractional values, but have the result round to the nearest eighth, or sixteenth when read from the TSCN. This would implicitly fix the issue with loading 60 fps as 59.9999 FPS as it would round up to 60 FPS and negate the precision errors that would arise, and shouldn't be so precise as to allow issues to arise. |
Closes godotengine#97548. Care also taken to not reopen issue godotengine#92273 by ensuring that the value rounds to the nearest sixteenth. Optionally any factor of 2 should work while ensuring that there isn't error accumulation. Further testing to ensure issue godotengine#91729 isn't reopened, but initial testing suggests that the issue will not reopen with this PR.
As I said there, only integers are allowed in the FPS is intended, not a bug. Also, it is not a regression, since there was a problem with #92273 before and the float FPS was not handled correctly Unless the result of 1/FPS is rational and few decimals. If #97569 does not cause error problems after serialization, then it is fine and this issue can be fixed, but if not, then it needs some other approach, like serializing the FPS directly, not convert to second.
Wouldn't this result in a different FPS value being serialized than the last set and the snap being shifted the next time the editor is opened? If rounding is performed when loading tscn, the same rounding must be performed when setting the fractional FPS in the editor. In other words, we cannot allow high precision float FPS anywhere on the editor if rounding is performed when loading tscn. The bug here is that (if I am correct in my understanding of description), after switching from Second to FPS, the FPS is internally set to a fractional FPS, so snapping at the time of switching would be the correct fixing way. Currently, the value that should be snapped is 1.0, and float FPS should not be allowed. Given the precision issues in the time <-> FPS conversion, a snapping value of about 0.1 or 0.01 might be allowed theoretically. However, float FPS is not allowed in other places such as the Project settings. I understand that the editor can be manipulated independently of the drawing, but I doubt that float FPS snapping is really needed there. |
To clarify the train of thought here; instead of allowing any and all fractional values for the FPS, instead you clamp the entered value to a value rounded to the nearest 16th. So typing in 15.0541 would clamp it to 15.0625 which is 15 and 1/16. Typing in 12.46 would round to 12.4375 or 12 and 7/16. These values would then be used to save to the tscn. As to what I believe this report was reporting; it seems to be reporting 2 different "bugs"; the first being the change in behavior which your PR closed as noted above which isn't a bug but a change in intended behavior. The second half and actual bug is that changing between FPS and Seconds doesn't actually change the FPS value, just how it is displayed, as you mentioned. |
Closes godotengine#97548. Care also taken to not reopen issue godotengine#92273 by ensuring that the value rounds to the nearest sixteenth. Optionally any factor of 2 should work while ensuring that there isn't error accumulation. Further testing to ensure issue godotengine#91729 isn't reopened, but initial testing suggests that the issue will not reopen with this PR.
Closes godotengine#97548. Care also taken to not reopen issue godotengine#92273 by ensuring that the value rounds to the nearest sixteenth. Optionally any factor of 2 should work while ensuring that there isn't error accumulation. Further testing to ensure issue godotengine#91729 isn't reopened, but initial testing suggests that the issue will not reopen with this PR.
Closes godotengine#97548. Care also taken to not reopen issue godotengine#92273 by ensuring that the value rounds to the nearest sixteenth. Optionally any factor of 2 should work while ensuring that there isn't error accumulation. Further testing to ensure issue godotengine#91729 isn't reopened, but initial testing suggests that the issue will not reopen with this PR.
Tested versions
System information
Godot v4.3.stable - Ubuntu 22.04.4 LTS 22.04 - X11 - GLES3 (Compatibility) - NVIDIA GeForce GTX 860M (nvidia; 535.183.01) - Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz (8 Threads)
Issue description
Context
I am working with fractional FPS for animations, since I set frame time in ms (in Aseprite) then calculate the corresponding FPS for an Animated Sprite (1000/frame duration in ms), then use a converter (Animated Sprite to Animation Player Convertor for Godot 4.0) from Animated Sprite to Animation Player animation. This leads to FPS such as 12.5 FPS for 80ms frames.
So far in Godot v4.2.1 I could enter either 12.5 FPS or 80ms at the bottom of the Animation Player to get the snapping I wanted:
Issue
Since Godot 4.3, the FPS field only allows entering an integer. Entering a float will round it and display the rounded integer. This leads to imperfect FPS such as 13 instead of 12.5, leading to snapping between frames (observe the vertical blue bar not being snapped to the start of a sprite square preview):
I need to switch back to Seconds, then enter 0.08 and then switch back to FPS to get 12.5 FPS internally:
However, note that the rounded value 13 FPS is still displayed:
although snapping shows we are really still at 12.5 FPS / 80ms:
This is confusing, and furthermore, trying to re-enter 13 FPS manually will not change the value to 13. However, entering a different value like 14, then the old value 13 again will force refresh to 13 instead of 12.5.
Fix suggestion
Revert to showing fractional FPS as before, since they are still stored internally as such as indirectly accessibly via setting Seconds, but this requires an extra step for the user.
Currently there is not even an up/down arrow widget to increase/decrease FPS by 1, so there is no big advantage in showing integers anyway (and we could still add an up/down arrow for people who really want to use integers if we want to).
Steps to reproduce
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: