godot
godot copied to clipboard
Animation editor always operates in seconds even if the interface and tooltips say it's operating in frames per second
Godot version
v4.2.stable.mono.official [46dc27791]
System information
Windows 11, Intel Core i5 10300H, nVidia GTX 1650
Issue description
When editing animations, if you set snap mode to frames and set a value of 1 (snap at 1 frame resolution), the timeline updates to show frames and the animation duration tooltip will say the duration is in frames, but if you create an animation from 1 to 10 in the timeline, the animation will actually take 10 seconds to finish instead of 10 frames as indicated by the tooltip.
Steps to reproduce
- Create new project
- Drag default icon to 2D scene
- Create new AnimationPlayer node
- Create new animation in Animation bottom tab.
- Set Snap mode to FPS
- Set to snap to 1 frame
- Set animation duration to 10 (it should be 10 frames, as indicated by the tooltip on the clock icon)
- Make the default icon move positions, with one keyframe at frame 0 and another at keyframe 10.
- According to the tooltip, this animation should last 10 frames, but playing the animation reveals it lasts 10 seconds
Minimal reproduction project
Project with animation already created. Don't know if animation editor settings are saved, so to test, please change snap mode to FPS.
From my understanding, this isn't a bug. Maybe the ui is a little misleading, but it's working as intended as far as I know. As much as I want there to be a tick based mode for animation, it's always based on time. The FPS mode is just for conveniently snapping to certain times based on a consistent FPS so that you don't have to remember and type "0.0417" into the snapping if your animations are at 24 FPS for example. It's also just nicer to look at if you have consistent frame timings. At the bottom, setting the snapping setting to 1 doesn't "snap at 1 frame resolution", it sets the time snapping to use 1 frame per second. You are setting the FPS, not the number of frames between frames to snap to. An animation with 10 frames at 1 FPS will take 10 seconds, so it makes sense that your animation took that long. The Animation Length (Frames) is talking about the number of frames of animation based on the given FPS. Animation frames, not game ticks.
Maybe the ui is a little misleading
It's definitely misleading
@rektuiemforameme I consider it at least an UI bug. If you look at the screenshot, everything in there will lead you to believe "one unit" of animation will correspond to one frame. Even the tooltip will change to "frames".
If it is always in time and not frames, why change the tooltip?
If the feature is working as intended, I would expect at least the UI to correctly inform me how it's supposed to work.
The mode that you selected is called "FPS", or Frames Per Second. It's not called Frames, nor is it called Ticks. Frames Per Second. It has seconds (a unit of time) in the name. Additionally, the Animation Position in the top left of the UI is still in seconds, which its tooltip specifies. So I would argue that everything in the UI would lead you to believe that "one unit" of animation (Usually referred to as a "frame") will correspond to the duration specified by the FPS that you set.
The tooltip changes to frames because it would be annoying having to set a 60 FPS animation with 17 frames to 0.2833333333 seconds. Using frames is much more convenient as long as you have a set FPS for the animation, which is the whole point of this snapping mode.
When I set the duration of an animation in Blender, I set it in frames. If I set Blender's FPS to 1, I don't expect blender to be running a frame every time it can. Animation frames are separate from game ticks: they run at the FPS that you set them to run at.
The UI is correctly informing you of how it's supposed to work, you just didn't realize that the input field to the left of FPS was for setting the FPS. If there are any tooltip changes, that would be the only one that would make any sense.
@rektuiemforameme I ask you to actually do the reproduction steps I mentioned. Pay special attention to the steps "Set Snap mode to FPS" and "Set to snap to 1 frame". These are important, as the bug won't happen if you let the Snap option at the default.
If you take the exact steps I mentioned and then play the animation back, it will take 10 seconds for the animation to play. Not 10 frames, 10 seconds.
Then, if you hold the cursor on the small clock icon, it will say "Animation length (frames)" and the value you've just typed there will say 10. How can the setting for animation length say 10 frames but the actual animation take 10 seconds to complete?
Other strange behavior happens if you mess with this further. I've created the animation and set it to 1 second. I then changed Snap to 20 FPS and my Animation length setting automatically changed to 20 (technically 20 frames), but the actual length didn't change, it was still 1 second. I don't know what 20 refers to, does it mean that my animation is at 20 frames per second? That's not what Animation length is, it is an indication of total length, not length of one second in frames.
None of this confusion happens if I set Snap to seconds instead of frames, because then the tooltip will say "Animation length (seconds)" and it will respect whatever I set there.
Here's a video of me doing some quick experimentation. At this point I'm confused about what I'm doing wrong, because that's not intuitive to me at all.
https://github.com/godotengine/godot/assets/1204296/b99469c5-0f4a-4bbc-8fac-a8bb23832ba9
@Dancovich I have done the reproduction steps mentioned. The results you see are exactly what I would expect. The animation takes 10 seconds because you set the Frames Per Second of the animation to 1 and the duration to 10 frames. An animation with ten frames playing at a speed of 1 Frame Per Second should take 10 seconds.
The behavior that you see when changing the FPS in the snapping area also makes sense. It maintains the same length in seconds and keyframe positions and then adjusts everything else. An animation with a time duration of 1 second running at a speed of 20 FPS will have a frame duration of 20. If you change it to 60 FPS in the snapping area, the duration will be 60 frames, but the time duration will still be 1 second since you are running 60 frames at a speed of 60 FPS which will take 1 second.
The animation takes 10 seconds because you set the Frames Per Second of the animation to 1
@rektuiemforameme Where did I set that? You saw in the video, I only changed the Snap option to snap every one frame. Are you telling me that Snap menu is actually setting the FPS of the animation? I only set what you saw in the video.
The way I understood that section of the UI is that you can turn snap on or off and that you can set it to snap every X units of time. You can select if that unit of time is seconds or frames per second and then you type the actual value to set the snap frequency.
If that section is also doubling as a section to set the actual frame rate of the animation, that is very confusing. That means I can't have an animation that runs at 60fps but snaps every 2 frames, because the moment I select FPS 2 and turn on snap, it will snap every two frames but also run at 2FPS.
Where did I set that? You saw in the video, I only changed the Snap option to snap every one frame. Are you telling me that Snap menu is actually setting the FPS of the animation? I only set what you saw in the video.
@Dancovich You set the FPS in the snapping area. The place that I indicated in the image that I attached in my last reply. Putting 1 there does not make it snap every one frame, it sets the snapping to use 1 FPS.
The way I understood that section of the UI is that you can turn snap on or off and that you can set it to snap every X units of time. You can select if that unit of time is seconds or frames per second and then you type the actual value to set the snap frequency.
Yes, that's what the snapping area does, except that Frames Per Second is not a unit of time. It is a frequency of frames within a unit of time (seconds). Again, it doesn't say frames. It says Frames Per Second. You aren't setting the time or frames between snaps, you're setting the frequency of the snaps itself. If you set the snapping FPS to 60 FPS, it's the same thing as setting the snapping seconds to 1/60, or 0.0166666667. It then changes the UI for animation duration and timeline to use frames for convenience.
If that section is also doubling as a section to set the actual frame rate of the animation, that is very confusing. That means I can't have an animation that runs at 60fps but snaps every 2 frames, because the moment I select FPS 2 and turn on snap, it will snap every two frames but also run at 2FPS.
If you want your animation to snap by a certain number of frames, set the FPS to Total Frames Per Second / Desired Snap. So for 60 FPS and a snap of 2, 60/2 = 30 FPS. Every 3 frames, 20 FPS. 4 = 15, 5 = 12, etc.
@rektuiemforameme First of all, sorry for taking so much of your time. Maybe there is no bug here, but I really feel this tool has an UX issue, so while it might work as intended (it does animate and the math does check out) it is not conveying information in a way an animator (which is not necessarily a developer) might understand.
I think we are focusing in the Snap section of this screen when the actual issue seems to be the tooltip Animation length. I just opened Godot again and started a new project. Please take a look at the exact steps I did and tell me this makes sense.
- Set Snap type to Seconds
- Set Snap value to 0.5
- Set Animation length (seconds) to 2
Here's a screenshot of my screen after this:
At this point, I have a 2 second animation and the editor snaps in increments of half a second. Playing that animation takes 2 seconds to complete as expected. Animation is running at 60fps because that's the FPS the game is running at. So far so good, everything in this screen makes sense to me.
Now, without changing the actual animation in any way, here's what I did:
- Change snap type to FPS
Just that. Nothing else. I opened the snap type combo box and changed it from Seconds to FPS. I did not change any other value, but Godot on the other hand changed several values in the UI in response to this one action of mine.
Here are the changes Godot did in response to me changing snap type from Seconds to FPS.
- The tooltip
Animation length (seconds)
changed toAnimation length (frames)
. - The value of Animation length changed to 4.
- The Snap value changed to 2.
The animation still plays exactly the same. It takes 2 seconds to complete and is running at 60fps because that's what the game is set to run at.
So forget the Snap menu for a second. Why is "Animation length (frames)" saying 4? This tooltip is actually saying length in frames, which should mean the animation will only last 4 frames. I know it would last only 4 frames if running at 2FPS like the snap says, resulting in the same 2 seconds, but why would I ever imagine this to be the case?
It chose the numbers 4 for length and 2 for snap resolution when converting after my combo box change. Why these specific values? Why not choose 60 for snap FPS and 120 for frame length? It would achieve the same result but actually convey the correct information that the animation runs at 60fps (by default) and this particular animation will last 120 frames at 60fps. Is it because it needed to place 4 snap-able positions into the timeline? Maybe I get it but the price in user confusion might be too high.
I understand that maybe there is no good solution to this, because Godot animation system isn't tied to framerate. Maybe the solution is to not be able to set snap to FPS and only operate in seconds?
@Dancovich
It chose the numbers 4 for length and 2 for snap resolution when converting after my combo box change. Why these specific values?
It chose those values because those are the values that match with the values you had in seconds. Before, you had a 2 second animation with a snap value of 0.5. When changing to FPS mode, it converts those values into FPS values. Snapping every 0.5 seconds is the same thing as snapping with 2 FPS, and a duration of 2 seconds is the same thing as 4 frames at a speed of 2 FPS. If you change the FPS to 60 and then change it back to use seconds, the snap will change to 0.0167 seconds which is a 60th of a second. It doesn't assume what you want to use for FPS or duration, so it instead takes what you had before in seconds and translates it to FPS.
Why not choose 60 for snap FPS and 120 for frame length? It would achieve the same result but actually convey the correct information that the animation runs at 60fps (by default) and this particular animation will last 120 frames at 60fps.
Forget the speed that the game is running and rendering at, because it doesn't matter. Animation frames and FPS are separate from game ticks and FPS. Most games don't even restrict themselves to running at 60 FPS, and there is no standard for the FPS of animations. It's actually uncommon for 2D games to be animated at 60 FPS, just because animating every frame is a lot of work and won't fit all styles. So godot doesn't assume the FPS that you will be using for your animations because there is no way for it to know. So, instead of guessing what you want, it takes the settings you were already using for the seconds mode and converts them to FPS like I said above.
I understand that maybe there is no good solution to this, because Godot animation system isn't tied to framerate. Maybe the solution is to not be able to set snap to FPS and only operate in seconds?
The FPS mode is very useful for games with 2D frame-by-frame animation so that you don't have to deal with setting the snapping to values like 0.0167 or calculating the duration in seconds that a frame-based animation will take.
I'm using it for a 2D fighting game. Each animation is at 60 FPS, and has a specific number of frames and specific things that happen on specific frames. It's much more convenient to look at the timeline in terms of frames instead of seconds so that I can say "the hitboxes should be active from frame 3 to 5 with invincibility on frame 8" and then just click on those frames in the timeline to add the keyframes. I can then say "the animation should last 8 frames" and input 8 into the duration instead of calculating what 8 frames should be in seconds.
Others might be using it in a similar way, but not with 60 FPS animations, so you can't really lock it to 60.
it is not conveying information in a way an animator (which is not necessarily a developer) might understand.
What would you suggest to change it? I think the only misunderstanding you had was what the snapping input box did, right? So maybe a tooltip to explain it? I think the duration and timeline are fine, personally.
I get the sense that you aren't using 2D frame by frame animation, in which case the FPS mode might not be for you because that's mostly what it's for.
What would you suggest to change it? I think the only misunderstanding you had was what the snapping input box did, right? So maybe a tooltip to explain it? I think the duration and timeline are fine, personally.
I'm not a specialist and I acknowledge I might just be talking bs, but I'll do my best. I hope someone with better knowledge than me can make any sense of this. These suggestions could be taken individually or as a group.
Separate animation FPS setting from Snap
My confusion was that, in Snap FPS mode, a setting called Snap (which should be just a visual tool for editing) was affecting a setting called Animation length (an actual property of the animation). Maybe it would help if the presentation mode of the timeline (between FPS or seconds) was separate from the Snap setting.
This screenshot is my proposal.
Timeline mode can be chosen between Seconds and FPS. When in FPS mode, you can also set the FPS setting of the animation. This changes the actual timeline and both the Snap setting (which will snap in seconds or frames based on this setting) and Animation length (which will be in frames or seconds).
When in Seconds mode, the text box to set the FPS will be disabled and Snap and Animation length will behave like they do in Snap Seconds mode.
IMO, this would have advantage of making clear the effect FPS mode has in the whole Animation editor. It would also allow me to snap at a certain number of frames by doing the math "fps / desired snap" for me.
It is more settings for the user, so I don't know if it would make things more confusing. That would require more user testing to determine.
Change the tooltip
In case the proposal above is too much, we could indeed change the tooltip.
From what I could understand from your explanation, in Snap FPS mode, the animation length (frames)
tooltip actually means animation length (frames at X FPS)
. You can't just look at the tooltip in a vacuum, you need to acknowledge your timeline is now in FPS and the animation length is frames needs to use that FPS as reference. The settings are pretty far away, so it is not clear at first the correlation between the two.
I don't know of a succinct way of putting that information on a simple tooltip. I've seen other places in the Editor just put a whole paragraph as a tooltip, so maybe give a little more explanation of what is happening to the animation length setting in FPS snap mode?
Better documentation (or better discoverability)
I couldn't find anywhere in the docs the explanation of the correlation between Snap and Animation length. To make things worse, this correlation is also not obvious in Godot Editor itself when you are in Seconds mode (these settings seem to just be independent of each other). Only when you change to FPS snap mode is that snap starts affecting Animation length.
I mean, I really don't like the user experience of changing a setting called Snap and a text box in a completely different place changes accordingly, for a reason that is not obvious at first. My very first question when I noticed this was "why is Snap affecting the length of my animation?". This is something I truly believe should be better documented.