After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 759601 - Add/Remove layer masks by clicking the layer preview
Add/Remove layer masks by clicking the layer preview
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: User Interface
git master
Other All
: Normal enhancement
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2015-12-17 16:32 UTC by Ben
Modified: 2016-08-25 23:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Alternate proposal to add layer masks via ctrl-click of layer image in the dock. (19.71 KB, patch)
2015-12-17 16:32 UTC, Ben
none Details | Review
Alternate proposal for adding layers masks through ctrl-click of image (19.44 KB, patch)
2015-12-17 16:59 UTC, Ben
none Details | Review
Update to fix to prevent saving the default on exit. (19.42 KB, patch)
2015-12-19 16:31 UTC, Ben
none Details | Review
Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock. (25.60 KB, patch)
2016-01-31 15:08 UTC, Ben
none Details | Review
Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock. 2016-01-31 (28.08 KB, patch)
2016-01-31 18:28 UTC, Ben
none Details | Review
Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock. Updated 2016-03-11 defaults to white mask. (28.12 KB, patch)
2016-03-11 12:57 UTC, Ben
none Details | Review
Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock. Updated 2016-04-18. (28.23 KB, patch)
2016-04-18 12:36 UTC, Ben
none Details | Review
Removed empty mc.orig file inadvertently added in the last patch. (28.15 KB, patch)
2016-05-01 10:35 UTC, Ben
none Details | Review
Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock. Updated for clean patching latest git 2016-04-24. (28.10 KB, patch)
2016-05-24 11:27 UTC, Ben
needs-work Details | Review
Add remove masks with dock button or through ctrl-shift-click or select mask dialog through ctrl-alt-click (30.62 KB, patch)
2016-08-03 13:32 UTC, Ben
none Details | Review

Description Ben 2015-12-17 16:32:07 UTC
Created attachment 317582 [details] [review]
Alternate proposal to add layer masks via ctrl-click of layer image in the dock.

Alternate patch proposal to add layer masks via ctrl-click of layer image in the dock. Also adds a preference dialog entry to select the default behavior when ctrl-clicking to add a layer mask.
Comment 1 Ben 2015-12-17 16:59:11 UTC
Created attachment 317584 [details] [review]
Alternate proposal for adding layers masks through ctrl-click of image

same as previous patch but reverts one type change back to static which got added inadvertently in the last one.
Comment 2 Ben 2015-12-19 00:35:46 UTC
This theme is basically the opposite/inverted color scheme of the dark one btw :)
Comment 3 Ben 2015-12-19 14:37:36 UTC
Oops! sorry wrong bug report.
Comment 4 Ben 2015-12-19 16:31:03 UTC
Created attachment 317671 [details] [review]
Update to fix to prevent saving the default on exit.
Comment 5 BugsBunny 2015-12-31 00:57:58 UTC
+1
Comment 6 Ben 2015-12-31 01:04:37 UTC
Made a video to show off how much faster using ctrl-click to add or remove a layer mask for any given layer and how to set a default type or use of the dialog instead. Video is here https://youtu.be/WYyiRFKvYBg
Comment 7 Michael Natterer 2016-01-04 18:19:59 UTC
Ok I think I should comment on this...

We have a gazillion requests to persistently remember various dialog
defaults. Adding them all to prefs is not a solution, we have too
many preferences already.

Also, we should not use Ctrl for this, we will need this for future
multiple selection on the layer tree.

What about this:

Alt-click -> Add/Remove layer mask with dialog
Alt-shift-click -> Add/Remove layer mask with last defaults from dialog

Sidenote: all attached patches break abstraction by including
actions/ and dialogs/ stuff from widgets/, and there is an
enum for these 0, 1, 2 cases.
Comment 8 Ben 2016-01-07 11:21:21 UTC
(In reply to Michael Natterer from comment #7)
> Ok I think I should comment on this...
> 
> We have a gazillion requests to persistently remember various dialog
> defaults. Adding them all to prefs is not a solution, we have too
> many preferences already.
> 
I guess that's one point where we disagree, i prefer to have as much control as possible and i like to have the ability to choose. 

I could add it to an existing tab in prefs as an expander option instead to make it less obvious though. Any suggestion to which would be better?

> Also, we should not use Ctrl for this, we will need this for future
> multiple selection on the layer tree.
> 
> What about this:
> 
> Alt-click -> Add/Remove layer mask with dialog
> Alt-shift-click -> Add/Remove layer mask with last defaults from dialog
> 

Alt-click is the default window grab action for Ubutnu so thats not the best idea. Alt-click doesn't interfere with anything as long as its done only on the image, the mechanism stays the same for everything else.

> Sidenote: all attached patches break abstraction by including
> actions/ and dialogs/ stuff from widgets/, and there is an
> enum for these 0, 1, 2 cases.

Not sure what you mean, i didn't find any way to make it work by calling it through the actions mechanism. Which is why i did it this way.
Comment 9 Ben 2016-01-31 15:08:18 UTC
Created attachment 320129 [details] [review]
Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock.
Comment 10 Ben 2016-01-31 18:28:46 UTC
Created attachment 320141 [details] [review]
Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock. 2016-01-31
Comment 11 Ben 2016-03-11 12:57:15 UTC
Created attachment 323698 [details] [review]
Patch to enable adding layer masks through ctrl-shift-click  on layer image in layer dock. Updated 2016-03-11 defaults to white mask.
Comment 12 Ben 2016-03-13 10:48:25 UTC
(In reply to Michael Natterer from comment #7)
> Ok I think I should comment on this...
> 
> We have a gazillion requests to persistently remember various dialog
> defaults. Adding them all to prefs is not a solution, we have too
> many preferences already.
> 
> Also, we should not use Ctrl for this, we will need this for future
> multiple selection on the layer tree.
> 
> What about this:
> 
> Alt-click -> Add/Remove layer mask with dialog
> Alt-shift-click -> Add/Remove layer mask with last defaults from dialog
> 
> Sidenote: all attached patches break abstraction by including
> actions/ and dialogs/ stuff from widgets/, and there is an
> enum for these 0, 1, 2 cases.

I've modified the patch accordingly.
Comment 13 Ben 2016-04-18 12:36:27 UTC
Created attachment 326248 [details] [review]
Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock. Updated 2016-04-18.

Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock. Updated 2016-04-18 fixed to apply cleanly for latest master branch.
Comment 14 Ben 2016-05-01 10:35:01 UTC
Created attachment 327107 [details] [review]
Removed empty mc.orig file inadvertently added in the last patch.
Comment 15 Michael Natterer 2016-05-01 14:36:20 UTC
Ben, can you obsolete the outdated patches?
Comment 16 Ben 2016-05-01 15:18:12 UTC
Done
Comment 17 Ben 2016-05-24 11:27:32 UTC
Created attachment 328430 [details] [review]
Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock. Updated for clean patching latest git 2016-04-24.

Patch to enable adding layer masks through ctrl-shift-click on layer image in layer dock. Updated for clean patching latest git 2016-04-24. Hopefully people are using it seeing as it isn't going to get committed (after 6 months of updates).
Comment 18 BugsBunny 2016-05-24 11:51:06 UTC
Why hasn't this been committed yet? Clearly Ben is willing to maintain it. Seeing how this has been (mis)handled is not encouraging for new contributors.
Comment 19 Ben 2016-05-24 12:50:32 UTC
(In reply to BugsBunny from comment #18)
> Why hasn't this been committed yet? Clearly Ben is willing to maintain it.
> Seeing how this has been (mis)handled is not encouraging for new
> contributors.

BugsBunny: This is likely my last update, from i've seen in the last 6 months GIMP seems to suffer from a "not invented here syndrome". People seem refractory to power users and Photoshop refugees (sometimes with reason but often not). I suspect i was only humored because of the theme work (patches and theme files) i did. Oh well live and learn.
Comment 20 Michael Natterer 2016-05-24 13:49:44 UTC
Sorry I suck at reviewing this... Will do soon.
Comment 21 Michael Schumacher 2016-05-24 15:03:17 UTC
(In reply to BugsBunny from comment #18)
> Why hasn't this been committed yet? Clearly Ben is willing to maintain it.
> Seeing how this has been (mis)handled is not encouraging for new
> contributors.

The most recent patch had been added on 2016-05-01. People who think that this is still too long are welcome to help with the reviewing/testing to speed this up.
Comment 22 Michael Schumacher 2016-05-26 13:13:21 UTC
Related: bug 623594
Comment 23 Michael Schumacher 2016-06-14 12:43:11 UTC
Did anyone check if any of the actions described in bug bug 623594 conflict here?
Comment 24 Michael Natterer 2016-06-14 22:00:41 UTC
I've been looking at the patch several times now. Ben, could you come
to IRC in order to discuss it? What you wrote in comment 19 is the wrong
impression.
Comment 25 Ben 2016-07-14 11:56:21 UTC
I haven't had the time to hangout on IRC waiting for people to show up, as for the patch i'm rather tired of debating it, it's already been changed to use actions and i switched it from ctrl-click to ctrl-alt-click. The preference item has to stay to make it useful. I don't get what the issue is with it considering what it does, besides it's already strayed far from what i originally wanted and is about as far as i'm willing to change it which was to have a button entry in the dock. I think i've bent over backwards on this issue, no more.
Comment 26 Michael Natterer 2016-07-14 12:42:08 UTC
I've thought about an approach to bring dialog defaults to preferences
in a more general manner, fixing this and many other issues at the same
time. I hoped to discuss it with you, if you are still interested...
Comment 27 Ben 2016-07-17 12:25:40 UTC
I'll try and make time for it some time this week'ish.
Comment 28 Ben 2016-08-02 10:37:57 UTC
(In reply to Michael Natterer from comment #26)
> I've thought about an approach to bring dialog defaults to preferences
> in a more general manner, fixing this and many other issues at the same
> time. I hoped to discuss it with you, if you are still interested...

I tried showing up 7 times on irc in the last two weeks and you either weren't there or not responding, so i'm done with that. How about you just email it to me and we'll go from there.
Comment 29 Michael Schumacher 2016-08-02 12:01:29 UTC
Did you join the #gimp channel on irc.gimp.org and ask there? I'm asking because I don't see any activity besides three joins in the logs, so if you said anything, it might not have come through.
Comment 30 Ben 2016-08-02 13:40:08 UTC
Sigh.

Yes the same one i was using when i did the themes, on the same account. I don't care what the logs say i was there 7 times and i even tried to send him a direct message to no avail. This is getting really tiresome and annoying.
Comment 31 Michael Schumacher 2016-08-02 13:55:32 UTC
Ah, I'm pretty sure mitch meant to discuss this on the channel, at least I'm pretty sure he didn't intend to do this in a direct IRC message.

Also, this would have had the side-effect of other people noticing that you have been there.
Comment 32 Michael Natterer 2016-08-02 22:58:56 UTC
Also, I was pretty much AFK for almost two weeks because of shitload
of other work to do. I did see your direct message a day later or so.
Comment 33 Ben 2016-08-03 11:42:10 UTC
That may be but its the same litany since January. I'm done discussing this, and this patch.
Comment 34 Ben 2016-08-03 13:32:53 UTC
Created attachment 332622 [details] [review]
Add remove masks with dock button or through ctrl-shift-click or select mask dialog through ctrl-alt-click

This is the patch i've really wanted since the beginning, i know it'll never happen but someone else may find it useful. 

This lets you add/remove masks to a layer with a dock button or through ctrl-shift-click or select mask dialog through ctrl-alt-click.
Comment 35 Michael Natterer 2016-08-20 22:19:42 UTC
While applying the latest patch, I realized that this is somewhat
the same as skipping the "new layer" and other dialogs with shift.
See bug 159832.

It's also related to dialog defaults which we currently keep in static
variables all around the code.
See bug 599573.
Comment 36 Michael Natterer 2016-08-23 17:31:49 UTC
Finally, sorry for the waiting, and for the massive changes to the patch :)

commit 0b7381a8223f1a02e1c1c0b9e7609544d82e8fce
Author: Benoit Touchette <draekko.software+gimp@gmail.com>
Date:   Tue Aug 23 19:18:20 2016 +0200

    Bug 759601 - Add/Remove layer masks by clicking the layer preview
    
    Quite heavily modified by Mitch to address the more general issues
    mentioned in comment 35 of the bug:
    
    - Remember the added mask's type and the invert boolean in
      GimpDialogConfig
    - Add new prefs page "Dialog Defaults" which will contain
      only stuff from GimpDialogConfig and can be reset separately
    - Remove static mask variables from layers-commands.c and
      use the new config values for both interactive mask adding
      with the dialog, and for the shortcut based method
    - Add a button to the layers dialog which supports add, add
      with last values, delete, apply
    - Add modifier-click shortcuts on the layer preview with the
      same modifiers as on the button

 app/actions/layers-actions.c     |  22 +++++++++-
 app/actions/layers-commands.c    | 134 +++++++++++++++++++++++++++++++++++++++-----------------
 app/actions/layers-commands.h    |   2 +
 app/config/gimpdialogconfig.c    |  41 ++++++++++++++---
 app/config/gimpdialogconfig.h    |   2 +
 app/config/gimprc-blurbs.h       |   6 +++
 app/dialogs/preferences-dialog.c |  45 +++++++++++++++++--
 app/widgets/gimphelp-ids.h       |   1 +
 app/widgets/gimplayertreeview.c  |  68 +++++++++++++++++++++++-----
 9 files changed, 260 insertions(+), 61 deletions(-)
Comment 37 josephbupe 2016-08-23 18:43:49 UTC
Hi,

If the button can work as a toggle button to add a mask when a layer is selected, and to remove the mask when a layer's mask is selected, then there would be no worry of the perceived conflict between using ctrl+click for this feature and the planned multi-selection of layers.
Comment 38 Michael Natterer 2016-08-24 00:04:11 UTC
The button doesn't have this problem anyway, only the layer preview
clicks. Also, the toggle button would have to distinguish between
delete mask and apply mask too.
Comment 39 josephbupe 2016-08-24 05:20:34 UTC
(In reply to Michael Natterer from comment #38)
the toggle button would have to distinguish between
> delete mask and apply mask too.

Yes.
Comment 40 josephbupe 2016-08-24 08:58:51 UTC
Hi,

In Photoshop, Shift + click (used for multi-selection of layers) is also used to hide/reveal a layer mask.

http://www.designeasy.co/2011/05/photoshop-layer-mask-keyboard-shortcuts.html

FYI
Comment 41 Ben 2016-08-24 09:45:39 UTC
@Micheal good to know i haven't had the chance to test it, spent yesterday day in the hospital with chest pains. Depending on how i feel to day i might give it a go and see how it works.
Comment 42 josephbupe 2016-08-25 07:46:44 UTC
Hi,

It would be better if clicking the button could straight away add a layer mask with full opacity (as by Shift+layer click), while Shift+button click should open the dialog. 

Intelligently, if the target layer has an active selection, the mask should be initialized from the selection.

IMO, accessing the pop-up dialog of options should be optional. 

Similarly, adding a new layer should be optional since 99.9% of new layers added are expected to be transparent. Note that Ctrl+Shift+button click also adds a new layer with previous value/fill.
Comment 43 Ben 2016-08-25 10:49:01 UTC
@Michael Found enough energy to give the new code a try and that isn't what i needed or intended, the dialog is totally annoying when clicking on the button and wasn't what i wanted to have there, the whole point of the patch is to do away with the dialog to streamline adding layers. Also its totally not obvious where to enable the shift click for a new user and its seems to be disabled by default. I'm really disappointed with this new code.
Comment 44 Ben 2016-08-25 10:55:08 UTC
After some trial and error i discovered that ctrl-click abd shift-click remove and add a layer, i find that annoying. I think having the same key to add and remove would be better and feels more consistent with other software. Also you only have to remember 1 key. Also i just noticed the alt-click which did bring up the dialog is gone. I would rather have the dialog on shift-click and the ctrl-click use the default layer add value. And doing away with the dialog on the button would be great. At least offer the option for that in the dialog pereference so users can choose.
Comment 45 Ben 2016-08-25 11:05:40 UTC
@Michael Appreciate the effort but it kind of falls short.
Comment 46 josephbupe 2016-08-25 12:26:06 UTC
(In reply to Ben from comment #44)
> I would rather have the
> dialog on shift-click and the ctrl-click use the default layer add value.
> And doing away with the dialog on the button would be great. At least offer
> the option for that in the dialog pereference so users can choose.


I strongly concur with Ben's proposal.
Comment 47 Ben 2016-08-25 12:29:03 UTC
@Michael: still recovering from my issue on tuesday will try to find the energy to make a patch proposal.
Comment 48 Michael Natterer 2016-08-25 16:54:23 UTC
I hope you get better soon.

I patched it up that way so it's consistent with other buttons

click -> dialog
shift-click -> last values

The issue of swapping click and shift-click has been raised a couple
of times, but any patch would have to maintain consistency across all
such dialogs.
Comment 49 josephbupe 2016-08-25 17:23:33 UTC
(In reply to Michael Natterer from comment #48)

> The issue of swapping click and shift-click has been raised a couple of times, 

What is the problem swapping them?


> but any patch would have to maintain consistency across all such dialogs.

Which other dialogs? As of now, I only know of two which are invoked with the button click:

1. Add new layer
2. Add layer mask


Please, not to say GIMP should behave or look like other similar apps, but a few things should be simpler like JUST DO IT.
Comment 50 Ben 2016-08-25 17:26:52 UTC
@Michael Can we at least have the choice whether or not to have the dialog for the mask button? At least that would be a fair compromise, just needs an extra checkbox for the dialog preferences for this item to toggle it on/off and switch between that and just applying the default mask as the alternate.
Comment 51 Ben 2016-08-25 17:33:28 UTC
@Michael thanks and if i code it up would consider it at least.
Comment 52 Michael Natterer 2016-08-25 17:52:32 UTC
Sadly, it's much more than those two. I am annoyed by frequent dialogs too,
here is the (maybe incomplete) list:

- add layer
- add layer mask
- add channel
- add path
- selection to path
- stroke path
- stroke selection
Comment 53 Ben 2016-08-25 17:54:53 UTC
(In reply to Michael Natterer from comment #52)
> Sadly, it's much more than those two. I am annoyed by frequent dialogs too,
> here is the (maybe incomplete) list:
> 
> - add layer
> - add layer mask
> - add channel
> - add path
> - selection to path
> - stroke path
> - stroke selection

Indeed but i only have energy right now to deal with one, this one since its what we're discussing.
Comment 54 josephbupe 2016-08-25 18:08:40 UTC
How does work well in Photoshop and Krita with easy?
Comment 55 Ben 2016-08-25 23:16:14 UTC
@Michael i created a new bug/patch report to continue with this.