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

AnimationPlayer should return error when attempting to play animation that doesn't exist #366

Open
Feniks-Gaming opened this issue Jan 8, 2020 · 3 comments

Comments

@Feniks-Gaming
Copy link

Describe the project you are working on:

Breakout clone

Describe the problem or limitation you are having in your project:

Currently $AnimationPlayer.play("animation_name_that_doesn't_exist") will do nothing it will simply not play any animation. This is not desired because it makes it hard to track bugs.

This usually happens when user misspells animation name and is not something any user could possibly want as desired behaviour.

Describe how this feature / enhancement will help you overcome this problem or limitation:

$AnimationPlayer.play("animation_name_that_doesn't_exist") should return error Attempting to play animation that doesn't exist so user knows immediately that that there is an error

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:

N/A

Describe implementation detail for your proposal (in code), if possible:

Not sure

If this enhancement will not be used often, can it be worked around with a few lines of script?:

Used by everyone and no current work around hat I know off.

Is there a reason why this should be core and not an add-on in the asset library?:

It's a pare of core behaviour of one of core nodes.

@Feniks-Gaming Feniks-Gaming changed the title AnimationPayer should return error when attempting to play animation that doesn't exist AnimationPlayer should return error when attempting to play animation that doesn't exist Jan 10, 2020
@Janders1800
Copy link

if animationPlayerNode.has_animation("animationToPlay"):
    animationPlayerNode.play("animationToPlay")
else:
    push_error(Animation: animationToPlay, ", not found on: ", animationPlayerNode.get_name())

@Feniks-Gaming
Copy link
Author

It should do it by default. I shouldn't have to add 2 lines of code every time for his to happen.

@timothyqiu
Copy link
Member

I think animation existence has already been checked: https://github.com/godotengine/godot/blob/43caf83c0973c22b54f28e84aa23e2c6d501fe1f/scene/animation/animation_player.cpp#L1150-L1157

Both 3.1.2 and current master produce this error:

ERROR: play: Animation not found: animation_name_that_doesn't_exist.

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

No branches or pull requests

4 participants