Skip to content

Conversation

@hisayan
Copy link
Contributor

@hisayan hisayan commented Oct 7, 2025

My idea is a preview method that uses scene.compressed.ply and setting.json via the cache.

demo video

@willeastcott willeastcott added the enhancement New feature label Oct 7, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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' })));
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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' })));

Copilot uses AI. Check for mistakes.
});

events.function('scene.preview', async (options) => {
const { serializeSettings, viewerExportSettings: { experienceSettings: settings } } = options;
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
const { serializeSettings, viewerExportSettings: { experienceSettings: settings } } = options;
const { serializeSettings } = options;
const settings = options.viewerExportSettings?.experienceSettings ?? {};

Copilot uses AI. Check for mistakes.
@simonbethke
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants