Bug 415788 - Transform mask cause file layer to jump all over workplace
Summary: Transform mask cause file layer to jump all over workplace
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Transform (other bugs)
Version First Reported In: 4.2.8
Platform: Microsoft Windows Microsoft Windows
: NOR major
Target Milestone: ---
Assignee: vanyossi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-02 02:07 UTC by Jakub Niedźwiedź
Modified: 2021-05-21 12:14 UTC (History)
4 users (show)

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


Attachments
.kra files for move testing -A (429.99 KB, application/zip)
2020-01-06 16:46 UTC, Ahab Greybeard
Details
Shows centre-pivot of transform moved (4.04 KB, image/png)
2020-01-10 11:08 UTC, Ahab Greybeard
Details
Shows centre-pivot of transform moved off-canvas (2.92 KB, image/png)
2020-01-10 11:20 UTC, Ahab Greybeard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Niedźwiedź 2020-01-02 02:07:43 UTC
SUMMARY
Using transform mask on file layer cause unpredictable behavior when trying to move this file layer.

Video of this bug:
https://www.youtube.com/watch?v=BSKIVdFnPsE

STEPS TO REPRODUCE
1. Add file layer
2. Add transform mask to file layer
3. Try to move file layer


SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION
I think it might be caused by krita trying to move both file layer and mask.
Comment 1 Halla Rempt 2020-01-03 13:47:11 UTC
Could you share the file(s) with us? I'm not exactly sure what's up here and would need to check myself.
Comment 2 Ahab Greybeard 2020-01-03 16:08:24 UTC
This happens in all versions from 4.2.6 onwards in the Linux appimages and the Windows portable .zip packages running on Windows 10.

It's best observed with a single paint layer with a transform mask on it.
I suggest a filled rectangle on the paint layer and a simple 45 degree rotation transform mask for intial investigation.
(If you use a mild perspective transform, there is severe distortion of the moving object and some large artifacts are created.)

It happens when you use the Move tool on the paint layer with Instant Preview Mode enabled.
(If Instant Preview Mode is disabled, the moves happen normally but there is break up of the paint layer object during the move as may be expected.)

On my Linux system, it only happens for images that are greater than 1191 pixels in either side. Below that size, the move behaves well. (This number may be particular to my system, I don't know.)
Above that size, there is an immediate offset of the paint layer object that persists throughout the movement.
When the move is finalised, by Return, the object goes to where it should be and leaves an artifact copy on the canvas at the offset position.
If you don't finalise the move, then the object goes to where it should be after a 4 second wait, leaving an artifact behind.

The artifact can be removed by turning the background layer off then on again.

On Windows 10, there is an image size limit but it's different and I haven't tracked down the exact value.
For large images (2048 x 2048) it's the same as on Linux.
For small images (1024 x 1024), it can behave strangely with horizontal cursor movement giving vertical object movement and vice-versa but this is not consistent.

After repeated moving around on a small image Windows session, I had a crash that did not leave a record in the crash log.

Setting to Confirmed
Comment 3 Jakub Niedźwiedź 2020-01-05 22:54:17 UTC
(In reply to Boudewijn Rempt from comment #1)
> Could you share the file(s) with us? I'm not exactly sure what's up here and
> would need to check myself.

https://drive.google.com/drive/folders/1wFoSboBlRk95-JQHpitrgEZs9qX_uKrD?usp=sharing

"main file.kra" is the file where you can see this "jumping". Just try to move layer imported from file with Move Tool.
Comment 4 Ahab Greybeard 2020-01-06 16:46:08 UTC
Created attachment 124935 [details]
.kra files for move testing -A

This is interesting but not in a good way:

Re. My Comment 2:
I noticed this as soon as I started trying moving a paint layer with a transform mask and I became so engrossed with investigating it that I forgot that you were using a file layer.
It may be that I've seen a different bug which needs a fresh bug report or a different aspect of the same bug. I'll rely on the developers to give advice and direction on that matter.
(Also, my observation: "... horizontal cursor movement giving vertical object movement and vice-versa ..." was due to mistakenly moving the transform layer, as I figured out recently.)

Re. The files in Comment 3:
Using 4.2.8 on Linux and Windows 10, both the 'normal' and the 'weird' squares behave in the same way in that they slide away from the cursor when being moved. It's not a 'jumping' behaviour, unlike that which I've noted in my initial comment.

I've tried to replicate this behaviour with a file layer and I simply can't, on Linux or Windows with 4.2.8.
I attach a simple .kra file with a file layer with a transform mask on it, so can you open this and say if you see how it behaves for you?

As you can see, I use a rotation transform so what kind of transform are you using?
Comment 5 Jakub Niedźwiedź 2020-01-07 17:33:21 UTC
(In reply to Ahab Greybeard from comment #4)
> Created attachment 124935 [details]
> .kra files for move testing -A
> 
> This is interesting but not in a good way:
> 
> Re. My Comment 2:
> I noticed this as soon as I started trying moving a paint layer with a
> transform mask and I became so engrossed with investigating it that I forgot
> that you were using a file layer.
> It may be that I've seen a different bug which needs a fresh bug report or a
> different aspect of the same bug. I'll rely on the developers to give advice
> and direction on that matter.
> (Also, my observation: "... horizontal cursor movement giving vertical
> object movement and vice-versa ..." was due to mistakenly moving the
> transform layer, as I figured out recently.)
> 
> Re. The files in Comment 3:
> Using 4.2.8 on Linux and Windows 10, both the 'normal' and the 'weird'
> squares behave in the same way in that they slide away from the cursor when
> being moved. It's not a 'jumping' behaviour, unlike that which I've noted in
> my initial comment.
> 
> I've tried to replicate this behaviour with a file layer and I simply can't,
> on Linux or Windows with 4.2.8.
> I attach a simple .kra file with a file layer with a transform mask on it,
> so can you open this and say if you see how it behaves for you?
> 
> As you can see, I use a rotation transform so what kind of transform are you
> using?

I used only rotation, but even without it there was double moving speed. Files that you sent work perfectly, but when I import "green64x64.kra" to "move-the -green-square.kra" myself it is still broken.

What is even worse, this behaviour is totally inconsistent - one time it just moves twice as fast, another time it jumps half of its height down. Sometimes it snaps back after file save, sometimes it leaves a path, like a frozen Windows XP window.

This is recording from your file:
https://www.youtube.com/watch?v=CJ8NdhBXfEQ&
Comment 6 Ahab Greybeard 2020-01-07 18:01:59 UTC
It's interesting that it behaves differently when it's you who makes the file layer, even in the same image document.

You've reported it and we've both provided descriptions and test results so I think that all we can do is leave it to the developers to figure it out.
Comment 7 Ahab Greybeard 2020-01-10 11:08:28 UTC
Created attachment 125010 [details]
Shows centre-pivot of transform moved
Comment 8 Ahab Greybeard 2020-01-10 11:20:41 UTC
Created attachment 125012 [details]
Shows centre-pivot of transform moved off-canvas

I have an additional observation as shown in the attached screenshots:

If you make a small vertical upwards movement of the (rotated) square, then the Transform mask shows the centre-pivot point has moved up and to the right as shown in centre-pivot-offset.png.
A further move to the bottom of the canvas sends the centre-pivot point lower and to the left, off-canvas as shown in centre-pivot-off-canvas.png.

There are similar movements of the vanishing points of a perspective transform if that is used. This causes distortion of the intended transform effects.

A transform mask doesn't actually have a 'mask', unlike a filter mask and (obviously) a transparency mask. A transform mask is applied to the entire layer. When you move a paint layer then any associated  filter mask or transparency mask moves with it.

To maintain the rotation transform properly on the object then the centre-pivot should be moved but this seems to be going wrong.
Comment 9 Dmitry Kazakov 2021-05-21 12:14:51 UTC
Hi, Jakub!

The bug has been fixed as part of the implementation of in-stack preview for the transform tool. Now using the move tool on a layer with a transform mask changes the mask, not the layer itself.