fix(editor): set GLTFExporter textureUtils for compressed-texture GLB export (Sentry EDITOR-DJ)#435
fix(editor): set GLTFExporter textureUtils for compressed-texture GLB export (Sentry EDITOR-DJ)#435anton-pascal wants to merge 1 commit into
Conversation
…res (Sentry EDITOR-DJ)
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 64b1c96. Configure here.
| exporter.setTextureUtils({ | ||
| decompress: (texture, maxTextureSize) => | ||
| WebGLTextureUtils.decompress(texture, maxTextureSize, gl), | ||
| }) |
There was a problem hiding this comment.
Wrong texture utils for WebGPU
High Severity
The GLB exporter is configured to use WebGLTextureUtils.decompress with the gl renderer. However, the Viewer uses WebGPURenderer, and WebGLTextureUtils is WebGL-specific. This mismatch can cause compressed (KTX2) textures to fail or mis-decompress during GLB export.
Reviewed by Cursor Bugbot for commit 64b1c96. Configure here.


Sentry: MONOREPO-EDITOR-DJ (production)
Root cause
GLB export (
GLTFExporter) of a scene containing compressed (KTX2/basis) textures throws under three.js r184. r184'sGLTFExporterrequires atextureUtilsobject (backed by the activeWebGLRenderer) to decompress compressed textures during export. Without it,exporter.parse(..., { binary: true })throws and the export fails.Fix
In
packages/editor/src/components/editor/export-manager.tsx:const gl = useThree((state) => state.gl).import * as WebGLTextureUtils from 'three/examples/jsm/utils/WebGLTextureUtils.js'.exporter.setTextureUtils({ decompress: (texture, maxTextureSize) => WebGLTextureUtils.decompress(texture, maxTextureSize, gl) })beforeexporter.parse(...).glto theuseEffectdependency array.This lets the exporter decompress KTX2/compressed textures using the live renderer, resolving the throw.
Verification
bun run check-types(package@pascal-app/editor): no errors introduced inexport-manager.tsx. (Pre-existing, unrelated workspace dependency-version typecheck errors in other files remain and are out of scope for this fix.)biome checkon the touched file: clean, no fixes applied.Note
Low Risk
Small, localized change to the GLB export path only; no auth, persistence, or broader rendering pipeline changes.
Overview
Fixes GLB export failing when the scene uses KTX2/basis compressed textures under three.js r184, which throws unless
GLTFExporterhastextureUtilsconfigured.ExportManagernow reads the activeWebGLRendererfrom R3F (useThree→gl), importsWebGLTextureUtils, and callsexporter.setTextureUtilswith adecompresshook that delegates toWebGLTextureUtils.decompress(texture, maxTextureSize, gl)beforeparse. The exportuseEffectdependency list includesglso the registered export function stays aligned with the current renderer.Reviewed by Cursor Bugbot for commit 64b1c96. Bugbot is set up for automated code reviews on this repo. Configure here.