← Commit history

viewer: blob-route fallback for model loading

Caleb ·4b4147931a ·3mo ago ·parent 92a08e3
1 file changed +8−2
readme.html+8−2
@@ -101,8 +101,14 @@ async function show(name) {   document.getElementById('load').style.display = 'flex';   if (current) { scene.remove(current.root); current = null; mixer = null; }   if (!cache[name]) {-    try { cache[name] = await loader.loadAsync(MODELS[name]); }-    catch (e) { document.getElementById('load').textContent = 'load failed: ' + e.message; return; }+    // relative resolves under /render/; fall back to the blob route if that 404s+    const candidates = [MODELS[name], '/blob/app/base-scaffold-control-panel/' + MODELS[name]];+    let lastErr = null;+    for (const url of candidates) {+      try { cache[name] = await loader.loadAsync(url); lastErr = null; break; }+      catch (e) { lastErr = e; }+    }+    if (lastErr) { document.getElementById('load').textContent = 'load failed: ' + lastErr.message; return; }   }   const g = cache[name];   const root = g.scene;