summaryrefslogtreecommitdiff
path: root/scene/resources/sprite_frames.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-27 10:32:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-27 10:32:23 +0100
commit91c0ed5e33bcf713071349962154953b81e45e0d (patch)
tree070192d905ba3b20e405d63b2bc39e05fbe38e73 /scene/resources/sprite_frames.h
parenta0a633ae58170a4be4aef00bab18635845613816 (diff)
parent17bf6238fc3dca1b2ec6c1a0bbe11d5e7d7a8113 (diff)
Merge pull request #71907 from TokageItLab/change-animated-sprite-api
Make `AnimatedSprite`'s playback API consistent with `AnimationPlayer`
Diffstat (limited to 'scene/resources/sprite_frames.h')
-rw-r--r--scene/resources/sprite_frames.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/scene/resources/sprite_frames.h b/scene/resources/sprite_frames.h
index 61bead6948..6de2b4a37b 100644
--- a/scene/resources/sprite_frames.h
+++ b/scene/resources/sprite_frames.h
@@ -33,6 +33,8 @@
#include "scene/resources/texture.h"
+static const float SPRITE_FRAME_MINIMUM_DURATION = 0.01;
+
class SpriteFrames : public Resource {
GDCLASS(SpriteFrames, Resource);
@@ -89,10 +91,10 @@ public:
_FORCE_INLINE_ float get_frame_duration(const StringName &p_anim, int p_idx) const {
HashMap<StringName, Anim>::ConstIterator E = animations.find(p_anim);
- ERR_FAIL_COND_V_MSG(!E, 0.0, "Animation '" + String(p_anim) + "' doesn't exist.");
- ERR_FAIL_COND_V(p_idx < 0, 0.0);
+ ERR_FAIL_COND_V_MSG(!E, 1.0, "Animation '" + String(p_anim) + "' doesn't exist.");
+ ERR_FAIL_COND_V(p_idx < 0, 1.0);
if (p_idx >= E->value.frames.size()) {
- return 0.0;
+ return 1.0;
}
return E->value.frames[p_idx].duration;