RSS/Atom feed Twitter
Site is read-only, email is disabled

Toggle Visibility of two layers

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

8 of 8 messages available
Toggle history

Please log in to manage your subscriptions.

Toggle Visibility of two layers SegDaltonico 23 May 10:33
  Toggle Visibility of two layers programmer_ceds 23 May 21:13
   Toggle Visibility of two layers SegDaltonico 24 May 10:44
    Toggle Visibility of two layers SegDaltonico 24 May 10:50
     Toggle Visibility of two layers programmer_ceds 24 May 14:00
      Toggle Visibility of two layers Ofnuts 25 May 08:52
     Toggle Visibility of two layers programmer_ceds 25 May 20:45
    Toggle Visibility of two layers programmer_ceds 24 May 13:51
2017-05-23 10:33:30 UTC (over 7 years ago)
postings
3

Toggle Visibility of two layers

Hi Everyone,

I've been struggling with this for a couple of days and have had no success finding a practical solution. What I want to do is toggle the visibility of two layers (out of three total) with a single keystroke. The reason is that for my work I need to rapidly toggle the visibilty of both layers while quickly editing one of the layers. I've already tried a few things:

1) Layer groups. This seemed promising, but in practice it slows things down way too much. I can group the two layers together and toggle the visibilty of them both with a hotkey, but the issue is I have to have the whole group selected to do so. So, in order to quickly edit something in one layer, I have to click one of the layers in the sidebar, make the edit, then go back and select the group to regain the ability to rapidly toggle visibility of both layers. I'm constantly going back and forth between editing a layer and toggling visibility way too much for this to be practical.

2) Linking layers. I thought maybe linking the two layes would allow me to have only one layer selected for editing while being able to toggle both layers. Not the case - too bad.

3) A script. I was reading elsewhere that this could potentially be solved with a script that toggles the visibilty of both layers, perhaps triggered by a keystroke. I'm really not familiar enough with GIMP to do this. This could be a potential solution, so if anyone has any advice on how to do this, that would be amazing.

If anyone knows of any other solution to this, I would be sooo happy. Thanks for any help in advance.

Best, SegDaltonico

2017-05-23 21:13:55 UTC (over 7 years ago)
postings
121

Toggle Visibility of two layers

Try the attached script - put it in your personal scripts folder - search the internet for where this folder is depending on the operating system you use.

I have only tested the script quickly so if you find any problems let me know.

The script should appear in the Layer menu as Toggle Top Layers Visibility

I was going to make it toggle the visibility of the specified number of top layers based on the visibility of the top layer but have made it more flexible by inverting their visible flags on a layer by layer basis. Set the visibility of the layers to one of the desired set-ups to start with then use the script.

If you aren't using any other scripts then pressing Ctrl F (at least on Windows) will repeat the script and toggle the states of the layers.

You can also select the layer that will be active when the top layer is visible and the layer that will be active when it is invisible

Hope this helps

Hi Everyone,

I've been struggling with this for a couple of days and have had no success finding a practical solution. What I want to do is toggle the visibility of two layers (out of three total) with a single keystroke. The reason is that for my work I need to rapidly toggle the visibilty of both layers while quickly editing one of the layers. I've already tried a few things:

1) Layer groups. This seemed promising, but in practice it slows things down way too much. I can group the two layers together and toggle the visibilty of them both with a hotkey, but the issue is I have to have the whole group selected to do so. So, in order to quickly edit something in one layer, I have to click one of the layers in the sidebar, make the edit, then go back and select the group to regain the ability to rapidly toggle visibility of both layers. I'm constantly going back and forth between editing a layer and toggling visibility way too much for this to be practical.

2) Linking layers. I thought maybe linking the two layes would allow me to have only one layer selected for editing while being able to toggle both layers. Not the case - too bad.

3) A script. I was reading elsewhere that this could potentially be solved with a script that toggles the visibilty of both layers, perhaps triggered by a keystroke. I'm really not familiar enough with GIMP to do this. This could be a potential solution, so if anyone has any advice on how to do this, that would be amazing.

If anyone knows of any other solution to this, I would be sooo happy. Thanks for any help in advance.

Best, SegDaltonico

2017-05-24 10:44:18 UTC (over 7 years ago)
postings
3

Toggle Visibility of two layers

This is perfect. I really can't thank you enough - you've saved me an incredible amount of time. Is there a way I can look at the script you wrote? Is it written in python? I have some minor programming experience with C++ would like to make some headway towards being able to do stuff like this myself.

Thanks again, SegDaltonico

Try the attached script - put it in your personal scripts folder - search the internet for where this folder is depending on the operating system you use.

I have only tested the script quickly so if you find any problems let me know.

The script should appear in the Layer menu as Toggle Top Layers Visibility

I was going to make it toggle the visibility of the specified number of top layers based on the visibility of the top layer but have made it more flexible by inverting their visible flags on a layer by layer basis. Set the visibility of the layers to one of the desired set-ups to start with then use the script.

If you aren't using any other scripts then pressing Ctrl F (at least on Windows) will repeat the script and toggle the states of the layers.

You can also select the layer that will be active when the top layer is visible and the layer that will be active when it is invisible

Hope this helps

2017-05-24 10:50:23 UTC (over 7 years ago)
postings
3

Toggle Visibility of two layers

Also, one other feature for this would make it even better: the option to also select which tool is selected upon toggling.

You've already made something better than I could have asked for, but if you could add this it'd be perfection.

2017-05-24 13:51:43 UTC (over 7 years ago)
postings
121

Toggle Visibility of two layers

Pleased that the script is useful.

.scm files are human readable using a text editor so it's easy to look at the script. Let me know if you make any improvements.

This is perfect. I really can't thank you enough - you've saved me an incredible amount of time.
Is there a way I can look at the script you wrote? Is it written in python? I have some minor programming experience with C++ would like to make some headway towards being able to do stuff like this myself.

Thanks again, SegDaltonico

2017-05-24 14:00:29 UTC (over 7 years ago)
postings
121

Toggle Visibility of two layers

I can't see a way of selecting the current tool. If I'm wrong and there is a function call for this and (ideally) an enumeration of the tools for a drop-down selection box then it would be possible. You would have to consider the settings of the selected tools - what if you wanted (for example) the pencil with one radius for when the top layer is visible and a different radius when the top layer isn't visible?

I previously noted that you can use Ctrl-F to repeat the script if you are using no other scripts - you can of course assign any script to a keyboard short-cut if you need to use other scripts between calls of the layer toggling script.

Also, one other feature for this would make it even better: the option to also select which tool is selected upon toggling.

You've already made something better than I could have asked for, but if you could add this it'd be perfection.

Ofnuts
2017-05-25 08:52:30 UTC (over 7 years ago)

Toggle Visibility of two layers

On 05/24/17 16:00, programmer_ceds wrote:

I can't see a way of selecting the current tool. If I'm wrong and there is a function call for this and (ideally) an enumeration of the tools for a drop-down selection box then it would be possible.

There is none. AFAIK it's a conscious design decision to not let scripts and plugins interfere wit the UI.

2017-05-25 20:45:40 UTC (over 7 years ago)
postings
121

Toggle Visibility of two layers

Also, one other feature for this would make it even better: the option to also select which tool is selected upon toggling.

You've already made something better than I could have asked for, but if you could add this it'd be perfection.

Your best option is probably to assign a single keypress to the visibility toggling function (using Edit/Keyboard Shortcuts) and use the appropriate short-cut keys (as shown in the menus) to activate the tool that you want.