|
@@ -527,12 +527,14 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f
|
|
|
|
|
|
if (!backwards && cd.pos <= len && next_pos == len /*&& playback.blend.empty()*/) {
|
|
if (!backwards && cd.pos <= len && next_pos == len /*&& playback.blend.empty()*/) {
|
|
//playback finished
|
|
//playback finished
|
|
- end_notify = true;
|
|
|
|
|
|
+ end_reached = true;
|
|
|
|
+ end_notify = cd.pos < len; // Notify only if not already at the end
|
|
}
|
|
}
|
|
|
|
|
|
if (backwards && cd.pos >= 0 && next_pos == 0 /*&& playback.blend.empty()*/) {
|
|
if (backwards && cd.pos >= 0 && next_pos == 0 /*&& playback.blend.empty()*/) {
|
|
//playback finished
|
|
//playback finished
|
|
- end_notify = true;
|
|
|
|
|
|
+ end_reached = true;
|
|
|
|
+ end_notify = cd.pos > 0; // Notify only if not already at the beginning
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -676,24 +678,26 @@ void AnimationPlayer::_animation_process(float p_delta) {
|
|
|
|
|
|
if (playback.current.from) {
|
|
if (playback.current.from) {
|
|
|
|
|
|
|
|
+ end_reached = false;
|
|
end_notify = false;
|
|
end_notify = false;
|
|
_animation_process2(p_delta);
|
|
_animation_process2(p_delta);
|
|
_animation_update_transforms();
|
|
_animation_update_transforms();
|
|
- if (end_notify) {
|
|
|
|
|
|
+ if (end_reached) {
|
|
if (queued.size()) {
|
|
if (queued.size()) {
|
|
String old = playback.assigned;
|
|
String old = playback.assigned;
|
|
play(queued.front()->get());
|
|
play(queued.front()->get());
|
|
String new_name = playback.assigned;
|
|
String new_name = playback.assigned;
|
|
queued.pop_front();
|
|
queued.pop_front();
|
|
- end_notify = false;
|
|
|
|
- emit_signal(SceneStringNames::get_singleton()->animation_changed, old, new_name);
|
|
|
|
|
|
+ if (end_notify)
|
|
|
|
+ emit_signal(SceneStringNames::get_singleton()->animation_changed, old, new_name);
|
|
} else {
|
|
} else {
|
|
//stop();
|
|
//stop();
|
|
playing = false;
|
|
playing = false;
|
|
_set_process(false);
|
|
_set_process(false);
|
|
- end_notify = false;
|
|
|
|
- emit_signal(SceneStringNames::get_singleton()->finished);
|
|
|
|
|
|
+ if (end_notify)
|
|
|
|
+ emit_signal(SceneStringNames::get_singleton()->finished);
|
|
}
|
|
}
|
|
|
|
+ end_reached = false;
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -953,7 +957,7 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
|
|
c.current.speed_scale = p_custom_scale;
|
|
c.current.speed_scale = p_custom_scale;
|
|
c.assigned = p_name;
|
|
c.assigned = p_name;
|
|
|
|
|
|
- if (!end_notify)
|
|
|
|
|
|
+ if (!end_reached)
|
|
queued.clear();
|
|
queued.clear();
|
|
_set_process(true); // always process when starting an animation
|
|
_set_process(true); // always process when starting an animation
|
|
playing = true;
|
|
playing = true;
|
|
@@ -1291,7 +1295,7 @@ AnimationPlayer::AnimationPlayer() {
|
|
cache_update_size = 0;
|
|
cache_update_size = 0;
|
|
cache_update_prop_size = 0;
|
|
cache_update_prop_size = 0;
|
|
speed_scale = 1;
|
|
speed_scale = 1;
|
|
- end_notify = false;
|
|
|
|
|
|
+ end_reached = false;
|
|
animation_process_mode = ANIMATION_PROCESS_IDLE;
|
|
animation_process_mode = ANIMATION_PROCESS_IDLE;
|
|
processing = false;
|
|
processing = false;
|
|
default_blend_time = 0;
|
|
default_blend_time = 0;
|