Bug 437431

Summary: Clone Layer, when flattened to paint layer, is in an incorrect location
Product: [Applications] krita Reporter: Tiar <tamtamy.tymona>
Component: Layer StackAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: griffinvalley
Priority: NOR Keywords: triaged
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Tiar 2021-05-20 21:22:38 UTC
SUMMARY
If you create a Clone Array out of a paint layer and then flatten the layer, the result will be located in the original position instead of the position it was when cloned (because the Clone Layer has some embedded position information).

STEPS TO REPRODUCE
1. Draw a rectangle.
2. Go to Layer -> Split -> Clone Array. Use default settings, except that you want 10 columns and 1 row instead of 2 and 2.
3. Select the last rectangle (the one that is the most far away from the original). Right-click and select "Flatten layer".

OBSERVED RESULT
The rectangle disappeared; that's because it returned to the position of the original paint layer, instead of staying where it was.

EXPECTED RESULT
The rectangle stays where it was, and the projection of the whole document doesn't change.

NOTE
This is not a regression, or if it is, it's an old one because it doesn't work already in 4.1.7.

SOFTWARE/OS VERSIONS
Krita 4.1.7, 4.4.3 and master 4d2b6e06cd

Krita

 Version: 5.0.0-prealpha (git 4d2b6e0)
 Languages: pl, pl_PL, pl
 Hidpi: true

Qt

  Version (compiled): 5.12.8
  Version (loaded): 5.12.8

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 wolthera 2021-09-26 14:42:04 UTC
Git commit 0c28050ad586922819c66dfe94bc9b50b5c040d0 by Wolthera van Hövell tot Westerflier.
Committed on 26/09/2021 at 14:34.
Pushed by woltherav into branch 'krita/5.0'.

Reuse clone layer's own convert-to-paintlayer for the general one.

The clone layer has special considerations when converting to
paintlayer, so it makes sense to reuse that function when needed.

Amongst others, it'll ensure that the offset of the layer is correct.

M  +4    -1    libs/image/kis_layer_utils.cpp

https://invent.kde.org/graphics/krita/commit/0c28050ad586922819c66dfe94bc9b50b5c040d0
Comment 2 wolthera 2021-09-26 14:43:17 UTC
Git commit 3e23fc21f0e2f372189a952b5edca97149efdd06 by Wolthera van Hövell, on behalf of Wolthera van Hövell tot Westerflier.
Committed on 26/09/2021 at 14:43.
Pushed by woltherav into branch 'master'.

Reuse clone layer's own convert-to-paintlayer for the general one.

The clone layer has special considerations when converting to
paintlayer, so it makes sense to reuse that function when needed.

Amongst others, it'll ensure that the offset of the layer is correct.


(cherry picked from commit 0c28050ad586922819c66dfe94bc9b50b5c040d0)

M  +4    -1    libs/image/kis_layer_utils.cpp

https://invent.kde.org/graphics/krita/commit/3e23fc21f0e2f372189a952b5edca97149efdd06