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

Animation Playback Track not seeking properly in the Animation Editor #38093

Closed
EspeuteClement opened this issue Apr 21, 2020 · 7 comments · Fixed by #38107
Closed

Animation Playback Track not seeking properly in the Animation Editor #38093

EspeuteClement opened this issue Apr 21, 2020 · 7 comments · Fixed by #38107
Milestone

Comments

@EspeuteClement
Copy link
Contributor

Godot version:
v3.2.1.stable.official

OS/device including version:
Window 10 64bit
18362.778

Issue description:

When seeking through an Animation that has a Animation Playback Track, the Animation Playback Track is not updated accordingly if the selected animation is not a looped animation. "Play the Animation from current pos" also doesn't play the Animation Playback Track correctly if the play bar is in the middle of the animation track.

Here is a capture of the expected result that is obtained when playing the animation from the start
000024

Here is a capture of the seeking in the editor that does not play the expected animation
000026

Steps to reproduce:

  1. Create an object with an attached animation player (A)
  2. Create a simple one shot animation
  3. Create another animation player B
  4. Inside of the animation player B, create an Animation Playback Track, targeting the animation player A
  5. Add a key inside the Animation Playback Track, with the animation created in step 2 as the Animation parameter.
  6. Scroll through the timeline using the mouse, and notice that the animation from the animation player A is not updating accordingly.

Or using the included reproduction project :

  1. Open the Main.tscn scene
  2. Open the GlobalAnimationPlayer node
  3. Select the GlobalAnimationWithOneShot animation
  4. Scroll through the timeline using the mouse, and notice that the animation clip is not playing the correct animation (the Sprite should move up and down)

Minimal reproduction project:
AnimPlaybackBug.zip

Additional notes:

I have a fix available here EspeuteClement@d6f24f8 , but I didn't know if I could make a pull request for a bug that doesn't have an open issue.

@ghost
Copy link

ghost commented Apr 22, 2020

Confirmed in 3.2 beta.

This is a good description of the problem. I don't think there would be an issue submitting a PR.

@ghost
Copy link

ghost commented Apr 22, 2020

@EspeuteClement Tested your fix, it doesn't fully fix it. For me it works if you allow the playing animation to hit the start point of that keyframed animation track, but if you try scrubbing through the timeline, seeking to a position after the sub-animation's starting point it will not update the positions.

This also fails in runtime using the script below. The seeking functionality would need fixing as well.

func _ready() -> void:
	$GlobalAnimationPlayer.play("GlobalAnimationWithOneShot")
	$GlobalAnimationPlayer.seek(1.0, true)

I would imagine the intended complete functionality is that where-ever you seek to in the animation, it will update the position of that "one-shot" animation as well.

@EspeuteClement
Copy link
Contributor Author

So you mean if you scrubb at a point after the end of the animation track, the animation should update to reflect the last frame of the animation track ?

I'll try to see if I can fix that, using the code of the looping animation as an example, as this behavior is correct when scrubbing through animations that loops (it correctly update even if you scrub past the end of the animation)

@ghost
Copy link

ghost commented Apr 22, 2020

Anywhere one scrubs to that time should be sent to the sub-animation's seek. I'm assuming it's doing a little math and using relative time.

Hopefully that helps. I could be failing to explain this.

If in doubt though, there is ground truth in your GlobalAnimationWithLoop animation in the GlobalAnimationPlayer. It shows the correct results when scrubbing. You can compare against that.

@EspeuteClement
Copy link
Contributor Author

EspeuteClement commented Apr 22, 2020

So I tried to reproduce that on my end using my fix on the 3.2 branch, and I don't think I see the issue you are describing, unless I'm mistaken. Using your code show the expected result on my side.

Here is a gif of me scrubbing through the one shot and non looping animation, that have a clear start (green dot) and end (red dot), when the fix is applied.
000034

And here is an updated reproduction project :
AnimPlaybackBug2.zip

One could argue that the animation don't seek at the beginning of the animation when scrubbing before that, but I don't think it's the intended behavior anyways, as it's the same for the looping animation.

@ghost
Copy link

ghost commented Apr 22, 2020

I think I may be the one who is mistaken here. Apologies if that is the case.

Upon retesting it is behaving as expected.

Not clear what I did previously to encounter it. The initial play triggered the sub animation, but the seeking did not... Likely a mistake in testing on my part.

@EspeuteClement
Copy link
Contributor Author

Okay, in that case I'll open the pull request.

@akien-mga akien-mga added this to the 4.0 milestone Sep 15, 2021
akien-mga pushed a commit to akien-mga/godot that referenced this issue Sep 21, 2021
sairam4123 pushed a commit to sairam4123/godot that referenced this issue Nov 10, 2021
lekoder pushed a commit to KoderaSoftwareUnlimited/godot that referenced this issue Dec 18, 2021
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.

3 participants