0

I've been trying to figure out how I can disable or delete the layer mask from a layer. I know theres a way using the actiondescriptor using 'RmvL' but I also had no luck with that so far.

Im using the app.activeDocument.paste(true) (true, because im pasting it into selection), if I could bypass that by using something else, I could skip deleting layer masks all along because by using true, Photoshop automatically applies a layer mask.

Thanks for the help!

T1k33y
  • 17
  • 6

1 Answers1

0

Why do you think it was a 'RmvL' descriptor? Scriptlistener gives us a 'Dlt ' charID. Here's it wrapped to a function:

/**
 * deletes layer mask from active layer
 * @param  if apply is true, mask will be applied, if false — mask will be discarded
 * @return boolean
 */
function deleteMask(apply)
{
    if (apply == undefined) apply = false;
    try
    {
        var desc = new ActionDescriptor();
        var ref = new ActionReference();
        ref.putEnumerated(charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('Msk '));
        desc.putReference(charIDToTypeID('null'), ref);
        desc.putBoolean(charIDToTypeID('Aply'), apply);
        executeAction(charIDToTypeID('Dlt '), desc, DialogModes.NO);
        return true
    }
    catch (e)
    {
        return false
    }
};
Sergey Kritskiy
  • 2,199
  • 2
  • 15
  • 20