summaryrefslogtreecommitdiffstats
path: root/scene/animation/animation_player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation/animation_player.cpp')
-rw-r--r--scene/animation/animation_player.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 2213800476..0c24d79ad7 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -32,7 +32,6 @@
#include "animation_player.compat.inc"
#include "core/config/engine.h"
-#include "scene/scene_string_names.h"
bool AnimationPlayer::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name;
@@ -41,7 +40,7 @@ bool AnimationPlayer::_set(const StringName &p_name, const Variant &p_value) {
} else if (name.begins_with("next/")) {
String which = name.get_slicec('/', 1);
animation_set_next(which, p_value);
- } else if (p_name == SceneStringNames::get_singleton()->blend_times) {
+ } else if (p_name == SceneStringName(blend_times)) {
Array array = p_value;
int len = array.size();
ERR_FAIL_COND_V(len % 3, false);
@@ -77,7 +76,7 @@ bool AnimationPlayer::_get(const StringName &p_name, Variant &r_ret) const {
String which = name.get_slicec('/', 1);
r_ret = animation_get_next(which);
- } else if (name == "blend_times") {
+ } else if (p_name == SceneStringName(blend_times)) {
Vector<BlendKey> keys;
for (const KeyValue<BlendKey, double> &E : blend_times) {
keys.ordered_insert(E.key);
@@ -326,14 +325,14 @@ void AnimationPlayer::_blend_post_process() {
String new_name = playback.assigned;
playback_queue.pop_front();
if (end_notify) {
- emit_signal(SceneStringNames::get_singleton()->animation_changed, old, new_name);
+ emit_signal(SceneStringName(animation_changed), old, new_name);
}
} else {
_clear_caches();
playing = false;
_set_process(false);
if (end_notify) {
- emit_signal(SceneStringNames::get_singleton()->animation_finished, playback.assigned);
+ emit_signal(SceneStringName(animation_finished), playback.assigned);
if (movie_quit_on_finish && OS::get_singleton()->has_feature("movie")) {
print_line(vformat("Movie Maker mode is enabled. Quitting on animation finish as requested by: %s", get_path()));
get_tree()->quit();
@@ -448,10 +447,10 @@ void AnimationPlayer::_play(const StringName &p_name, double p_custom_blend, flo
} else {
if (p_from_end && c.current.pos == 0) {
// Animation reset but played backwards, set position to the end.
- c.current.pos = c.current.from->animation->get_length();
+ seek(c.current.from->animation->get_length(), true, true);
} else if (!p_from_end && c.current.pos == c.current.from->animation->get_length()) {
// Animation resumed but already ended, set position to the beginning.
- c.current.pos = 0;
+ seek(0, true, true);
} else if (playing) {
return;
}
@@ -463,7 +462,7 @@ void AnimationPlayer::_play(const StringName &p_name, double p_custom_blend, flo
_set_process(true); // Always process when starting an animation.
playing = true;
- emit_signal(SceneStringNames::get_singleton()->animation_started, c.assigned);
+ emit_signal(SceneStringName(animation_started), c.assigned);
if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) {
return; // No next in this case.