Animation: add a couple actions to set full clip start and end time based on current position

Authored by scottpetrovic on May 2 2018, 1:44 PM.


Group Reviewers
Maniphest Tasks
T8652: Krita 4.1.4 Release Task

This patch adds the ability to set the full clip start time and end time from the context menu. The result will be seen in the animation docker.

This mostly came about as I was working on an animation and frequently needed to change the end time. when making animations longer or adjusting the timings, changing the end time is pretty common. Other applications such as Blender and OpenToonz also have this so I think it is not a new concept.

Test Plan

Clicked the options and watched the animation docker update. it is currently the last 2 options in the current frame context menu. The data is saved in the animation model data, so I think I have all the data in sync.

Diff Detail

R37 Krita
Lint Skipped
Unit Tests Skipped
scottpetrovic requested review of this revision.May 2 2018, 1:44 PM
scottpetrovic created this revision.
dkazakov requested changes to this revision.May 4 2018, 4:27 PM

Hi, @scottpetrovic!

The patch is generally fine, I like the idea of auto-updating the the clip range. There are two small issues that should be fixed before pushing this to master:

  1. [codewise] Can you connect Animation Docker directly to the image's animation interface instead of forwarding the signal via the animation player? (see my comments inline)
  1. [uix] There is a UIX problem when the user tries to use the feature when multiple frames are selected. The point it, for user's convenience we do not "select" a frame on right-click when there is a multiple selection. It is done intentionally to avoid accidental resetting of the manually crafted selection of the user. It leads to an unexpected behavior in such a case: please check this video with the bug:

I would propose the following solution: when multiple frames are selected, hide your two actions and show another one "Update Playback Range", which would reset both the limits in one go, by looking for the minimum and maximum selected columns. You can fetch the needed min/max metrics using TimelineFramesView::calculateSelectionMetrics().


Please avoid debugging line in the final patch :)


Why this code is needed? The animation player restarts itself automatically by connecting to the corresponding signal to slotUpdatePlaybackTimer()

Or you try to update the animation docker via the player?


Is it possible to connect the docker directly to the image? Then the image play a role of "model" and the docker will play a role of "view" in model/view architecture. I don't fully understand why this forwarding via the animation player is needed.

This revision now requires changes to proceed.May 4 2018, 4:27 PM

thanks for the review @dkazakov

I think I got everything done with this. I removed the unnecessary function in the animation player so the docker talks directly to the animation interface.

I also added the set playback range functionality. That is a good idea. I also enabled the actions based on if there is a selection or not.

dkazakov accepted this revision.May 10 2018, 4:36 PM

The patch looks and works fine now! Please push!

I would also propose hiding range-related context menu actions, when they are disabled. It would save a bit of space (I guess they are not too hot-used (my subjective opinion, I might be wrong)). But it is up to you to decide :)

This revision is now accepted and ready to land.May 10 2018, 4:36 PM
This comment was removed by scottpetrovic.

Changes pushed out. If one frame is selected, only the options to set the start and end time exists. If multiple frames are selected, only the update playtime range action is shown.