diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2021-04-05 14:40:44 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2021-04-05 14:42:21 +0200 |
commit | 77264e346b984403c2c59bc51b87bd7b35388784 (patch) | |
tree | 63cc55be67e65200b8ba24bc2a3fbcc479d83e6c /scene/2d | |
parent | b80b072c44cfc4f6ec1bfecc045374597eb296e0 (diff) | |
download | redot-engine-77264e346b984403c2c59bc51b87bd7b35388784.tar.gz |
Re-allow playing AnimatedSprite2D without frames
Fixes #47578, partial revert of #47064.
Diffstat (limited to 'scene/2d')
-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); } } |