-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
AnimatedSprite: Remove play()
's backwards, add methods to compensate
#65973
AnimatedSprite: Remove play()
's backwards, add methods to compensate
#65973
Conversation
Removes `play()`'s second parameter, `backwards`. This makes `speed_scale > 0.0` the one consistent way to verify if an animation is playing in reverse. To compensate, adds `play_forward()` and `play_backwards()` as shorthand methods. Both of these methods change the sign of `speed_scale` only when necessary, then call `play()`.
This breaks consistency with AnimationPlayer. It is theoretically correct that reverse playback in negative scale is forward playback, and I don't see this as a problem. If you don't need the reverse playback feature, just don't use it, and this is not a reason to remove it. You can always just guarantee it as false in your project. Moreover, at least you can get the direction of playback of the animation correct by just storing the flags on the script during playback and inverse speed_scale as needed. |
I think, given the changes/discussion from #65148, to solve these proposals the |
If we want to bring up consistency with AnimationPlayer, |
I wouldn't expose it as a property at this point. It seems like |
This can be supported. Perhaps just implement it as a wrapper function of However, I would say that the problem of confusability that this PR can be easily avoided by as I said above: user restriction such as backward is always false, or with a few lines of code on GDScript. So I think that it is not worth changing the core. |
I was thinking about the easiness of checking/unchecking |
Yeah, it was as simple as exposing the cached variable with setters and getters. This time however, unlike 2 years ago, it's more justifiable because I wouldn't want users to write |
The user already should know in which mode is playing. Therefore, there is no need to implement the function e.g.) var speed_scale: float = -1.0
var played_backward: bool = true
AnimatedSprite.set_speed_scale(speed_scale)
AnimatedSprite.play("AnimationName", played_backward)
if speed_scale >= 0.0 != played_backward:
# Playing forward
else:
# Playing backward |
Closing, as this makes things more complicated than they actually are. It goes against the simplicity and ease of use of AnimatedSprite. |
Closes godotengine/godot-proposals#5286 (see comments).
Closes godotengine/godot-proposals#4506.
Supersedes #41821.
A bit of a backstory:
#65148 added the ability to set
speed_scale
to a negative value and if it is, the animation plays in reverse. This is good. However, the original intention of the proposal was to haveplay()
's second parameter, "backwards", implicitly switchspeed_scale
's sign if necessary. Doing this would have closed the proposals above. This was not agreed upon. Instead, what ended up happening was that... basically, setting "backwards" to true andspeed_scale
to -1 has the animation moving forward. This is not just confusing, but defeats the original purpose of that PR, because now there is one "backwards" that is not exposed to the user.This PR outright removes
play()
's second parameter from AnimatedSprite2D and AnimatedSprite3D. This makesspeed_scale > 0.0
the one consistent way to verify if an animation is playing in reverse.To compensate, adds
play_forward()
andplay_backwards()
as shorthand methods. Both of these methods change the sign ofspeed_scale
only when necessary, then callplay()
. This is like #65148 's original implementation, but split in two separate, way more explicit methods.I should follow this up with a Proposal.