With CEP I use to know if a layer is grouped as a clipping mask with this property:
// If it has a clipping mask it returns true and false if not
app.activeDocument.activeLayer.grouped;
However, with UXP the Layer Object doesn’t have this property.
Is there a way to get if a layer has a clipping mask with UXP?
Thanks in advance!
JasonM
November 9, 2023, 7:18am
2
Like this?
async function userMaskOn(execcontext, id) {
console.log("userMaskOn");
const result = await batchPlay(
[
{
_obj: "get",
_target: [
{
_property: "userMaskEnabled"
},
{
_ref: "layer",
_id: id
},
],
_options: {
dialogOptions: "dontDisplay"
}
}
],
{}
);
return result[0].userMaskEnabled;
}
1 Like
Jarda
November 9, 2023, 8:16am
3
1 Like
Jarda:
isClippingMask
Not sure what actually OP meant, but I believe it’s a bit different
Whether the layer is being used as a clipping mask
is not the same as
Whether the layer has a clipping mask
1 Like
Jarda
November 9, 2023, 8:23am
5
Yes but he says it worked in ExtendScript and there was only one of them I believe… so it should be correct
2 Likes
JasonM
November 9, 2023, 8:27am
6
You are right, I misread. It is late.
Yes, Jarda is right, you can use app.activeDocument.activeLayers[0].isClippingMask
or via batchplay I think it would be more like the group attribute. (I think)
async function actionCommands() {
const result = await batchPlay(
[
{
_obj: "get",
_target: [
{
_ref: "layer",
_id: 32
},
{
_ref: "document",
_id: 762
}
],
_options: {
dialogOptions: "dontDisplay"
}
}
],
{}
);
const pinned = result[0].group;
}
1 Like
That was easy hahah! Can’t believe I didn’t see this. I went exactly to this page before coming into the forums but when I clicked “properties” on the right, I expected to have the properties on the right as well… So silly of me… Thank you Jarda!
Thank you very much guys for your help !
Jarda
November 9, 2023, 5:36pm
9
Yes having that in right menu would help me as well.
1 Like