diff --git a/frontend/misc/network.ts b/frontend/misc/network.ts index 06df1b8..3b04e3a 100644 --- a/frontend/misc/network.ts +++ b/frontend/misc/network.ts @@ -93,7 +93,7 @@ export class NetworkManager extends EventTarget { private foundModel(name: string, hash: string | null, url: string, isRemove: boolean | null, disconnect: () => void = () => { }) { - console.debug("Found model", name, "with hash", hash, "at", url, "isRemove", isRemove); + // console.debug("Found model", name, "with hash", hash, "at", url, "isRemove", isRemove); // We only care about the latest update per model name this.bufferedUpdates = this.bufferedUpdates.filter(m => m.name !== name); diff --git a/frontend/misc/scene.ts b/frontend/misc/scene.ts index 6b986e1..e6fab8f 100644 --- a/frontend/misc/scene.ts +++ b/frontend/misc/scene.ts @@ -13,23 +13,25 @@ export class SceneMgr { let loadStart = performance.now(); let loadNetworkEnd: number; - // Start merging into the current document, replacing or adding as needed - document = await mergePartial(url, name, document, () => loadNetworkEnd = performance.now()); + try { + // Start merging into the current document, replacing or adding as needed + document = await mergePartial(url, name, document, () => loadNetworkEnd = performance.now()); - console.log("Model", name, "loaded in", performance.now() - loadNetworkEnd!, "ms after", - loadNetworkEnd! - loadStart, "ms of transferring data (maybe building the object on the server)"); + console.log("Model", name, "loaded in", performance.now() - loadNetworkEnd!, "ms after", + loadNetworkEnd! - loadStart, "ms of transferring data (maybe building the object on the server)"); + } finally { + if (updateHelpers) { + // Reload the helpers to fit the new model + await this.reloadHelpers(sceneUrl, document, reloadScene); + reloadScene = false; + } - if (updateHelpers) { - // Reload the helpers to fit the new model - await this.reloadHelpers(sceneUrl, document, reloadScene); - reloadScene = false; - } - - if (reloadScene) { - // Display the final fully loaded model - let displayStart = performance.now(); - document = await this.showCurrentDoc(sceneUrl, document); - console.log("Scene displayed in", performance.now() - displayStart, "ms"); + if (reloadScene) { + // Display the final fully loaded model + let displayStart = performance.now(); + document = await this.showCurrentDoc(sceneUrl, document); + console.log("Scene displayed in", performance.now() - displayStart, "ms"); + } } return document; @@ -97,7 +99,7 @@ export class SceneMgr { // Serialize the document into a GLB and update the viewerSrc let buffer = await toBuffer(document); let blob = new Blob([buffer], {type: 'model/gltf-binary'}); - console.debug("Showing current doc", document, "as", Array.from(buffer)); + console.debug("Showing current doc", document, "with", buffer.length, "total bytes"); sceneUrl.value = URL.createObjectURL(blob); return document; diff --git a/frontend/models/Models.vue b/frontend/models/Models.vue index a4456aa..8637338 100644 --- a/frontend/models/Models.vue +++ b/frontend/models/Models.vue @@ -36,9 +36,7 @@ function onRemove(mesh: Mesh) { } function findModel(name: string) { - console.log('Find model', name); if (!expandedNames.value.includes(name)) expandedNames.value.push(name); - console.log('Expanded', expandedNames.value); } defineExpose({findModel})