aboutsummaryrefslogtreecommitdiff
path: root/scene/animation/animation_player.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2018-04-08 11:36:15 -0300
committerGitHub2018-04-08 11:36:15 -0300
commita6c9ccf0075aec6790fbe938bac8b434e5db01f8 (patch)
tree102f39d0897a6acbe21507a77deef9df1bad9b22 /scene/animation/animation_player.cpp
parent20e68fef856a56346f5044fc532975ee329fb25c (diff)
parent5ef88cf577ad45b4dece733f1bb1350f7c93547e (diff)
downloadgodot-a6c9ccf0075aec6790fbe938bac8b434e5db01f8.tar.gz
godot-a6c9ccf0075aec6790fbe938bac8b434e5db01f8.tar.zst
godot-a6c9ccf0075aec6790fbe938bac8b434e5db01f8.zip
Diffstat (limited to 'scene/animation/animation_player.cpp')
-rw-r--r--scene/animation/animation_player.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 2cf488ade..b5bba885c 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1025,6 +1025,13 @@ float AnimationPlayer::get_speed_scale() const {
return speed_scale;
}
+float AnimationPlayer::get_playing_speed() const {
+
+ if (!playing) {
+ return 0;
+ }
+ return speed_scale * playback.current.speed_scale;
+}
void AnimationPlayer::seek(float p_time, bool p_update) {
@@ -1316,6 +1323,7 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_speed_scale", "speed"), &AnimationPlayer::set_speed_scale);
ClassDB::bind_method(D_METHOD("get_speed_scale"), &AnimationPlayer::get_speed_scale);
+ ClassDB::bind_method(D_METHOD("get_playing_speed"), &AnimationPlayer::get_playing_speed);
ClassDB::bind_method(D_METHOD("set_autoplay", "name"), &AnimationPlayer::set_autoplay);
ClassDB::bind_method(D_METHOD("get_autoplay"), &AnimationPlayer::get_autoplay);