diff options
| author | robfram | 2018-03-01 19:52:00 +0100 |
|---|---|---|
| committer | robfram | 2018-03-03 09:29:22 +0100 |
| commit | 5ef88cf577ad45b4dece733f1bb1350f7c93547e (patch) | |
| tree | bf85ff8b26bf9109b1ddf414fe7c66e93b1d6ecc /scene/animation/animation_player.cpp | |
| parent | 741af0652dd3e5992654ef401f04f9f461e1d0c5 (diff) | |
| download | godot-5ef88cf577ad45b4dece733f1bb1350f7c93547e.tar.gz godot-5ef88cf577ad45b4dece733f1bb1350f7c93547e.tar.zst godot-5ef88cf577ad45b4dece733f1bb1350f7c93547e.zip | |
Diffstat (limited to 'scene/animation/animation_player.cpp')
| -rw-r--r-- | scene/animation/animation_player.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 9db4a5fb0..859c40701 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1024,6 +1024,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) { @@ -1315,6 +1322,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); |
