Hi,
So we are rendering a list of models that are already been converted in blob now when loading these models we have to rename each mesh root and add them in in a JSON so that we can do further operations on it.
the challenge is that scene returns all the meshes in the callback and we just need the root of each mesh that should be mapped with the URL passed. The callback is async and takes one parameter i.e. scene and we cannot pass the string which we want to use as the name of the root mesh
data.map((modelData) => {
var url = URL.createObjectURL(modelData.modelPath)
console.log(modelData.modelPath) // Blob URL of model
console.log(modelData.newName) // New name for the root
SceneLoader.Append(
'',
url,
scene,
function (scene) {
console.log(scene.meshes)
scene.meshes.map((mesh) => {
// ToDo: Get root of the mesh which are loaded and rename it -> modelData.newName
})
},
undefined,
undefined,
'.glb'
)
})
regards,
Nipun David