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

Improve usability of zooming in the animation editor #85142

Merged

Conversation

CookieBadger
Copy link
Contributor

@CookieBadger CookieBadger commented Nov 20, 2023

This PR seeks to improve the zoom usability in the AnimationPlayer editor, I would be happy to hear your feedback! Especially the changes I had to make to the header file is something that a more experienced pair of eyes should be laid on.

I added some code in the AnimationTrackEditor, such that zooming with the mouse zooms in on the current mouse position, whereas the zoom panner always zooms in on the center of the currently visible timeline, instead of zooming on the beginning in both cases.
This implementation comes as a result of the proposal #6204

I have never contributed before, so please bear with me :)

@AThousandShips AThousandShips requested a review from groud November 20, 2023 17:18
@AThousandShips AThousandShips added this to the 4.x milestone Nov 20, 2023
@AThousandShips AThousandShips removed the request for review from groud November 20, 2023 17:18
@CookieBadger CookieBadger force-pushed the animation-player-improvements branch from ceab9b5 to 3ad79d4 Compare November 21, 2023 17:46
@CookieBadger CookieBadger changed the title [WIP] Usablity improvements of Zooming in AnimationPlayer [WIP] Usability improvements of Zooming in AnimationPlayer Nov 21, 2023
@CookieBadger CookieBadger force-pushed the animation-player-improvements branch from 3ad79d4 to df8cc28 Compare November 22, 2023 13:52
@CookieBadger CookieBadger changed the title [WIP] Usability improvements of Zooming in AnimationPlayer Usability improvements of Zooming in AnimationPlayer Nov 22, 2023
@CookieBadger CookieBadger marked this pull request as ready for review November 22, 2023 13:53
@AThousandShips AThousandShips requested a review from a team November 22, 2023 14:11
@CookieBadger
Copy link
Contributor Author

Instead of always zooming in on the left side of the timeline, this is the way zooming behaves now:
AnimationPlayerZoom

Also works in the Bezier editor:
AnimationBezierZoom

@fire
Copy link
Member

fire commented Nov 22, 2023

I like it! @TokageItLab What do you think?

@CookieBadger CookieBadger force-pushed the animation-player-improvements branch from df8cc28 to 8ebe33a Compare November 22, 2023 17:30
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, there are some issues:

  • The zoom is slightly offset from the mouse cursor position (or the center when using the zoom bar). This seems to vary depending on the key column's size and the editor window width.
  • Editor scales above 100% further offset the zoom (see the second video). Perhaps some multiplying/dividing by EDSCALE needs to be done somewhere.

This has the potential to be a big productivity boost, so it's encouraging to see this being worked on nonetheless 🙂

100% editor scale

simplescreenrecorder-2023-11-22_22.36.55.mp4

200% editor scale

simplescreenrecorder-2023-11-22_22.39.45.mp4

@TokageItLab
Copy link
Member

TokageItLab commented Nov 22, 2023

I think it is a good way to go for improvement. I will test it as soon as some of the points already pointed out are fixed.

@CookieBadger CookieBadger force-pushed the animation-player-improvements branch from 8ebe33a to 2b85213 Compare November 27, 2023 21:09
@CookieBadger
Copy link
Contributor Author

Thank you for pointing the issues out, the zoomed timeline length was not calculated correctly. Should be fixed now!

@CookieBadger CookieBadger force-pushed the animation-player-improvements branch from 2b85213 to 00a5415 Compare November 27, 2023 21:18
@CookieBadger
Copy link
Contributor Author

@TokageItLab do you want to give it a try?

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally (rebased on top of master d76c1d0), it works as expected (tested at 100% and 150% scale factors).

@YuriSizov YuriSizov modified the milestones: 4.x, 4.3 Dec 13, 2023
Copy link
Member

@TokageItLab TokageItLab left a comment

Choose a reason for hiding this comment

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

When using the mouse wheel, it makes sense and works correctly based on the current cursor position. Nice work.

However, when using the slider in the lower right corner, the zoom should be based on the current position (e.g. Affter Effects bahave that). Especially when changing the zoom factor from small to large, I believe it is an odd behavior to have the end of the animation as the reference.

Current this PR:

sl1.mp4

FYI Affter Effects:

sl2.mp4

@CookieBadger
Copy link
Contributor Author

Thanks for the suggestion @TokageItLab , makes sense. Something that I don't like about AfterEffects' approach though is that the timeline view switches position such that the cursor is centered upon zooming (0:06 in the video). I think this is quite distracting/disturbing, and it would be more appropriate if the zoom focused on the cursor, but didn't make the timeline jump around, like this:
AnimationPlayerZoomFocusOnPosition

However then, an edge case that makes that approach problematic, is what to do if the cursor position is outside the currently displayed range. It might again be distracting or disturbing if it automatically switches to the middle, but with the current approach it is unclear what the zoom is actually focusing on.
AnimationPlayerZoomFocusOnPositionOutside

Alternatively, I could test for this case, and then just zoom on the middle of the timeline as before, but I'd like to know what you think.

@YuriSizov
Copy link
Contributor

I think if the cursor is not visible at the moment zooming into the middle makes sense.

@YuriSizov YuriSizov changed the title Usability improvements of Zooming in AnimationPlayer Usability improvements of zooming in the animation editor Dec 16, 2023
@YuriSizov YuriSizov changed the title Usability improvements of zooming in the animation editor Improve usability of zooming in the animation editor Dec 16, 2023
@CookieBadger
Copy link
Contributor Author

@TokageItLab would you like to see any other changes?

Copy link
Member

@TokageItLab TokageItLab left a comment

Choose a reason for hiding this comment

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

Now it seems to be working fine overall.

One concern is that the center appears to shake when zooming with the slider, so it would be nice if this could be removed, but it can be followed up later as another PR.

wiggled_current.mp4

editor/animation_track_editor.cpp Outdated Show resolved Hide resolved
@CookieBadger CookieBadger force-pushed the animation-player-improvements branch from ea591f3 to 5426769 Compare December 27, 2023 13:44
@CookieBadger
Copy link
Contributor Author

Fixed comment style, added #define constant, and added a tiny offset to prevent the wiggling that @TokageItLab mentioned. I think the PR is ready for merge now.

zoom_slider3.mp4

@CookieBadger CookieBadger force-pushed the animation-player-improvements branch from 5426769 to 26688c1 Compare December 27, 2023 14:58
@CookieBadger
Copy link
Contributor Author

any other requests? I'd be happy to finish this by the end of the year 😄

@akien-mga akien-mga requested a review from KoBeWi January 2, 2024 16:54
@@ -1239,6 +1239,59 @@ void AnimationMultiTrackKeyEdit::set_use_fps(bool p_enable) {
}

void AnimationTimelineEdit::_zoom_changed(double) {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the variables here be float? Most methods called here use float.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure. get_value() returns a double, and hscroll (derives Range) expects a double, so I thought I'd just do all calculations with doubles. Should I change everything to be a float instead?

@CookieBadger CookieBadger force-pushed the animation-player-improvements branch 2 times, most recently from ac81bbe to a720758 Compare January 6, 2024 23:54
@CookieBadger CookieBadger force-pushed the animation-player-improvements branch from a720758 to 5b3d5e0 Compare January 7, 2024 00:34
@akien-mga akien-mga merged commit a2bd7c3 into godotengine:master Jan 8, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

@CookieBadger
Copy link
Contributor Author

Thank you!! 😊

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

Successfully merging this pull request may close these issues.

8 participants