Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds a preview feature to the export popup that allows users to preview their exported scene data using a compressed PLY file and settings cached in the browser before completing the full export process.
- Added preview button to export popup with localization support across all languages
- Implemented preview functionality that generates compressed PLY data and caches it for browser preview
- Added rollup configuration to copy the supersplat-viewer files for preview functionality
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/ui/localization.ts | Added localization strings for preview button and keyframe panel in all supported languages |
| src/ui/export-popup.ts | Added preview button to export dialog and modified option assembly functions to support preview action |
| src/file-handler.ts | Implemented preview functionality with cache storage and viewer window opening |
| rollup.config.mjs | Added configuration to copy supersplat-viewer files to preview directory |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| // Previewing ply data through the cache | ||
| const cache = await caches.open(cacheName); | ||
| await cache.put('./preview/scene.compressed.ply', new Response(new Blob(plyBuffers as unknown as ArrayBuffer[], { type: 'application/octet-stream' }))); |
There was a problem hiding this comment.
The type assertion as unknown as ArrayBuffer[] suggests a type mismatch. Consider verifying the actual type returned by plyWriter.close() and using proper typing instead of forcing the cast.
| await cache.put('./preview/scene.compressed.ply', new Response(new Blob(plyBuffers as unknown as ArrayBuffer[], { type: 'application/octet-stream' }))); | |
| // Ensure plyBuffers is an array of ArrayBuffer or BlobPart | |
| const blobParts = Array.isArray(plyBuffers) ? plyBuffers : [plyBuffers]; | |
| await cache.put('./preview/scene.compressed.ply', new Response(new Blob(blobParts, { type: 'application/octet-stream' }))); |
| }); | ||
|
|
||
| events.function('scene.preview', async (options) => { | ||
| const { serializeSettings, viewerExportSettings: { experienceSettings: settings } } = options; |
There was a problem hiding this comment.
Destructuring viewerExportSettings.experienceSettings assumes viewerExportSettings exists, but this field is optional in SceneExportOptions. This will throw an error when previewing non-viewer export types like PLY or Splat.
| const { serializeSettings, viewerExportSettings: { experienceSettings: settings } } = options; | |
| const { serializeSettings } = options; | |
| const settings = options.viewerExportSettings?.experienceSettings ?? {}; |
|
I think this would be nice if the preview would run in an iframe in a supersplat-dialog-box. Maybe even extend that export dialog and integrate the preview in there |
My idea is a preview method that uses scene.compressed.ply and setting.json via the cache.
demo video