Skip to content

Commit

Permalink
Associate PLY file with the SuperSplat PWA (#92)
Browse files Browse the repository at this point in the history
* Associate PLY file with the SuperSplat PWA

* Remove space from SUPER SPLAT
  • Loading branch information
willeastcott authored May 18, 2024
1 parent 150fab1 commit 37c6cec
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "super-splat",
"name": "supersplat",
"version": "0.16.0",
"author": "PlayCanvas<support@playcanvas.com>",
"homepage": "https://playcanvas.com/super-splat",
"description": "All the splat things",
"homepage": "https://playcanvas.com/supersplat/editor",
"description": "3D Gaussian Splat Editor",
"keywords": [
"playcanvas",
"ply",
Expand Down
19 changes: 18 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ import { Events } from './events';
import { PickerSelection } from './tools/picker-selection';

declare global {
interface LaunchParams {
readonly files: FileSystemFileHandle[];
}

interface Window {
launchQueue: {
setConsumer: (callback: (launchParams: LaunchParams) => void) => void;
};
scene: Scene;
showError: (err: string) => void;
}
Expand Down Expand Up @@ -189,6 +196,16 @@ const main = async () => {
}

window.scene = scene;
}

// handle OS-based file association in PWA mode
if ("launchQueue" in window) {
window.launchQueue.setConsumer(async (launchParams: LaunchParams) => {
for (const file of launchParams.files) {
const blob = await file.getFile();
scene.loadModel(URL.createObjectURL(blob), file.name);
}
});
}
};

export { main };
10 changes: 9 additions & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,13 @@
"sizes": "3840x2160",
"form_factor": "wide"
}
]
],
"file_handlers": [
{
"action": "/",
"accept": {
"application/ply": [".ply"]
}
}
]
}
2 changes: 1 addition & 1 deletion src/ui/control-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { version as supersplatVersion } from '../../package.json';
class ControlPanel extends Panel {
constructor(events: Events, remoteStorageMode: boolean, args = { }) {
Object.assign(args, {
headerText: `SUPER SPLAT v${supersplatVersion}`,
headerText: `SUPERSPLAT v${supersplatVersion}`,
id: 'control-panel',
resizable: 'right',
resizeMax: 1000,
Expand Down

0 comments on commit 37c6cec

Please sign in to comment.