-
Notifications
You must be signed in to change notification settings - Fork 327
Open
Description
Describe the bug
Sometime loading a GLB generate an exception that block the rendering process and keep the process spinner to 1
To Reproduce
Steps to reproduce the behavior:
- Create a GLTF loader
- Load a GLB
Random error - sometimes it works and sometime we have an exception
Expected behavior
- The model should be loaded
- Or if an error happen then the exception should be catch and the spinner process should go back to 0
Screenshots
Exception when loading GLB :
main.361f5a13.js?ver=361f5a134270ae4b1cb7&t=1771509779284:514712 Uncaught (in promise) TypeError: this._layersToFinalize.push is not a function
at SceneModel._getVBOBatchingLayer (main.361f5a13.js?ver=361f5a134270ae4b1cb7&t=1771509779284:514712:28)
at SceneModel._createMesh (main.361f5a13.js?ver=361f5a134270ae4b1cb7&t=1771509779284:514485:27)
at SceneModel.createMesh (main.361f5a13.js?ver=361f5a134270ae4b1cb7&t=1771509779284:514459:17)
at parseNodeMesh (main.361f5a13.js?ver=361f5a134270ae4b1cb7&t=1771509779284:544371:22)
at main.361f5a13.js?ver=361f5a134270ae4b1cb7&t=1771509779284:544207:9
at Array.forEach (<anonymous>)
at createSceneMeshesAndEntities (main.361f5a13.js?ver=361f5a134270ae4b1cb7&t=1771509779284:544195:11)
at loadDefaultScene (main.361f5a13.js?ver=361f5a134270ae4b1cb7&t=1771509779284:544232:5)
at main.361f5a13.js?ver=361f5a134270ae4b1cb7&t=1771509779284:543937:5
viewer.scene.canvas.spinner.processes
-> 1
Code used to load the GLB with the try catch :
export function loadModel(
loaders: LoadersType,
modelConfig: ModelConfig,
coords?: number[],
callback?: (model: any) => void,
callbackOptions?: {
onSuccessModelLoaded?: (
model: VBOSceneModel,
modelConfig: ModelConfig
) => void;
onErrorLoadingModel?: (modelConfig: ModelConfig) => void;
}
) {
return new Promise<VBOSceneModel>(async (resolve, reject) => {
const loader = loaders[modelConfig.extension || 'xkt'];
if (!loader) {
reject('NO_LOADER_FOUND');
return;
}
const options: any = {
id: modelConfig.id,
src: modelConfig.modelSrc,
edges: modelConfig.extension === 'xkt',
globalizeObjectIds: true,
origin: coords,
colorTextureEnabled: true,
backfaces: false,
};
const { viewer } = loader;
if (coords) {
options.origin = coords;
}
try {
const model = loader.load(options);
callback?.(model);
model?.on('loaded', () => {
viewer.fire('modelLoaded', { model, modelConfig });
callbackOptions?.onSuccessModelLoaded?.(model, modelConfig);
resolve(model);
});
model?.on('error', (error: any) => {
console.log('Model failed to load:', modelConfig);
viewer.fire('modelFailed', model);
// callbackOptions?.onErrorLoadingModel?.(modelConfig);
reject(MODEL_ON_LOAD_ERROR);
});
} catch (error) {
console.error('Error loading model :', error);
reject(error);
}
});
}
Additional context
We want to understand what this error mean and how to manage it
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels