godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add easier way to scale keyframes in AnimationPlayer Editor #3532

Open mrkdji opened 3 years ago

mrkdji commented 3 years ago

Describe the project you are working on

I'm making a cutscene with the AnimationPlayer.

Describe the problem or limitation you are having in your project

The current way to scale keyframes in AnimationPlayer editor is cumbersome

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Scale a selection of animation player keyframes by clicking Left Mouse Button on one of the selection extremities and eventually by holding a mouse modifier (for instance ALT).

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

It would be nice if the AnimationPlayer editor keyframes could be scaled like the notes in REAPER's MIDI editor

scale_notes

If this enhancement will not be used often, can it be worked around with a few lines of script?

I'm not sure.

Is there a reason why this should be core and not an add-on in the asset library?

AnimationPlayer editor is core.

vyshliy commented 2 years ago

I completely agree. This feature will greatly speed up the creation and editing of animations. Same as mirroring selected frames.

Calinou commented 2 years ago

@vyshliy Please don't bump issues without contributing significant new information. Use the :+1: reaction button on the first post instead.

vyshliy commented 2 years ago

To be more specific. Blender has a convenient implementation of the proposed feature in terms of usability.

https://user-images.githubusercontent.com/72736632/150934711-acd9cf6e-64d4-4dbb-b3bd-4d6bba9b2486.mp4

https://user-images.githubusercontent.com/72736632/150934741-5f444be6-14f7-410e-a33d-91b654b16570.mp4

hsandt commented 1 year ago

Unity also has a nice way to represent this with vertical blue bars around the selected frames:

image

Source: https://docs.unity3d.com/Manual/animeditor-AdvancedKeySelectionAndManipulation.html

It is also used to move groups of keys (which Godot already supports, but instead of starting mouse drag from a specific key, you can start with the mouse cursor anywhere inside the selection box).

Note the final section about Ripple editing, a feature that allows to push non-selected keys while performing the Move or Scale operation. Certainly something we'll have to think of when implementing the Scale (and why not also Move, so we improve the existing one).

viksl commented 5 months ago

So how exactly should this work? We could use hold button on frame and move around for scaling, we could also instead use S just like in Blender?

Keep in mind that this feature will also be used for bezier curve editor.

Personally I think S + just moving the mouse around and keeping the cursor captured for the editor window + wrapping would be fine. It would make it easier to use the wrap (since you don't need to hold the mouse button while moving the mouse around) and it feels a bit simpler to then lock the axis to X/Y in the bezier editor (just like in Blender) and use some numbers to move around (for example S + X + -1 to flip the keys.

Scaling towards what? Currently my suggestion is to always use the playhead as the reference. This means if playhead is at the first frame in the selection then the scaling scales around the played thus the first frame never moves, if it's at the end frame then the end frame stays at its position, and so on.

I'd like to see some specific info at this point, please. Come conclusion would be cool to have here ;).

hsandt commented 4 months ago

Just saw this other proposal to extend animation duration via mouse drag (https://github.com/godotengine/godot-proposals/issues/10030) and it occurred to me that we may also want to allow stretching keyframes beyond the max duration, automatically extending the animation duration accordingly.

phantomdesvin commented 3 months ago

As an animator I'm personally used to how it works in most animation programs I've work with, where you just select some keyframes, hold ALT and LeftClick on the first or the last keyframe and drag. The point of reference is the other extreme of the selection (if you clicked on the last keyframe of the selection, the reference would be the first keyframe of the selection, so that first keyframe would mantain it's position in the timeline).

In practice, animators never scale from any point other than the start or the end of the selection because it would be a bad practice to risk interfering with previous and next keyframes at the same time and I can't see a reason to do that, so I wouldn't sacrifice the simplicity of this common workflow to accomodate that option, that can be achieved just scaling from one extreme first and then dragging the selection to the side. But if there is actually some reason to scale from center (please let me know), ALT+Shift + LClick could be a way to scale from center.

Moving/scaling keyframes beyond the max duration of the animation is common practice in animation programs, but automatically extending the animation duration accordingly is not, and I can see that being undesirable in some cases and, if that other proposal about time is implemented, it should already be quick and easy to modify when actually needed.