Skip to main content
Participant
January 19, 2018
Question

Keep layer mask selected when swapping between layers???

  • January 19, 2018
  • 2 replies
  • 1081 views

Hi All,

I'm new to this forum, so I hope I don't break any rules!!!! I just have a question that has been bugging me for a while. I would like Photoshop to NOT default to the image layer when changing layers & returning to the layer i was on. To be specific if I'm on a layer that I'm masking & i swap to a different layer, when i return to my original layer it defaults to the image & not the mask. I would like this to stop as I'm constantly swapping layers & it's a complete pain to be always checking & re-selectin the mask. I'm using an old version CS4 but I'm hoping I can disable this somewhere!!!

Thanks in Advance )

    This topic has been closed for replies.

    2 replies

    Known Participant
    November 12, 2018

    https://i.imgur.com/pnSpOrA.mp4

    Maybe this video illustrates the issue better.

    While switching between layers with a keyboard shorcut "Alt+[", the layer mask is no longer being targeted.

    Participating Frequently
    January 10, 2024

    im haveing this same issue. when masking a smart object and then selecting another smart object layer with a mask i thought that it used to stay on the mask but now it swaps you back to the layer

    it used to ask you if you wanted to rasterize the layer and now it just auto creates a new layer.

    if im editing masks i want to stay editing masks...

     
    Stephen Marsh
    Community Expert
    Community Expert
    January 10, 2024

    It's possible to create a script to select the next forward or backward layer, assign a keyboard shortcut have the mask selected/toggled rather than the composite channel.

     

    // 'forwardEnum' or 'backwardEnum'
    activeDocument.suspendHistory("Select Layer...", "selectLayer('forwardEnum')"); 
    
    // TOGGLE LAYER OR MASK - courtesy of r-bin
    s2t = stringIDToTypeID;
    (r = new ActionReference()).putProperty(s2t('property'), p = s2t('hasUserMask'));
    r.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
    if (executeActionGet(r).getBoolean(p)) {
        (r = new ActionReference()).putProperty(s2t('property'), p = s2t('name'));
        (r = new ActionReference()).putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
        layerName = executeActionGet(r).getString(p);
        (r = new ActionReference()).putProperty(s2t('property'), p = s2t('channelName'));
        r.putEnumerated(s2t("channel"), s2t("ordinal"), s2t("targetEnum"));
        channelName = executeActionGet(r).getString(p);
        (r = new ActionReference()).putProperty(s2t('property'), p = s2t('alphaChannelOptions'));
        r.putEnumerated(s2t("channel"), s2t("ordinal"), s2t("targetEnum"));
        alphaChannel = executeActionGet(r).hasKey(p)
        if (channelName.indexOf(layerName) == 0 && !alphaChannel) {
            // var select = confirm('Layer mask selected\nSelect layer?') ? 'RGB' : null
            var select = 'RGB';
        } else {
            // var select = confirm('Layer selecter\nSelect mask?') ? 'mask' : null
            var select = 'mask';
        }
        if (select) {
            (r = new ActionReference()).putEnumerated(s2t("channel"), s2t("channel"), s2t(select));
            (d = new ActionDescriptor).putReference(s2t("null"), r);
            executeAction(s2t("select"), d, DialogModes.NO);
        }
    }
    // SELECT VISIBLE OR INVISIBLE LAYER
    function selectLayer(forwardORbackward) {
    	toggleShow();
    	function s2t(s) {
    		return app.stringIDToTypeID(s);
    	}
    	var descriptor = new ActionDescriptor();
    	var list = new ActionList();
    	var reference = new ActionReference();
    	reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t(forwardORbackward));
    	descriptor.putReference(s2t("null"), reference);
    	descriptor.putBoolean(s2t("makeVisible"), false);
    	list.putInteger(3);
    	descriptor.putList(s2t("layerID"), list);
    	executeAction(s2t("select"), descriptor, DialogModes.NO);
    	toggleShow();
    	function toggleShow() {
    		function s2t(s) {
    			return app.stringIDToTypeID(s);
    		}
    		var descriptor = new ActionDescriptor();
    		var list = new ActionList();
    		var reference = new ActionReference();
    		reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
    		list.putReference(reference);
    		descriptor.putList(s2t("null"), list);
    		descriptor.putBoolean(s2t("toggleOptionsPalette"), true);
    		executeAction(s2t("show"), descriptor, DialogModes.NO);
    	}
    }

     

    https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

     

    Alternatively, the Script Events Manager could be configured to automatically select/toggle the layer mask whenever a layer is selected, whether by mouse or keyboard shortcut.

    Trevor.Dennis
    Community Expert
    Community Expert
    January 19, 2018

    Hi Hamish, and welcome to the forum.  Don't worry too much about rules, just be sensible.

    I'm trying to pin down your workflow.  Do you know that regardless of what layer is selected, Ctrl clicking another layer's Eye icon will load it as a selection?  And that selection should remain active while you click to select other layers?  The same hold true of layer masks.  If a layer's mask is active (it has the double outline) then Ctrl clicking that mask will load it as a selection regardless of what layer is selected.

    You can do the same thing with work paths and channels, which is one of the reasons it is so useful to have multiple screens so that you have room to have all panels open.

    Does that help at all, or am I missing the point?

    Participant
    January 19, 2018

    HI There,

    Thanks for the prompt reply.

    No I think you are mistaking "selection" as in a marquee for physically

    selecting.

    Just to explain, say I'm on layer "A" painting a layer mask around an

    image, if I go to another layer to do something else, when I return to

    layer "A" instead of still being on the layer mask as I left it, photoshop

    defaults to the image of that layer. So in effect doubling my work because

    i have large files with lots of layers & don't want to have to select the

    layer mask every time I return to the layer "A" I've just been working

    on.....does that make sense?

    Cheers

    Legend
    January 19, 2018

    How do you return to layer "A" ?

    I assume by clicking on the layer in the layers panel, If that's the case why not click on the mask?