简体   繁体   中英

Photoshop Scripting with Javascript: How to unlock a partially locked layer?

I've tried many ways to unlock a partially locked layer in Photoshop using Javascript but nothing works. Here's a few examples of what I've tried:

var layerRef = app.activeDocument.artLayers.getByName('Background');
layerRef.allLocked = false;

The below alert returns false :

alert(app.activeDocument.layers[0].allLocked);

So it's not locked? I just want to convert this partially locked layer to a not locked layer.

My documentation source:

https://www.adobe.com/content/dam/acom/en/devnet/photoshop/pdfs/photoshop-cc-javascript-ref-2019.pdf

部分锁定层

Background is kind of a particular weird layer type in Photoshop. To unlock it (and convert to a normal layer) you need to use this specific command:

activeDocument.activeLayer.isBackgroundLayer = false;

Using the same property you can check if a layer is a Background layer and you can set any layer as a BG layer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM