diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-09 22:11:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-09 22:11:04 +0100 |
commit | 06a33e590f029d4d96e32df62f3c3961e1c33e4e (patch) | |
tree | d91ff1e2c78a31d2897a2cc49218d4f3b7535459 /editor/plugins/animation_player_editor_plugin.cpp | |
parent | efea3128c3b0d026a20efaf6bd46058c2b732519 (diff) | |
parent | 953a7bce7edf289dd8d2a1a6c8ecd8105380c8da (diff) |
Merge pull request #53819 from TokageItLab/re-implement-ping-pong
Reimplement ping-pong animation and reverse playback
Diffstat (limited to 'editor/plugins/animation_player_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index ea025dad3e..65238446f9 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -41,6 +41,7 @@ #include "editor/plugins/canvas_item_editor_plugin.h" // For onion skinning. #include "editor/plugins/node_3d_editor_plugin.h" // For onion skinning. #include "scene/main/window.h" +#include "scene/resources/animation.h" #include "servers/rendering_server.h" void AnimationPlayerEditor::_node_removed(Node *p_node) { @@ -72,7 +73,7 @@ void AnimationPlayerEditor::_notification(int p_what) { if (player->has_animation(animname)) { Ref<Animation> anim = player->get_animation(animname); if (!anim.is_null()) { - frame->set_max(anim->get_length()); + frame->set_max((double)anim->get_length()); } } } @@ -289,7 +290,7 @@ void AnimationPlayerEditor::_animation_selected(int p_which) { track_editor->set_root(root); } } - frame->set_max(anim->get_length()); + frame->set_max((double)anim->get_length()); } else { track_editor->set_animation(Ref<Animation>()); @@ -1014,7 +1015,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value, bool p_set, bool Ref<Animation> anim; anim = player->get_animation(current); - float pos = CLAMP(anim->get_length() * (p_value / frame->get_max()), 0, anim->get_length()); + float pos = CLAMP((double)anim->get_length() * (p_value / frame->get_max()), 0, (double)anim->get_length()); if (track_editor->is_snap_enabled()) { pos = Math::snapped(pos, _get_editor_step()); } @@ -1424,7 +1425,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { float pos = cpos + step_off * anim->get_step(); - bool valid = anim->has_loop() || (pos >= 0 && pos <= anim->get_length()); + bool valid = anim->get_loop_mode() != Animation::LoopMode::LOOP_NONE || (pos >= 0 && pos <= anim->get_length()); onion.captures_valid.write[cidx] = valid; if (valid) { player->seek(pos, true); |