Photoshop: Link / unlink Layer/Vector mask to multiple Layers.

  • Idea
  • Updated 3 years ago
  • (Edited)
Link or Unlink ALL Layer or Vector Masks in a file.

Common Scenario:

when Transforming a Layer with a Layer Mask unlinked, only content of the Layer is being Transformed and the content of a layer/Vector mask remains unchanged.
If unintended, this could cause a headache.

Often the Transformation is performed on many layers placed in multiple Layer Groups. It is easy to overlook unlinked Layer or Vector Mask.

Fix and prevention:

Trying to match the Layer/Vector mask to already modified Layer or go back in History.

Preventively, one must scroll through all Layers in a File to locate unlinked Layer or Vector masks and link them manually.

The suggested function would quickly solve this and help to increase productivity.

Please correct me if this function or easy workaround already exist.

Thanks!
Photo of roman weiser

roman weiser

  • 61 Posts
  • 5 Reply Likes
  • excited to hear back!

Posted 5 years ago

  • 4
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Chief Customer Advocate

  • 10358 Posts
  • 684 Reply Likes
This workflow might be solved with a script (If there are any enterprising script writers out there)
Photo of roman weiser

roman weiser

  • 61 Posts
  • 5 Reply Likes
Jeffery, while I agree with you this could be solved with a simple script, I believe that offering this as a standard PSD feature would align with Adobe's philosophy to create an intuitive software with emphasis on productivity. Isn't that what separates Adobe products from the rest of the pack?

Simple addition such as the one I suggested would go hand to hand with features like 'Delete all Hidden Layers', Lock All Layers in Group' or 'Select Linked layers'.

Please reconsider whether this suggestion is worthy of further discussion.
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Chief Customer Advocate

  • 10358 Posts
  • 684 Reply Likes
Sure. I understand. Just offering a solution that could work immediately. There's never a guarantee that every idea submitted will be implemented.
Photo of Armaan Ahluwalia

Armaan Ahluwalia

  • 6 Posts
  • 0 Reply Likes
I agree with roman. You can read the case in which the need for this arises in my comment below. Either the feature or a solution to the root problem would be welcome!
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Chief Customer Advocate

  • 10358 Posts
  • 684 Reply Likes
Yup. I appreciate your workflow description as well. Even though your suggested implementations were different it seemed like you guys were trying to solve similar workflow problems so I grouped them together to better garner support.
Photo of Armaan Ahluwalia

Armaan Ahluwalia

  • 6 Posts
  • 0 Reply Likes
Have a way to link or unlink all layers in a group to their masks with the click of button.

The need for this arises out of layers moving independent of their masks when you move a group. I have yet to find a use-case where I've wanted to move layers in a group but NOT their masks as well. Could you please make moving a group move everthing inside it including masks even if they are not linked! Or perhaps temporarily show them as linked during the move.

This reply was created from a merged topic originally titled
Link masks while moving Layers / Link-Unlink all layers in a group button.
Photo of Haim Azoulay

Haim Azoulay

  • 5 Posts
  • 1 Reply Like
I agree with everyone here,
I run into this problem every time, when working on complicated files with more then 300 layers, it's very exhausting to link or unlink layers one by one.

you can add an "unlock for all links" (or lock) toggle button next to the layer lock icon.
Photo of Roman_the_Finisher

Roman_the_Finisher

  • 30 Posts
  • 0 Reply Likes
Is there any development in regards to this Jeffrey?
Photo of happyPants

happyPants

  • 10 Posts
  • 0 Reply Likes
I was going to post this under being a bug. Is there a reason it's not posted there?
This is the way it works in AfterEffects. As the definition of a group, shouldn't everything in it move/scale when you move an object's parent? It sounds a whole lot like someone just plain messed up.

I can see how you might want an object, occasionally, to have a mask that is completely separate from the movement of all it's parents, but that is more likely rare. In AE you can choose an object to be a mask, then link that object to it's Actual parent layer, then move everything as a group, etc. Not so much in photoshop. I really wish they would get all of those software developers together so I don't have to constantly run back and forth. If they knew how I use their software they would probably laugh at how many loops I have to jump through in order to do what Could be a simple task.
ooops, little rant there.

anyway, this belongs in the bug section. If I don't see a response soon I might post it there as well.
Photo of Armaan Ahluwalia

Armaan Ahluwalia

  • 6 Posts
  • 0 Reply Likes
The original problem occurred when trying to find a way to move all layers within a group along with their masks.

My suggested solution to the problem was that one provides a way to temporarily toggle all masks within a group to being linked with their layers and then be able to toggle back. ( Similar to how Alt + Click ) provides that option when clicking the icon.

Ideally this modifier would be on the move function itself however it could well be a modifier while clicking some kind of icon on the group.

Some key things about this feature request -

1) A significant proportion of Photoshop users require this feature. Therefore the argument that not ALL users require it does not diminish the need for a solution within Photoshop.

2) There is already an alternative method to moving layers along with only masks which are linked to them. This can be done by selecting all the layers within a group and moving them.

Given that there currently exist two different ways to achieve moving layers along with only linked masks and no way of moving all layers within a group along with their masks, one could argue that one of these ways could well be used towards the latter.

Since selecting a group and having the masks move along with it makes intuitive sense ( when selecting an entity as a whole on expects its internal relations to stay the same ) - it is this method that should be used to solve the issue.
Photo of happyPants

happyPants

  • 10 Posts
  • 0 Reply Likes
Well said Armaan. I totally agree with you. Just because not everyone needs a feature does not mean it should be ignored. Not everyone needs the vanishing point tool. That doesn't mean it shouldn't be improved with things like antialiasing (it currently has none).
Photo of Chris Cox

Chris Cox, Sr. Computer Scientist

  • 19481 Posts
  • 545 Reply Likes
Nothing is being ignored here.
All I've done is try to explain the faults in your reasoning (not a bug, not parent-child, not always wanted, etc.)
Photo of happyPants

happyPants

  • 10 Posts
  • 0 Reply Likes
Right, but without any explaining other than "you don't always want them linked," it's difficult to imagine why.
It's good to know it's not being ignored, but with what you were saying it's hard to believe you are understanding the need, so will most likely not come up with the best solution for everyone. That's why I wanted to know how others were using the feature.
Of course, since I have a "lack of experience," I wouldn't be expected to know enough about user interaction with the software to be useful. :/
Photo of Armaan Ahluwalia

Armaan Ahluwalia

  • 6 Posts
  • 0 Reply Likes
Chris - did you read my comment? What are your thoughts on it?
Photo of Paul Riggott

Paul Riggott

  • 234 Posts
  • 78 Reply Likes
This should unlink all user/vector masks when run, if run with the shift key pressed all user/vector masks will be linked.
Photoshop CS5 or better....


#target photoshop
main();
function main(){
if(!documents.length) return;
var maskedLayers = getNamesPlusIDs();
if (ScriptUI.environment.keyboardState.shiftKey){
for(var a in maskedLayers){
var isUserMask =false;
if(maskedLayers[a][2] == 'true') isUserMask = true;
linkUnlinkMask(Number(maskedLayers[a][0]),true,isUserMask);
}
}else{
for(var a in maskedLayers){
var isUserMask =false;
if(maskedLayers[a][2] == 'true') isUserMask = true;
linkUnlinkMask(Number(maskedLayers[a][0]),false,isUserMask);
}
}
};
function linkUnlinkMask(ID,link,userMask) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putIdentifier(charIDToTypeID('Lyr '), ID);
desc.putReference( charIDToTypeID('null'), ref );
var desc2 = new ActionDescriptor();
if(userMask){
desc2.putBoolean( charIDToTypeID('Usrs'), link);
}else{
desc2.putBoolean( stringIDToTypeID('vectorMaskLinked'), link );
}
desc.putObject( charIDToTypeID('T '), charIDToTypeID('Lyr '), desc2 );
executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
};
function getNamesPlusIDs(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
var count = executeActionGet(ref).getInteger(charIDToTypeID('NmbL')) +1;
var Names=[];
try{
activeDocument.backgroundLayer;
var i = 0; }catch(e){ var i = 1; };
for(i;i<count;i++){
if(i == 0) continue;
ref = new ActionReference();
ref.putIndex( charIDToTypeID( 'Lyr ' ), i );
var desc = executeActionGet(ref);
var layerName = desc.getString(charIDToTypeID( 'Nm ' ));
var Id = desc.getInteger(stringIDToTypeID( 'layerID' ));
if(layerName.match(/^<
#target photoshop
main();
function main(){
if(!documents.length) return;
var maskedLayers = getNamesPlusIDs();
if (ScriptUI.environment.keyboardState.shiftKey){
for(var a in maskedLayers){
var isUserMask =false;
if(maskedLayers[a][2] == 'true') isUserMask = true;
linkUnlinkMask(Number(maskedLayers[a][0]),true,isUserMask);
}
}else{
for(var a in maskedLayers){
var isUserMask =false;
if(maskedLayers[a][2] == 'true') isUserMask = true;
linkUnlinkMask(Number(maskedLayers[a][0]),false,isUserMask);
}
}
};
function linkUnlinkMask(ID,link,userMask) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putIdentifier(charIDToTypeID('Lyr '), ID);
desc.putReference( charIDToTypeID('null'), ref );
var desc2 = new ActionDescriptor();
if(userMask){
desc2.putBoolean( charIDToTypeID('Usrs'), link);
}else{
desc2.putBoolean( stringIDToTypeID('vectorMaskLinked'), link );
}
desc.putObject( charIDToTypeID('T '), charIDToTypeID('Lyr '), desc2 );
executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
};
function getNamesPlusIDs(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
var count = executeActionGet(ref).getInteger(charIDToTypeID('NmbL')) +1;
var Names=[];
try{
activeDocument.backgroundLayer;
var i = 0; }catch(e){ var i = 1; };
for(i;i
Photo of happyPants

happyPants

  • 10 Posts
  • 0 Reply Likes
I think what we were looking for was a way to transform multiple layers and masks without changing the structure. If half my masks are linked, and half are not, this script would still require you to go through 1 by 1 and find the layers needing linked masks after you have translated them.

The script would first need to record the current state of each layer. Change all to linked, then when the translation is complete, change all layers back to their original states.
Photo of Paul Riggott

Paul Riggott

  • 234 Posts
  • 78 Reply Likes
I have had a look and found it could be done for user masks but not for vector masks as the 'vectorMaskLinked' key can be set but not read, unless Jeffery knows different?
Photo of Roman_the_Finisher

Roman_the_Finisher

  • 30 Posts
  • 0 Reply Likes
Hi Jeffrey, is there any development bout this issue?