Back to the Shapespark home page

Navigating the nodes in a scene

I am looking for a way to parse all the nodes in a scene.
I am aware that you can interact with a node through the viewer object but I am not aware about how can I get all the nodes present in a scene. Any help would be greatly appreciated.

Thanks!

It’s not possible to get the node hierarchy through the API. However, you can get the list of node types in the scene (there can be multiple nodes of a given node type in the scene) with:

ViewerApi.getEditableNodeTypes()

The list contains only editable node types, that is node types for which

ViewerApi.setNodeTypeEditable(nodeType)

has been called before the scene starts to load. Nodes of editable node types are guaranteed not to be merged with other nodes as a part of scene optimizations. The nodeType argument can be a string or a regular expression.

Would it help for your use case?