I just posted the following in the pre-release forum.
The new Clarity and Grain adjustment layers appear to be missing their layer.kind property values when attempting to access them using UXP.
HTML:
`<sp-button id="buttonGETLAYERKIND">Get Layer Kind</sp-button>`
JavaScript:
document.getElementById(“buttonGETLAYERKIND”).addEventListener(“click”, async() => {
const doc = await app.activeDocument;
const layers = await doc.layers;
layers.forEach((layer) => {
try { console.log(layer.kind) }
catch(e) { console.log(e) }
});
});
When this code encounters a Clarity layer, it throws the following error:
Error: Invalid value of ‘clarity’ for the type ‘^1’.
at get kind [as kind] (uxp://uxp-internal/ps-app.js:1)
at VM28 index.js:315
at Array.forEach ()
at e.exports. (VM28 index.js:314)
When it encounters a Grain layer, it throws the following error:
Error: Invalid value of ‘grain’ for the type ‘^1’.
at get kind [as kind] (uxp://uxp-internal/ps-app.js:1)
at VM28 index.js:315
at Array.forEach ()
at e.exports. (VM28 index.js:314)
Below is a list of Photoshop’s LayerKind values:
LayerKind: Object
BLACKANDWHITE: “blackAndWhite”
BRIGHTNESSCONTRAST: “brightnessContrast”
CHANNELMIXER: “channelMixer”
COLORBALANCE: “colorBalance”
COLORLOOKUP: “colorLookup”
CURVES: “curves”
EXPOSURE: “exposure”
GRADIENTFILL: “gradientFill”
GRADIENTMAP: “gradientMap”
GROUP: “group”
HUESATURATION: “hueSaturation”
INVERSION: “inversion”
LAYER3D: “threeD”
LEVELS: “levels”
NORMAL: “pixel”
PATTERNFILL: “pattern”
PHOTOFILTER: “photoFilter”
POSTERIZE: “posterize”
SELECTIVECOLOR: “selectiveColor”
SMARTOBJECT: “smartObject”
SOLIDFILL: “solidColor”
TEXT: “text”
THRESHOLD: “threshold”
VIBRANCE: “vibrance”
VIDEO: “video”
As you can see, “clarity” and “grain” are not included.
This will present a significant problem for UXP developers. When coding using UXP, it is assumed that every layer will have a layer.kind property associated with it. With the absence of layer.kind values for Clarity and Grain layers, any UXP code that iterates over all document layers to determine their layerKind will error out now unless the code includes a try/catch to intercept the error.
The expected behavior would be that no error would be thrown when the code executes.