Bug 437468 - You can't move a layer using a transform mask + Move Tool
Summary: You can't move a layer using a transform mask + Move Tool
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: 4.4.3
Platform: Mint (Ubuntu based) Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-05-21 15:26 UTC by Tiar
Modified: 2021-05-26 13:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Test image (115.06 KB, application/x-krita)
2021-05-21 15:26 UTC, Tiar
Details
Test image - transform mask moved with a Move Tool in versions when it worked (508.92 KB, application/x-krita)
2021-05-21 15:27 UTC, Tiar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tiar 2021-05-21 15:26:23 UTC
Created attachment 138652 [details]
Test image

SUMMARY
If you add a transform mask to a clone layer or a paint layer, and you try to use a Move Tool on it, you can see the boundary move, but the content doesn't move.


STEPS TO REPRODUCE
1. Create two new paint layers with content, and create a new clone layer for one of them.
2. Attach a transform mask to the paint layer that is not cloned (to not disturb the test) and to the clone layer.
3. Try to use Move Tool on both of them.

OBSERVED RESULT
The boundary seems to be moving, but the content doesn't.
Note: If you load a file with already moved transform mask (made in an earlier version, when Move Tool still worked), it is displayed correctly. However further moves are, again, unsuccessful.


EXPECTED RESULT
The content moves, the same way it moves if you use Transform Tool and move it.


NOTES
It worked in versions before 4.4.3.
In Krita around 4.4.2 or 4.4.1, there was a behavioural change that the boundary was as big as the whole canvas instead of just of the size of the content, but it still worked.
On master (4d2b6e06cd) it also doesn't work.

I attached both a test image and the same test image but with moved transform masks in an earlier version.


SOFTWARE/OS VERSIONS
Krita

 Version: 4.4.3
 Languages: pl, pl_PL, pl
 Hidpi: true

Qt

  Version (compiled): 5.12.9
  Version (loaded): 5.12.9

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 5.4.0-58-generic
  Pretty Productname: Linux Mint 20.1
  Product Type: linuxmint
  Product Version: 20.1
  Desktop: X-Cinnamon
Comment 1 Tiar 2021-05-21 15:27:27 UTC
Created attachment 138653 [details]
Test image - transform mask moved with a Move Tool in versions when it worked
Comment 2 Ahab Greybeard 2021-05-21 16:19:13 UTC
I can confirm the behaviour as described for the 4.4.1, 4.4.2, 4.4.3 and May 20 5.0.0-prealpha (git 4d2b6eo) appimages on Debian 10.
Comment 3 Tiar 2021-05-21 17:03:07 UTC
@Ahab - do I understand correctly that you confirm that it works in 4.4.1 and 4.4.2 (but maybe with a weird boundary), but it doesn't work in 4.4.3 and on master (which is what I've experienced), or are you saying that it is broken in all the versions you tested?
Comment 4 Ahab Greybeard 2021-05-21 21:16:26 UTC
I'm confirming your descriptions of the behaviour for the various versions.

Works in 4.4.1 and 4.4.2 apart from the extended boundary (sometimes off the canvas).
Does not work in 4.4.3 and the latest nightly.

It seems that the Move action is not registered and stored in the Transform mask but the Transform mask is interpreted properly if it does contain a Move action.
Comment 5 Dmitry Kazakov 2021-05-25 05:14:03 UTC
Hi, Tiar and Ahab!

I have a bit of a problem with this bug. This behavioral change was somewhat intentional. Now, when you move a transform mask with the move tool, you move the mask itself over a layer, not the layer itself. Basically, you move it like a lens over a piece of newspaper.

That does not look very obvious when the mask is set up in affine mode (translate/scale/rotation), but if you switch it into a perspective mode (or cage or mesh) you will see the difference.

Here is a video illustrating the behavior:
https://disk.yandex.ru/i/LDZRL-ggakOxDg

I'm not sure what is the best solution to that actually. Theoretically, I can refactor the Move tool back and make it modify the translational part of the transform instead. But it sounds as a weird idea, because it would duplicate the transform tool.

What is your opinion on that?
Comment 6 Ahab Greybeard 2021-05-25 09:43:38 UTC
Hi Dmitry,
I've always thought of the Move Tool as a limited subset of the Transform Tool (though I realise they may be implemented in very different ways).
So it doesn't seem weird to me that using a Move Tool on a newly created Transform Mask will result in a translation transform.

However, if there is now the ability to actually perform a Move operation on an existing non-affine Transform Mask then that could lead to UX complications.

I think this needs a forum discussion where options can be discussed and decided on.
Comment 7 Dmitry Kazakov 2021-05-26 13:00:45 UTC
Git commit 63f14477cffd34143d8d12d4d2023345b6291cce by Dmitry Kazakov.
Committed on 26/05/2021 at 13:00.
Pushed by dkazakov into branch 'master'.

Implement changing of Transform Masks with Move Tool

Now there is a special code-path in the move tool to handle
transform masks properly. The main problem we face here is
double transformation when the layer is moved recursively with
all its masks.

M  +2    -1    libs/command/kis_command_ids.h
M  +1    -0    libs/image/CMakeLists.txt
A  +55   -0    libs/image/commands_new/KisSimpleModifyTransformMaskCommand.cpp     [License: GPL(v2.0+)]
A  +37   -0    libs/image/commands_new/KisSimpleModifyTransformMaskCommand.h     [License: GPL(v2.0+)]
M  +10   -0    libs/image/kis_liquify_transform_worker.cpp
M  +1    -0    libs/image/kis_liquify_transform_worker.h
M  +2    -2    libs/image/kis_transform_mask.cpp
M  +6    -1    libs/image/kis_transform_mask_params_interface.cpp
M  +4    -2    libs/image/kis_transform_mask_params_interface.h
M  +20   -0    libs/image/kis_types.h
M  +3    -28   libs/image/processing/kis_transform_processing_visitor.cpp
M  +53   -12   libs/ui/tool/strokes/move_stroke_strategy.cpp
M  +10   -0    libs/ui/tool/strokes/move_stroke_strategy.h
M  +2    -2    plugins/tools/tool_transform2/kis_animated_transform_parameters.cpp
M  +1    -1    plugins/tools/tool_transform2/kis_animated_transform_parameters.h
M  +7    -2    plugins/tools/tool_transform2/kis_transform_mask_adapter.cpp
M  +3    -1    plugins/tools/tool_transform2/kis_transform_mask_adapter.h
M  +19   -1    plugins/tools/tool_transform2/tool_transform_args.cc
M  +2    -1    plugins/tools/tool_transform2/tool_transform_args.h

https://invent.kde.org/graphics/krita/commit/63f14477cffd34143d8d12d4d2023345b6291cce