Build tree view from SceneLoader

Hi, first of all thanks for all your help during the development of my project, I almost finish it and you played a big role during the process.

I’m building a tree view where users can select a mesh, I’m using basically jquery and jstree. I can list all the meshes but I’d like to create the tree view with the parent-children hierarchy that is coming from blender, it is a way to get this list from the scene?

Thanks

Rafael

Read from scene.meshes?
just check Mesh.getChildren() array or Mesh.parent

for(let i = 0; i < scene.meshes.length; i++){
 let mesh = scene.meshes[i];
 if( !mesh.parent ){
  // Add mesh to top level of list
 }
 else {
  // Add mesh as child of mesh.parent on the list
 } 
}
1 Like

Great! thank you, I’ll implement it right away.

Cheers!

please tell me what’s in Babylon about the layered tree,