Fixes some AnimationPlayer bugs
Fixes #25745 (closed) Fixes #17423 (closed)
Line 1210 from animation_player.cpp is: https://github.com/godotengine/godot/blob/eda4be193fd736d362184bc937efc99c1faa18c3/scene/animation/animation_player.cpp#L1210
Which means that when called without arguments the method would replace the variable playback.assigned
with an empty String. This makes the signal animation_finished
give this empty String as an argument.
I've changed it to https://github.com/godotengine/godot/blob/592d514380eabfc9d36c68b44f263513e823c35b/scene/animation/animation_player.cpp#L1210
The variable name
in this method has the correct animation name as defined at the beginning of it. This fixes #25745 (closed).
The line 1208: https://github.com/godotengine/godot/blob/eda4be193fd736d362184bc937efc99c1faa18c3/scene/animation/animation_player.cpp#L1208
Doesn't have any condition to run, so it resets the position of the animation to 0 every time p_from_end is false. Also, calling stop(true)
doesn't reset the animation. This PR makes the animation position be 0 when calling stop(true)
https://github.com/godotengine/godot/blob/592d514380eabfc9d36c68b44f263513e823c35b/scene/animation/animation_player.cpp#L1281-L1294
and replaces line 1208 with https://github.com/godotengine/godot/blob/592d514380eabfc9d36c68b44f263513e823c35b/scene/animation/animation_player.cpp#L1208
The animation position is reset, or not, at the stop()
method, so the play()
method just keeps the decision made there (unless it is told to run the animation backwards), fixing #17423 (closed).