godotengine / godotengine/godot

AnimationPlayer dont follow Track order when changing parameters

Open
#108,461 1 comment 1 reaction 0 assignees View on GitHub
discussion documentation topic:animation
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- reproducible on v4.4.1.stable.official [49a5bc7b6]

### System information

Debian Linux, Nvidia

### Issue description

The animation player dont follow the track order when change values, so if i play the animation in the AnimationTree and is a change in the hframes between animations, the debug spawn an error because of out of bounds frame count

example:
Idle have hframe of 2 and just 2 frame of animation (start at 0 and cout upwards)
Walk have hframe of 6 and 6 frames of animation(start at 5 and count downwards)

when switching from Idle to Walk, the frame is changed after the hframe is changed, causing a out of bounds

E 0:00:02:403 set_frame: Index p_frame = 5 is out of bounds (vframes * hframes = 2).
scene/2d/sprite_2d.cpp:256 @ set_frame()

then the game plays normay, but will spawn an error every time this transition occur

### Steps to reproduce

transition from a smaller frame count to a bigger frame count animation using animation tree blend 2, when the bigger animation start at bigger frame count that the smaller one

### Minimal reproduction project (MRP)

walk from idle to left trigger the error, walk from idle to right do not because the animation start from frame 0, leaving time to the hframe change

[mvp.zip](https://github.com/user-attachments/files/21151588/mvp.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the AnimationTree transition described in the issue and inspect scene/2d/sprite_2d.cpp at set_frame(), using the attached minimal reproduction project to trigger the Idle-to-Walk transition. Trace how track order and hframes are updated during the transition. Done means the transition no longer reports an out-of-bounds frame error while preserving the described animation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.