diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-05 14:58:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-05 14:58:38 +0200 |
commit | ccdcb29df1bccd3cd0e96eb461b794e1633b75de (patch) | |
tree | 6d9a03a4a790aa36b98601762e8b150c88403343 /scene | |
parent | 9e8acb3897673539ae229bbc8acfd853b9e8d9fb (diff) | |
parent | 77264e346b984403c2c59bc51b87bd7b35388784 (diff) |
Merge pull request #47645 from akien-mga/animatedsprite2d-no-frames
Re-allow playing AnimatedSprite2D without frames
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/animated_sprite_2d.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index dfc08583f2..4aa079b013 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -382,12 +382,11 @@ bool AnimatedSprite2D::_is_playing() const { } void AnimatedSprite2D::play(const StringName &p_animation, const bool p_backwards) { - ERR_FAIL_NULL_MSG(frames, "Can't play AnimatedSprite2D without a valid SpriteFrames resource."); backwards = p_backwards; if (p_animation) { set_animation(p_animation); - if (backwards && get_frame() == 0) { + if (frames.is_valid() && backwards && get_frame() == 0) { set_frame(frames->get_frame_count(p_animation) - 1); } } |