Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Animation Timeline Go to Next Step / Prev Step which triggered wrong animation display #83399

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions editor/plugins/animation_player_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,9 +1262,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value, bool p_set, bool

if (!p_timeline_only) {
if (player->is_valid() && !p_set) {
double delta = player->get_current_animation_position();
Copy link
Author

@VansonLeung VansonLeung Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular line of code is actually not returning a delta but rather the actual current position. It will make player->seek(pos + delta, true, true); totally wrong. So I removed it as well.

player->seek(pos, true, true);
player->seek(pos + delta, true, true);
Copy link
Author

@VansonLeung VansonLeung Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular line of code caused the animation display to jump elsewhere of the actual pos, so I removed it.

Copy link
Member

@TokageItLab TokageItLab Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is equivalent to the following:

	if (!p_timeline_only) {
		if (player->is_valid() && !p_set) {
			double delta = player->get_current_animation_position();
			player->seek(pos, true, true);
			player->seek(pos + delta, true, true);
		} else {
			if (player->is_playing()) {
				player->stop();
			}
			player->seek(pos, true, true);
		}
	}

	if (!p_timeline_only) {
		player->seek(pos, true, true);
	}

I can't recall anymore why it was necessary in the past to handle drags and seek by key separately, but I think this change probably fine (you just need to rewrite the code as suggested, also p_set argument should be removed if there is never problem). @SaracenOne Do you have any idea?

} else {
player->stop();
player->seek(pos, true, true);
Expand Down
Loading