feat: add STL and OBJ export formats (#175)

Extend the export manager to support STL and OBJ formats in addition to
the existing GLB export. Uses Three.js built-in STLExporter and
OBJExporter - no new dependencies.

STL is the standard format for 3D printing. OBJ is widely used in
rendering pipelines and supports basic materials. Both are requested
in the community discussion on #145.

Changes:
- export-manager.tsx: add STLExporter and OBJExporter, accept format param
- settings-panel: three format-specific export buttons (GLB, STL, OBJ)
- use-viewer store: update exportScene type to accept optional format

The format parameter defaults to 'glb', so existing callers (command
palette) continue to work without changes.

Relates to #145

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-03-26 00:30:34 -04:00
committed by GitHub
co-authored by Matt Van Horn Claude Opus 4.6
parent 7d4c8b6bd4
commit a5378da020
4 changed files with 48 additions and 16 deletions
+2 -2
View File
@@ -27,8 +27,8 @@ type ViewerState = {
setSelection: (updates: Partial<SelectionPath>) => void
resetSelection: () => void
outliner: Outliner
exportScene: (() => Promise<void>) | null
setExportScene: (fn: (() => Promise<void>) | null) => void
exportScene: ((format?: 'glb' | 'stl' | 'obj') => Promise<void>) | null
setExportScene: (fn: ((format?: 'glb' | 'stl' | 'obj') => Promise<void>) | null) => void
}
declare const useViewer: import('zustand').UseBoundStore<import('zustand').StoreApi<ViewerState>>
export default useViewer
+2 -2
View File
@@ -61,8 +61,8 @@ type ViewerState = {
outliner: Outliner // No setter as we will manipulate directly the arrays
// Export functionality
exportScene: (() => Promise<void>) | null
setExportScene: (fn: (() => Promise<void>) | null) => void
exportScene: ((format?: 'glb' | 'stl' | 'obj') => Promise<void>) | null
setExportScene: (fn: ((format?: 'glb' | 'stl' | 'obj') => Promise<void>) | null) => void
debugColors: boolean
setDebugColors: (enabled: boolean) => void