Fixes and custom project inspector dogfooding#89
Merged
Conversation
…d inspector demo
Several fixes to the WebGL viewer, surfaced while building a reusable-viewer
demo, plus the demo itself.
RenderScene/Scene — fix crash when loading into a reused viewer:
- RenderScene.removeScene recomputed the combined bounding box with
`reduce((a, b) => a.union(b))` and no guard. A scene whose geometry isn't
built yet returns an undefined box (normal mid-load), so the union threw
"Cannot read properties of undefined (reading 'union')" on the 2nd+
sequential load. Filter out undefined boxes before the union.
- Scene.dispose() called clear(), which re-adds the now-empty scene to the
renderer, leaving a stale undefined-box scene registered after unload. That
accumulation was the source of the undefined box above. dispose() now removes
the scene from the renderer after clearing.
WebGL load errors — stop using the Ultra modal:
- ComponentLoader.onError reported failures with the Ultra
serverFileDownloadingError ("VIM Ultra File Error"), misleading on a WebGL
viewer and hiding the real cause. Add react-viewers/errors/webglFileError and
use it, surfacing the underlying error message.
Ghost opacity — make it actually apply and configurable:
- The isolation.ghostOpacity StateRef hydrated from localStorage but the ghost
material initialized from its own default, and the value was only pushed to
the material on change — so a persisted opacity showed in the UI but never
reached the material. Push the initial ghostOpacity into the adapter on mount
(mirroring showGhost).
- Add an optional isolation.ghostOpacity to createViewer settings, seeded into
the material once before the StateRefs initialize (a persisted slider value
still takes precedence).
Demo — add a custom project inspector (src/customInspector.tsx, routed via
main.tsx at ?page=inspector):
- Custom BIM tree (Room > Category > Family > Type > Element) and BIM info
panel replacing the built-ins, reusing a single viewer across loads.
- Room rows visualize the room volume as a self-owned, transparent THREE mesh
built from the room's actual geometry and added straight to the render scene
(outside the viewer's tracking), since room geometry is opaque-authored and
isRoom visibility is owned by the global showRooms flag. Multiple selected
rooms are shown at once.
Also bump version to 1.0.0-beta.2.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
vim-sroberge
approved these changes
Jun 2, 2026
Collaborator
vim-sroberge
left a comment
There was a problem hiding this comment.
Very nice, thanks Martin, great changes. And it's nice with the comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix WebGL viewer-reuse crash, error modal, and ghost-opacity sync; add inspector demo
Several fixes to the WebGL viewer, surfaced while building a reusable-viewer demo, plus the demo itself.
RenderScene/Scene — fix crash when loading into a reused viewer:
reduce((a, b) => a.union(b))and no guard. A scene whose geometry isn't built yet returns an undefined box (normal mid-load), so the union threw "Cannot read properties of undefined (reading 'union')" on the 2nd+ sequential load. Filter out undefined boxes before the union.WebGL load errors — stop using the Ultra modal:
Ghost opacity — make it actually apply and configurable:
Demo — add a custom project inspector (src/customInspector.tsx, routed via main.tsx at ?page=inspector):
Also bump version to 1.0.0-beta.2.