In the three js editor, I am able to upload a model and it displays all the individual groups and meshes in the model in a hierarchical format:
I have been trying to figure out a way to replicate this hierarchical format based on the uploaded model’s children as shown below where each item has a parent id and child id.
My main issue currently is trying to figure out how to know which item belongs in which layer in the hierarchy so I can replicate the table from the three js editor. There is no property that defines where the item is in the hierarchy, so I was thinking that I would create a new property and use traverseAncestors for each item to assign it a layer number to indicates its position in the hierarchy. Then I was planning to dynamically create a collapsible list shown in this example. But my strategy seems very convoluted to me and I was wondering what is a better way to create a hierarchy and then dynamically creating the html list when the model is very complicated using only the list above?