Plugin metadata on nodes

I’m glad to see that plugin metadata on nodes is in the implementation phase (https://trello.com/c/SbjFnQbg), but I wonder how it will work.

Will it just be a singular blob of data per plugin? A native JSON format might also be a good form, so the plugin doesn’t have to pay the stringify-on-set and parse-on-get cost every time (e.g., the API could cache it internally).

What about making it more like a database, which could be queried?

For example, if a plugin needs to examine all the nodes tagged with its data, it may have to walk the entire scenegraph to find those, so in a large document that could be quite expensive.

If the metadata were in a kind of database with columns (or maybe just a noSQL-like form with JSON queries), the plugin could query (only being allowed to see its own entries, of course) only those metadata entries which are relevant to the current operation. And each database entry could have a pointer to the relevant scenegraph node, etc.

Am I making any sense?

I’ve found this in the xd-14-apis branch of the plugin-docs-repo: https://github.com/AdobeXD/plugin-docs/blob/xd-14-apis/reference/scenegraph.md#SceneNode-pluginData

According to that, it will be some sort of serializable object (something that can get serialized to a JSON string). However, we could, of course, use some sort of database system for JS that uses objects to store such things (something along the lines of https://www.npmjs.com/package/fake-indexeddb), which means we’d just have to write a small wrapper around it (e.g., having a queryable database on the root node to quickly reference it’s children could be a solution for the problem with the querying).

First things first, however, let’s see if it really makes it into the XD 14 build – then we can think about how we can wrap some sort of DB system around it when it’s available :wink:

1 Like

Good find! Nice to see that coming. And the other “since XD14” additions in the scenegraph API, all of which seem like conveniences rather than strictly necessary like the plugin metadata.

And it’s quite reasonably defined.

Thanks, Adobe!

2 Likes