Fast search for SceneNodes with their guids?

Is it possible to get a sceneNode, given its guid?

Couldn’t find it in the API, so I’ll fold-traverse the tree and check each node whether its guid exists in the list of guids I want to locate. Hoping there is a better solution.

There is currently no direct search API for guid. Could you share your use case?

I’m building a tool that converts vector designs into production-ready HTML & CSS. A recent demo is at https://protoship.io

This is my use case: the XD client first builds a JSON tree of all the nodes in the design and sends it to the server. The server determines which nodes should be treated as bitmaps or svgs, and returns a list of such guids. The client has to then export the renditions for those nodes and upload them to S3.

However, I’m not sure I’ll raise it as a feature request. I’ve been working on this today and I think I can do away with needing guid based lookup. The approach is to traverse the tree once more and export renditions as it encounters nodes that need to be exported. It is not too clunky and I think it is good enough.

It’s great to hear that traversing the tree once more wasn’t too clunky. XD and XD APIs are designed to be very performant, so traversing the entire document even if it’s big in size should be pretty quick. Please let us know if you run into any issues.

1 Like

Sorry for hijacking the post, but I have kind of a similar question.
Is there a way I can get the total size of the artboard and then their placement value?
What I mean by that is:
Let’s say I have a artboard called “ui”.
“ui” has a size of 1920x1080 and consists of 4 items.
I’m trying to figure out a way to get the location values of those elements.
Let me know if this makes sense
Edit: example screenshot

@saud, I have replied to your post separately.

1 Like