Is there any way to set correct guid for scenegraph root element?
In general the question is what can be used to identify the document? Or vise versa can I store some meta information within the document to identify it?
Yes, you can store pluginData on the root element.
See https://adobexdplatform.com/plugin-docs/reference/scenegraph.html#scenenodeplugindata-- .
Good point, thanks! Is there any way to force save document as well? Modifications in meta don’t make any sense without saving (if I got it right).
I don’t think so. Adobe folk would likely say they don’t want plugins to be doing that kind of file manipulation (saving, reverting, etc.)
On other hand it’s not easy to explain to users why file switches to modified state after exporting data and why they should save the file manually. As I recall in Photoshop it was really big problem even with native assets exporter.
Yes, people get really steamed about that.
E.g., just printing in InDesign causes the document to be modified.
From an XD perspective, I think @cpryland is right – if a plugin could save the document, it might do so with changes the user didn’t want saved yet, leading to a bad user experience. Not saying it couldn’t be something we add in the future, but we’d have to carefully think about the user experience.