Toggle Visibility of two layers

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Toggle Visibility of two layers

rich2005
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

--
SegDaltonico (via www.gimpusers.com/forums)
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Toggle Visibility of two layers

rich2005
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

Attachments:
* http://www.gimpusers.com/system/attachments/589/original/ToggleLayersVisibility.scm

--
programmer_ceds (via www.gimpusers.com/forums)
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Toggle Visibility of two layers

rich2005
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

--
SegDaltonico (via www.gimpusers.com/forums)
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Toggle Visibility of two layers

rich2005
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.

--
SegDaltonico (via www.gimpusers.com/forums)
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Toggle Visibility of two layers

rich2005
In reply to this post by rich2005
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

--
programmer_ceds (via www.gimpusers.com/forums)
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Toggle Visibility of two layers

rich2005
In reply to this post by rich2005
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.

--
programmer_ceds (via www.gimpusers.com/forums)
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Toggle Visibility of two layers

Ofnuts-2
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.
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Toggle Visibility of two layers

rich2005
In reply to this post by rich2005
>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.

--
programmer_ceds (via www.gimpusers.com/forums)
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Loading...