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

Linear keyframe interpolation not working for Control anchor offsets #85858

Closed
estroBiologist opened this issue Dec 6, 2023 · 1 comment · Fixed by #86046
Closed

Linear keyframe interpolation not working for Control anchor offsets #85858

estroBiologist opened this issue Dec 6, 2023 · 1 comment · Fixed by #86046

Comments

@estroBiologist
Copy link

Tested versions

  • Reproducible in: v4.2.stable.official [46dc277]
  • Not reproducible in: v4.1.3.stable

System information

Godot v4.2.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated AMD Radeon RX 6600 (Advanced Micro Devices, Inc.; 31.0.21023.2010) - AMD Ryzen 7 5700X 8-Core Processor (16 Threads)

Issue description

Starting with Godot 4.2, changing a Control node's anchor offsets with an AnimationPlayer node results in the offsets "snapping" to the keyframes, as if Nearest interpolation were used.

This only applies to the Linear Interpolation Mode; Cubic still works as expected.

resize_interp_fail

I encountered this regression when upgrading my project from 4.1.3 to 4.2. Minimum reproduction project provided below.

Steps to reproduce

  • Create a Control node with a Custom anchor preset.
  • Create an AnimationPlayer track for one or more of its anchor offsets, with the Continuous update mode and Linear interpolation.
  • Add keyframes to track(s)
  • Play animation (either in the editor or in-game)

Minimal reproduction project (MRP)

ControlResize.zip

@bs-mwoerner
Copy link
Contributor

bs-mwoerner commented Dec 11, 2023

The linear interpolation refuses to interpolate between the two keys because one is a float and the other is an integer.

tracks/1/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, -50]
}

So the questions that come to mind are:

  1. How did this happen?
  2. Should the linear interpolation be more lenient when asked to interpolate between scalar values that require a type cast?

Do you remember how you created that animation? Did you, for example, animate the anchors first and then change the tracks to offset?

In any case, you can fix this particular animation by selecting the two keyframes on the left and changing their value to 1 and back to 0. This will set them to an integer 0 and the linear interpolation will be happy.

Edit: I just tried this myself: Clicking the key icon next to an offset property (or possibly any integer property) will create a float keyframe, but entering a value in the inspector for that keyframe, will set it to an integer. As a result, the interpolation will break as soon as you mix captured values (via the key icon) and manually entered values on an integer track.

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

Successfully merging a pull request may close this issue.

4 participants