Bug 372677 - Perspective transform loses entire layer content for full document layers
Summary: Perspective transform loses entire layer content for full document layers
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Transform (show other bugs)
Version: 3.1 Beta
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-19 18:10 UTC by Andy Statia
Modified: 2016-12-09 17:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Statia 2016-11-19 18:10:15 UTC
When using the perspective transform tool on a full page document layer, the layer content vanishes when a handle is dragged.  If one presses Enter to accept the transform, it gets stuck at 33%.  It can be worked around by first using a normal scaling transform, apply it (no size change needed), then use the perspective transform, which then works.

1. Create a new document
2. Fill the layer with a colour and paint on the top layer a bit
3. Select the transform tool
4. Switch to the perspective transform mode
5. Click on the layer to see the handles
6. Drag one of the corner handles
7. The layer will now vanish, along with the handles and outline
8. Press Enter to accept the transform
9. Note that the transformation progress on the layer gets stuck at 33%

Workaround:
Steps 1-3 normally
4. Select the scale transform
5. Click the layer to see the handles
6. Press Enter to apply this transform (no handles need to be moved)
7. Switch to the perspective transform
8. Click the layer to see the handles
9. Drag the handles and transform in perspective as expected
10. Press Enter to apply the transform, it will complete properly.

A video demonstration of this bug can be found here:

https://www.youtube.com/watch?v=HVJrdqR-6M4
Comment 1 elkmug 2016-11-20 00:33:54 UTC
I can reproduce this bug with Krita 3.0.93 on Win 7 64bit,
but the described fix doesn't work for me.

Alternate workaround:
Do steps 1-5 normally
6. Re position the whole transform, a small amount, WITHOUT touching the handles
7. Then use the handles to adjust as desired
8. Press Enter to apply the transform
Comment 2 Andy Statia 2016-11-20 04:58:27 UTC
(In reply to elkmug from comment #1)
> I can reproduce this bug with Krita 3.0.93 on Win 7 64bit,
> but the described fix doesn't work for me.
> 
> Alternate workaround:
> Do steps 1-5 normally
> 6. Re position the whole transform, a small amount, WITHOUT touching the
> handles
> 7. Then use the handles to adjust as desired
> 8. Press Enter to apply the transform

For step 6 here, repositioning isn't needed, just getting to see the handles with the scale transform (first one), then press Enter to accept it.  It should apply the transform and the handles disappear.  Then click the layer again to bring back the handles, choose the perspective mode, then try dragging a handle.  At this point it should work.  This is demonstrated at 1:14 in the YouTube video.  You can listen in the audio for the Enter key being pressed to apply the transform.

What was done in the video at 1:14 is:

1. Transform tool selected
2. Click middle of layer (this causes the handles to display)
3. Scale transform mode is active (first transform mode)
4. Press Enter, transform is applied and handles vanish
5. Switch to perspective transform (second transform mode)
6. Click middle of layer (this causes the handles to display)
7. Drag top-left handle
8. Layer transforms in perspective properly

In your steps, I think you are just missing the "Enter" press to apply the transform at least once before trying to use the perspective transform.  At least one transform process must be applied before the perspective mode will work.
Comment 3 Halla Rempt 2016-11-21 10:09:56 UTC
Does this also happen when you disable opengl?
Comment 4 Andy Statia 2016-11-21 16:22:42 UTC
(In reply to Boudewijn Rempt from comment #3)
> Does this also happen when you disable opengl?

Yes, when tested, the layer still vanishes when OpenGL is disabled.  (In settings Display -> OpenGL checkbox)
Comment 5 Halla Rempt 2016-12-07 14:42:37 UTC
I've also managed to reproduce it now.
Comment 6 Dmitry Kazakov 2016-12-09 17:58:20 UTC
Git commit 15888ba4f919e73af7d3add983ed6113e8de4f7a by Dmitry Kazakov.
Committed on 09/12/2016 at 17:58.
Pushed by dkazakov into branch 'krita/3.1'.

Fix a NaN transformation when using 4-point perspective transform

It appeared that my matrix decomposition could not decompose an
identity matrix :( Well, we need to implement a better one, e.g.
from CSS. For now just avoid division by zero.

Most probably, the problem appeared after introduction of cursor
snapping. Before snapping identity matrix was almost impossible
to get with a mouse cursor.
Ref T4840

M  +28   -15   plugins/tools/tool_transform2/kis_perspective_transform_strategy.cpp

https://commits.kde.org/krita/15888ba4f919e73af7d3add983ed6113e8de4f7a
Comment 7 Dmitry Kazakov 2016-12-09 17:58:37 UTC
Git commit 050f8354c1506af25e501153e11551699d63cd20 by Dmitry Kazakov.
Committed on 09/12/2016 at 17:58.
Pushed by dkazakov into branch 'rempt/impex-refactoring'.

Fix a NaN transformation when using 4-point perspective transform

It appeared that my matrix decomposition could not decompose an
identity matrix :( Well, we need to implement a better one, e.g.
from CSS. For now just avoid division by zero.

Most probably, the problem appeared after introduction of cursor
snapping. Before snapping identity matrix was almost impossible
to get with a mouse cursor.
Ref T4840

M  +28   -15   plugins/tools/tool_transform2/kis_perspective_transform_strategy.cpp

https://commits.kde.org/krita/050f8354c1506af25e501153e11551699d63cd20