Bug 402070

Summary: Merging layers removes not active local selections
Product: [Applications] krita Reporter: Rebecca Breu <rebecca>
Component: Layer StackAssignee: Tiar <tamtamy.tymona>
Status: RESOLVED FIXED    
Severity: normal CC: freebox64, tamtamy.tymona
Priority: NOR    
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Screenshot of my layers before and after merging

Description Rebecca Breu 2018-12-12 20:07:27 UTC
Created attachment 116883 [details]
Screenshot of my layers before and after merging

SUMMARY

Merging a layer down onto a layer that has several local selections will remove all but the active local selection. Tested on nightly build 6dc2f8a (Dec 11) and 1519ff6 (Nov 17).  

STEPS TO REPRODUCE
1. Have two layers, the lower one with 3 local selection masks, the upper one with none. 
2. Merge upper layer down.

OBSERVED RESULT

The remaining lower layer will lose all of its selection masks—unless you had one selection mask active, in which case the active selection mask is the only one remaining. See attached screenshot.

EXPECTED RESULT

I keep all the selection masks.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian Stable with Gnome
Qt Version: 5.7.1
Comment 1 mvowada 2018-12-12 21:16:48 UTC
(4.2.0-pre-alpha (git 95b09ea) - Ubuntu 14.04)

I can confirm that only the "active" local selections will be kept (the remaining will be discarded). Steps:

    1. create 2 layers,
    2. add to each layer local selections
    3. deactivate all the local selections
    4. merge the 2 layers

Actual Results: local selections will disappear
Expected Results: keep the active and not active local selections, regardless.
Comment 2 Tiar 2019-06-20 21:13:17 UTC
Git commit 8cd5fbb73bdb0ca6d7610c5071fe7803e81906aa by Agata Cacko.
Committed on 20/06/2019 at 21:08.
Pushed by tymond into branch 'master'.

Fix merging layers with not active selection masks

Before this commit, there was an assumption in the merging code
that a layer can have only one selection mask (which can be
gathered using ->selectionMask() function). This caused all non-active
selection mask to disappear during/after the merging.
This commit fixes that behaviour by taking all children of the merged
layer that happen to be KisSelectionMasks into account.

Note: it doesn't mean all of the selection masks will be preserved;
for now only the immediate child nodes of the selected layers are
considered.

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

https://invent.kde.org/kde/krita/commit/8cd5fbb73bdb0ca6d7610c5071fe7803e81906aa
Comment 3 Halla Rempt 2019-06-24 08:21:44 UTC
Git commit e2d14a35d9474fd9f4b219123b46ac1ec2b9bf90 by Boudewijn Rempt, on behalf of Agata Cacko.
Committed on 24/06/2019 at 08:20.
Pushed by rempt into branch 'krita/4.2'.

Fix merging layers with not active selection masks

Before this commit, there was an assumption in the merging code
that a layer can have only one selection mask (which can be
gathered using ->selectionMask() function). This caused all non-active
selection mask to disappear during/after the merging.
This commit fixes that behaviour by taking all children of the merged
layer that happen to be KisSelectionMasks into account.

Note: it doesn't mean all of the selection masks will be preserved;
for now only the immediate child nodes of the selected layers are
considered.

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

https://invent.kde.org/kde/krita/commit/e2d14a35d9474fd9f4b219123b46ac1ec2b9bf90