Skip to content
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

Set animation step from importers. Increase default step from 10 to 30FPS #90894

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

lyuma
Copy link
Contributor

@lyuma lyuma commented Apr 19, 2024

Most framerates are a multiple of 30, and most animations also use 30 or 60 as a basis.

However, imported animations did not have a step assigned, leading editing imported animations to be extremely clunky since snap is on by default and the default step interval is at 10 fps.

This PR makes the default step in the Animation resource 1/30 (30 fps) and also uses the correct bake_fps value as step during import. Finally, the new button in the animation track editor will reuse the current animation step if one is loaded.

In a pedantic sense, this is compatibility breaking because I am changing the default value of an existing resource property: almost all existing animations will likely be increased to 30 FPS. I don't see this as a problem for these reasons:

  1. The step value is currently only used in editor tooling. The exception would be cases where this value is used by a game script and that game uses 10 FPS animations that have not changed from the default value.
  2. Almost all imported assets were incorrectly imported as 10 FPS step, since the value was never assigned during import. Changing the value in the Animation resource will retroactively "fix" the timestamp from most imported animations.
  3. For the purposes of editing, a step of 1/30 is still compatible with 10 FPS animations: It is possible to ignore the in between keyframes and snap cleanly to 1/10 if desired.

If there is pushback to changing the Animation resource or the default FPS for new animations, I can remove those changes.

Finally, there was a comment in chat that it will look weird to have the Snap field default to 0.03333 since it doesn't look like a round number. My rebuttal is this is a consequence of being in the real world. We can't change that 30 FPS is a popular framerate, and we can't change the infinitely repeating decimal nature of 1/30. There is a FPS dropdown in the animation track editor and I'd be open to changing the default dropdown to be FPS, but this affects how the timeline looks and my goal is to not change the UX significantly. If I could do FPS just for the textbox but keep the track editor in seconds then maybe...

@lyuma lyuma requested a review from a team as a code owner April 19, 2024 09:16
@lyuma lyuma added this to the 4.3 milestone Apr 19, 2024
@lyuma lyuma force-pushed the animation_step_30 branch from bd575fe to c655836 Compare April 19, 2024 09:23
@lyuma lyuma requested a review from a team as a code owner April 19, 2024 09:23
@lyuma lyuma force-pushed the animation_step_30 branch from c655836 to bb9674c Compare April 19, 2024 10:02
@lyuma lyuma requested a review from a team as a code owner April 19, 2024 10:02
@@ -602,7 +602,7 @@
<member name="loop_mode" type="int" setter="set_loop_mode" getter="get_loop_mode" enum="Animation.LoopMode" default="0">
Determines the behavior of both ends of the animation timeline during animation playback. This is used for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
</member>
<member name="step" type="float" setter="set_step" getter="get_step" default="0.1">
<member name="step" type="float" setter="set_step" getter="get_step" default="0.0333333">
The animation step value.
Copy link
Member

@Calinou Calinou Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're at it, we can improve the description:

Suggested change
The animation step value.
The animation step value. This property affects snapping in the editor, but does not affect animation playback otherwise.

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

@Calinou
Copy link
Member

Calinou commented Apr 19, 2024

If I could do FPS just for the textbox but keep the track editor in seconds then maybe...

It might make sense to do this in the future if no other animation software out there is displaying the step in seconds. The value would then always be displayed in FPS in the LineEdit, but the setting would control what's shown on the timeline instead.

@akien-mga akien-mga requested review from a team April 22, 2024 10:47
@akien-mga akien-mga merged commit 17d9c52 into godotengine:master Apr 24, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@JHDev2006
Copy link

this makes sense as a change, however i still animate at 0.05 seconds snap. I just prefer it really, could it be possible to have an editor setting to change the default animation snap?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants