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

Conversation

VansonLeung
Copy link

@VansonLeung VansonLeung commented Oct 15, 2023

[FIX] Fix by unifying the behaviours of mouse / command key triggering player->seek: Animation Timeline Go to Next Step / Prev Step is triggering the wrong player->seek

This fix is to tackle with the issue:

Expected result: animation goes smoothly

issue_2_expected_result.mp4

Actual result: animation jumps crazily

issue_3_crazy_movement.mp4
issue_4_backforth.mp4

For details, please refer to this issue item:

I am not sure if my fix will break any other thing though (e.g. the most recent onion-skinning capability revival, AnimationMixer). I need you to help me verify.

This fix has the following related merges as the most recent ones:
#80813
#80939

Bugsquad Edited:
Fixes #85129

@AThousandShips
Copy link
Member

Please make the title shorter, describe what it fixes not how it is being fixed :)

@AThousandShips AThousandShips modified the milestones: 3.x, 4.2 Oct 15, 2023
@AThousandShips AThousandShips requested a review from a team October 15, 2023 15:03
@VansonLeung VansonLeung changed the title [FIX] Fix by unifying the behaviours of mouse / command key triggering player->seek: Animation Timeline Go to Next Step / Prev Step is triggering the wrong player->seek Fix by unifying the behaviours of mouse / command key triggering player->seek Oct 15, 2023
@AThousandShips
Copy link
Member

Why does this pull request exists

Are you asking why you yourself opened a pull request?

@AThousandShips AThousandShips changed the title Fix by unifying the behaviours of mouse / command key triggering player->seek Fix mouse/command key triggering player->seek Oct 15, 2023
@VansonLeung VansonLeung changed the title Fix mouse/command key triggering player->seek Fix command key / shortcut to Animation Timeline Go to Next Step / Prev Step Oct 15, 2023
@VansonLeung
Copy link
Author

I polished the descriptions, thanks

@AThousandShips
Copy link
Member

I still can't make sense of what your title means

@VansonLeung VansonLeung changed the title Fix command key / shortcut to Animation Timeline Go to Next Step / Prev Step Fix Animation Timeline Go to Next Step / Prev Step which triggered wrong animation render Oct 15, 2023
@VansonLeung
Copy link
Author

VansonLeung commented Oct 15, 2023

I used the latest master build. When I used "Go to Next Step" or "Go to Previous Step" in the Animation Timeline Panel, the result is that the player seems to seek the wrong timeframe - i.e. wrong animation is displayed

@VansonLeung VansonLeung changed the title Fix Animation Timeline Go to Next Step / Prev Step which triggered wrong animation render Fix Animation Timeline Go to Next Step / Prev Step which triggered wrong animation display Oct 15, 2023
@TokageItLab
Copy link
Member

TokageItLab commented Oct 15, 2023

Perhaps the fundamental cause of this problem is related to #83197.

However, looking at how the processing is done afterwards by this PR, it may be a fine fix, but it makes the p_drag unnecessary so you should remove p_drag from the argument. After that we will have to test again.

Particular attention should be paid when testing to make sure that the audio track does not go haywire and that the animation playback track is properly sequenced.

@VansonLeung
Copy link
Author

VansonLeung commented Oct 16, 2023

Perhaps the fundamental cause of this problem is related to #83197.

However, looking at how the processing is done afterwards by this PR, it may be a fine fix, but it makes the p_drag unnecessary so you should remove p_drag from the argument. After that we will have to test again.

Particular attention should be paid when testing to make sure that the audio track does not go haywire and that the animation playback track is properly sequenced.

@TokageItLab

Upon your reminder I cross-checked the effect on audio animation track. I found another new issue when starting onion skinning while having put any audio into my animation track. The Godot commit I am using: [51f81e1]

This newly found issue is independent of my fixes - I will open a new issue for this by today, I am yet to investigate it or look further into the corresponding onion skinning codes.

cd.mp4

Edit: new issue #83426

@VansonLeung
Copy link
Author

@TokageItLab regardless of my newly found issue, here is the polished fix by omitting all "p_drag"

015b2af

@AThousandShips
Copy link
Member

I'm not sure the signal should be changed, it breaks compatibility and risks causing problems

@VansonLeung
Copy link
Author

VansonLeung commented Oct 16, 2023

I'm not sure the signal should be changed, it breaks compatibility and risks causing problems

I'm not sure the signal should be changed, it breaks compatibility and risks causing problems

I may revert the last commit to keep any backward compatibility albeit needing to keep "p_drag" intact.

For those signal changes, I will scan for any potential risks / problems and list here FYI @AThousandShips

@VansonLeung
Copy link
Author

VansonLeung commented Oct 16, 2023

image

The relevant codes can refer to as far as 2022 January.
For compatibility safety it is wise for me to remove my last commit attempting to omit "p_drag" from the function and signals.

I now even think it would be wiser for me to wait for AnimationMixer and Onion Skinning to become stable - before I test and merge / revamp this particular fix. I think my current fix is not good enough it may rather create confusions.

@AThousandShips @TokageItLab

@VansonLeung VansonLeung force-pushed the features/animation_fix_next_prev_step_wrong branch from 015b2af to 098d8f3 Compare October 16, 2023 13:04
@VansonLeung
Copy link
Author

I'm not sure the signal should be changed, it breaks compatibility and risks causing problems

@AThousandShips I have removed the breaking codes for now. I will look more deeply and conclude a better code solution to fix it.

@AThousandShips
Copy link
Member

No need to keep tagging me please :) it adds extra notifications and I'll still see the changes anyway

@VansonLeung VansonLeung force-pushed the features/animation_fix_next_prev_step_wrong branch from 098d8f3 to 84b44cd Compare October 16, 2023 13:48
@VansonLeung
Copy link
Author

VansonLeung commented Oct 16, 2023

OK, I just committed another approach that will also fix this issue. This approach should be less confusing. I tested with my mini-project fixed success, but I still need your verifications to see if it may break anything else.

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

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

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?

@@ -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

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.

@YuriSizov
Copy link
Contributor

Superseded by the linked PR. Thanks for your contribution nevertheless! Hope you can find something else for your first contribution 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants