Feature parity - Plugin data on layer nodes in PS

How would you set pluginData on a Layer?

There’s no direct correlate for this XD API in Ps. The closest you can get is the XMP metadata, but this is specific only to the document. If you search the form for XMP you should get some examples—but it’s generally nontrivial.

What would you recommend as an alternative? Does XMP have a content limit?

Edit:

It looks like someone’s made an example here:

Photoshop UXP plugin + XMPMetadata - #2 by simonhenke?

I’m still using those metadata functions in almost all of my plugins.
Not sure about the content limit, but usually I use it to store the plugin state (settings) on a layer to retrieve it on selection.

I do use generator metadata property. This is per layer. Also XMP is possible per layer.

Would you mind sharing how you do that? In Alchemist Generator returns 0.json, so I figured I have to set my metadata to this json property, but I can’t figure out what’s the descriptor to set it. Also not sure how this is per layer :thinking:

What I’m doing now:

const jsonData = getDocumentProperty(docId, "json")
const json = JSON.parse(jsonData)

json["myPluginMeta"] = data

execModal(() => bp(
    [{
        "_obj": "set",
        "_target": [{
            "_ref": "document",
            "_id": docId,
            "_property": "json"
        }],
        "to": {
            "_obj": "document",
            "json": JSON.stringify(json)
        }
    }],
    {
        "synchronousExecution": true,
        "modalBehavior": "execute"
    })
)

Catching errors, but nothing there. And updated JSON is not set (checked descriptor and myPluginMeta key is there, but nada). Also I would even prefer having my meta saved on document level with object, where keys would be layer IDs. Would prefer not having to deal with XML