godotengine / godotengine/godot
Animation Player FPS shows rounded integer but still internally stores float converted from Seconds
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in: v4.3.stable.official [77dcf97d8]
- Not reproducible in: v4.2.1.stable.official [b09f793f5]
### 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](https://godotengine.org/asset-library/asset/1605)) 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
- Create an Animation Player node with a dummy animation track (the easiest to test timeline snapping is to manually increase the animation duration near the clock icon at the top-right)
- In the Animation Player panel, try to change FPS to a fractional value like 12.5 => rounded to 13
- Move the timeline vertical bar around to test snapping. Add some keyframes there to remember the positions.
- Switch to Seconds, enter 0.08, switch back to FPS => see 13 but internally it's 12.5
- Move the timeline vertical bar around to test snapping. See how it ends at different positions that the previous keyframes.
- Enter 14 FPS, confirm, then 13 again, confirm (to force value refresh).
- Move the timeline vertical bar around to test snapping. See how it's now snapping to the previous keyframes.
### Minimal reproduction project (MRP)
N/A
Contributor guide
Research direction
Start in the Animation Player panel by reproducing the FPS and Seconds switching sequence described in the issue. Inspect the entry point that handles the FPS display and timeline snapping, then verify fractional FPS values remain accurately displayed and that manually re-entering the shown value produces consistent snapping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100