Bug 409944

Summary: Toggling 'Global Selection Mask' does not return to the originally selected layer
Product: [Applications] krita Reporter: jimbo <loudsquid>
Component: Tools/SelectionAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, ghevan, scottpetrovic
Priority: NOR    
Version: 4.2.3   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description jimbo 2019-07-18 10:41:15 UTC
STEPS TO REPRODUCE
1. Create a bunch of layers
2. Select the bottom layer
3. Enable Global Selection Mask
4. Disable Global Selection Mask

OBSERVED RESULT
The layer selection has changed from the bottom to the top

EXPECTED RESULT
The layer selection should return to the previously selected layer

SOFTWARE/OS VERSIONS
Windows 7 Professional x64

ADDITIONAL INFORMATION

It would be nice if when you enable the Global Selection Mask Krita would automatically switch to a brush (generally you want to add/remove the selection). Or if you had an option to choose what brush type you wanted to use in Global Selection Mask mode (sometimes I like to use the fill tool).

Not required at all, but would be nice.
Comment 1 vanyossi 2019-07-18 16:10:02 UTC
I think the "Show global selection" wasn't meant to be used like that when first implemented. However I can see it could be useful at least to quickly edit the mask and return to the original layer.

On the other hand, if enabling "Global Selection Mask" if you have a vector selection and the brush selected, it will change to the cursor tool. This is enabled only for brush tool as global selections can be modified with the other tools (pixel and vector selections), changing the tool automatically to be a brush would not work for all.
Comment 2 jimbo 2019-08-05 14:57:37 UTC
(In reply to vanyossi from comment #1)
> I think the "Show global selection" wasn't meant to be used like that when
> first implemented. However I can see it could be useful at least to quickly
> edit the mask and return to the original layer.

Huh, I always thought of it as a 'temporary' mask. Just another point, if you are grouping your layers together then it becomes more cumbersome as using the global selection mask will pull you out of the group too.
Comment 3 Scott Petrovic 2019-08-09 07:36:36 UTC
It is functioning like the bug reporter is stating. We will have to figure out if there is a way to save the last layer selected for that global selection so it knows when to change.
Comment 4 Dmitry Kazakov 2020-06-03 12:48:55 UTC
The main problem is: what should we do if the user selects another node while the mask is visible?

I guess the most sane solution is:

When the mask is requested to hide, it checks if the "active node" has been changed at least once since the mask was activated and

a) if the user hasn't change the active node, restores the previously active node
a) if the user changed the active node, then do nothing
Comment 5 Dmitry Kazakov 2020-06-04 20:47:40 UTC
Git commit bbd5ec7fdedd2da435a8f37802c0ff5e4b88605a by Dmitry Kazakov.
Committed on 04/06/2020 at 20:47.
Pushed by dkazakov into branch 'krita/4.3'.

Recover active node when the user toggles "Edit Global Selection"

When the mask is requested to hide, it checks if the "active node"
has been changed at least once since the mask was activated and

a) if the user hasn't change the active node, restores the
   previously active node
b) if the user changed the active node, then do nothing

M  +22   -1    plugins/dockers/layerdocker/LayerBox.cpp
M  +3    -0    plugins/dockers/layerdocker/LayerBox.h

https://invent.kde.org/graphics/krita/commit/bbd5ec7fdedd2da435a8f37802c0ff5e4b88605a
Comment 6 Dmitry Kazakov 2020-06-04 20:48:09 UTC
Git commit e801f946f024caaa4a293a89a25a3bebb78cbe84 by Dmitry Kazakov.
Committed on 04/06/2020 at 20:48.
Pushed by dkazakov into branch 'master'.

Recover active node when the user toggles "Edit Global Selection"

When the mask is requested to hide, it checks if the "active node"
has been changed at least once since the mask was activated and

a) if the user hasn't change the active node, restores the
   previously active node
b) if the user changed the active node, then do nothing

M  +22   -1    plugins/dockers/layerdocker/LayerBox.cpp
M  +3    -0    plugins/dockers/layerdocker/LayerBox.h

https://invent.kde.org/graphics/krita/commit/e801f946f024caaa4a293a89a25a3bebb78cbe84