Skip to content

Commit

Permalink
Revert "Revert "Implements godotengine#41838""
Browse files Browse the repository at this point in the history
This reverts commit 27e034b.
  • Loading branch information
HeadCrab654 committed Sep 7, 2020
1 parent 27e034b commit 1f52fc1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scene/animation/animation_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,26 @@ void AnimationPlayer::stop(bool p_reset) {
playing = false;
}

void AnimationPlayer::pause(bool p_pause) {
_stop_playing_caches();
Playback &c = playback;
c.blend.clear();

_set_process(!p_pause);
queued.clear();
playing = !p_pause;
}

void AnimationPlayer::resume() {
_stop_playing_caches();
Playback &c = playback;
c.blend.clear();

_set_process(true);
queued.clear();
playing = true;
}

void AnimationPlayer::set_speed_scale(float p_speed) {
speed_scale = p_speed;
}
Expand Down Expand Up @@ -1559,6 +1579,8 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("play", "name", "custom_blend", "custom_speed", "from_end"), &AnimationPlayer::play, DEFVAL(""), DEFVAL(-1), DEFVAL(1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("play_backwards", "name", "custom_blend"), &AnimationPlayer::play_backwards, DEFVAL(""), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("stop", "reset"), &AnimationPlayer::stop, DEFVAL(true));
ClassDB::bind_method(D_METHOD("pause", "pause"), &AnimationPlayer::pause, DEFVAL(true));
ClassDB::bind_method(D_METHOD("resume"), &AnimationPlayer::resume);
ClassDB::bind_method(D_METHOD("is_playing"), &AnimationPlayer::is_playing);

ClassDB::bind_method(D_METHOD("set_current_animation", "anim"), &AnimationPlayer::set_current_animation);
Expand Down
2 changes: 2 additions & 0 deletions scene/animation/animation_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ class AnimationPlayer : public Node {
Vector<String> get_queue();
void clear_queue();
void stop(bool p_reset = true);
void pause(bool p_pause = true);
void resume();
bool is_playing() const;
String get_current_animation() const;
void set_current_animation(const String &p_anim);
Expand Down

0 comments on commit 1f52fc1

Please sign in to comment.