Bug 438341 - Animation Transform Mask: Cancelling new key between two others & wrong value at zoom level.
Summary: Animation Transform Mask: Cancelling new key between two others & wrong value...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Animation (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Eoin O'Neill
URL:
Keywords: release_blocker
Depends on:
Blocks:
 
Reported: 2021-06-09 17:27 UTC by grum999
Modified: 2021-06-19 15:21 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Interpolation in curves graph according to current zoom (710.69 KB, video/webm)
2021-06-16 19:08 UTC, grum999
Details
CTRL+Z crash (782.48 KB, video/webm)
2021-06-16 19:19 UTC, grum999
Details

Note You need to log in before you can comment on or make changes to this bug.
Description grum999 2021-06-09 17:27:50 UTC
SUMMARY

More detailed information on krita-artist.org
https://krita-artists.org/t/krita-5-animation-curves-applied-to-transform-mask/24895/1#animation-curves-transform-mask-new-keyframe-between-2-keyframes-kbdescapekbd-5


STEPS TO REPRODUCE
1. Create a paint layer with a rectangle
2. Add a transform mask on paint layer
3. Create some keyframes in animation curves
4. Start to navigate between keyframe
5. Select “Transform tool”
6. Click on layer


OBSERVED RESULT
(A) A new keyframe is created, but it’s sometime created with wrong values.


(B) The reflex is to press Escape
==> Result is worst; I suspect that, in a non animated transformation mask the escape key reset all transformations.


(C) So now, I don’t want this keyframes.
The reflex is not to delete ALL key point for curves, but it’s to do CTRL+Z
The cancel action doesn’t work: it will undo what has been made before this action. New keyframe stay in place


EXPECTED RESULT

(A) When transform tool is selected, if a new keyframe is created, to should always be created with the right interpolation values
(B) When Escape key is pressed in an animation curve, I think reset should reset to current interpolation values
(C) Undo action when a keyframe has been created in this workflow is to undo keyframe creation


SOFTWARE/OS VERSIONS
Linux appimage krita-5.0.0-prealpha-dba5ce5-x86_64.appimage

Grum999
Comment 1 Eoin O'Neill 2021-06-15 22:16:10 UTC
Yeah, this was an oversight on how we were doing keyframe creation for transform masks originally. I've redone the code for dealing with undo / redo. It isn't perfect, but it should allow for properly undoing and canceling keyframe additions when double tapping escape.

Note that you do have to double tap escape -- this is because the first press intentionally resets all transforms to identity. Tapping again will then cancel the transform, and undo any keyframe additions or changes that occurred. 

There's still room to improve this workflow, and I intend to do so later, but for Krita 5 it is simply nice to have the undo working as expected. :)
Comment 2 Eoin O'Neill 2021-06-15 22:23:09 UTC
Should note, I haven't pushed this code yet. I want to make sure it doesn't break any nightly builds (since we have more users who are depending on nightly atm.)

Once I verify I can build it on my docker instance, I will push it up and this bug will be closed. :)
Comment 3 Eoin O'Neill 2021-06-15 23:23:06 UTC
Git commit a01eb1b65cd3f195fc191653d9e21e06160b7b7f by Eoin O'Neill.
Committed on 15/06/2021 at 23:22.
Pushed by eoinoneill into branch 'master'.

AnimatedTransformMask: Fix undo / redo operations when keys are added using inplace transform.

Keyframes weren't properly cleaned up after transform operations due to where and how we were
adding keyframes. We should now have proper undo / redo support for keyframes created with this
method. Additionally, pressing escape twice to exit / cancel inplace transform stroke will
now properly undo any keyframe additions or replacements that occured, reverting keyframe
data back to intended values.

M  +83   -1    plugins/tools/tool_transform2/kis_animated_transform_parameters.cpp
M  +2    -1    plugins/tools/tool_transform2/kis_animated_transform_parameters.h
M  +11   -3    plugins/tools/tool_transform2/kis_modify_transform_mask_command.cpp
M  +5    -0    plugins/tools/tool_transform2/kis_modify_transform_mask_command.h
M  +8    -1    plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp

https://invent.kde.org/graphics/krita/commit/a01eb1b65cd3f195fc191653d9e21e06160b7b7f
Comment 4 grum999 2021-06-16 19:08:10 UTC
Created attachment 139408 [details]
Interpolation in curves graph according to current zoom

Just tested last appimage (krita-5.0.0-prealpha-949e869-x86_64.appimage)
I think the commit is available in build version.


(A) For new created keyframe, interpolation is sometime OK, sometime KO.
The weird thing is, it seems to be related to canvas zoom:
- If zoom >= 50%, interpolation is correct
- If zoom <50%, interpolation is not correct
(cf. attached video)

(B) Twice press on ESCAPE key reset the situation
    . unselect transform tool
    . remove created keyframes

Grum999
Comment 5 grum999 2021-06-16 19:19:50 UTC
Created attachment 139409 [details]
CTRL+Z crash

Another problem


1. Create a new interpolated keyframe by selection transform tool

2. validate it by Enter

3. Reclick on layer with transform tool
   => key frame disappear from curves graph

4. Press ESCAPE twice
   => keyframe is not available anymore

5. Do CTRL+Z
   => Krita crash with a segmentation fault


Note: in step 3, if you try to work with transform tool (rotation, move), graphical result is weird: only tool shape is visible, there's no bitmap preview (not in attached video)

Grum999
Comment 6 grum999 2021-06-16 19:21:07 UTC
Due to tests made on last on last appimage version, I reopen bug.

Don't know if it's better to reopen or create 2 new bugs?


Grum999
Comment 7 Emmet O'Neill 2021-06-17 01:16:36 UTC
Hey again Grumm, I've confirmed the strange bug with the wrong values occurring when zoomed out beyond 50%. That's the bug that we'll cover in this report.

Any other bugs/crashes that come up please file separate reports so we can keep things organized. :)
Comment 8 Eoin O'Neill 2021-06-17 02:17:30 UTC
This likely has to do with the LOD values being used as keyframe values instead of non-lod'd values.

We may need to split up assigning keyframe values from actual transformation requests.
Comment 9 grum999 2021-06-17 11:29:32 UTC
(In reply to Emmet O'Neill from comment #7)
> Any other bugs/crashes that come up please file separate reports so we can
> keep things organized. :)

Ok, I'll try to do it tonight.

Grum999
Comment 10 Eoin O'Neill 2021-06-18 00:33:27 UTC
Git commit b6430315d6a23f6c83bb38ed495fe145a65f7171 by Eoin O'Neill.
Committed on 18/06/2021 at 00:33.
Pushed by eoinoneill into branch 'master'.

Transform Animation: Further refinement to keyframe addition / value setting.

Setting the keyframes is now split into it's own command and queued appropriately.
When setting keyframe data, we account for any LOD scaling that has occured so that
values never appear to be "incorrect" on the timeline.

M  +8    -6    plugins/tools/tool_transform2/kis_modify_transform_mask_command.cpp
M  +5    -0    plugins/tools/tool_transform2/kis_modify_transform_mask_command.h
M  +24   -6    plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp
M  +15   -3    plugins/tools/tool_transform2/tests/test_animated_transform_parameters.cpp

https://invent.kde.org/graphics/krita/commit/b6430315d6a23f6c83bb38ed495fe145a65f7171
Comment 11 grum999 2021-06-18 19:46:38 UTC
(In reply to Emmet O'Neill from comment #7)
> Any other bugs/crashes that come up please file separate reports so we can
> keep things organized. :)

Done
https://bugs.kde.org/show_bug.cgi?id=438887

Grum999
Comment 12 grum999 2021-06-19 15:21:46 UTC
(In reply to Eoin O'Neill from comment #10)
> Git commit b6430315d6a23f6c83bb38ed495fe145a65f7171 by Eoin O'Neill.
> Committed on 18/06/2021 at 00:33.
> Pushed by eoinoneill into branch 'master'.
I confirm it's working now :) 


Grum999