fix(editor): set GLTFExporter textureUtils for compressed-texture GLB export (Sentry EDITOR-DJ)#435
Merged
Merged
Conversation
|
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.
three r184's GLTFExporter throws 'setTextureUtils() must be called' when a scene contains KTX2/basis-compressed textures. Wire up WebGPUTextureUtils (matching the app's WebGPURenderer) so compressed textures are decompressed during GLB export. decompress() is called without the live renderer on purpose: it resizes whatever renderer it is given and never restores it, which would corrupt the visible canvas. Omitting it lets three create and dispose its own throwaway renderer for the blit. Reworked from #435 (anton-pascal); switches WebGL->WebGPU utils and avoids the live-renderer resize gotcha surfaced in review. Co-authored-by: anton-pascal <anton@pascal.app>
64b1c96 to
986995f
Compare
Contributor
|
Reworked from a dual review pass. Two changes vs the original:
Typecheck passes. Verifying CI before merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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
Scoped to GLB export in
export-manager.tsxwith an isolated decompress path that avoids touching the live WebGPU canvas renderer.Overview
Fixes production GLB export failures when the scene uses KTX2/basis compressed textures, which three.js r184’s
GLTFExporterrefuses to process unlesssetTextureUtils()is configured.Before
exporter.parse, the export path now registersWebGPUTextureUtils.decompress(matching the editor’s WebGPU renderer) viaexporter.setTextureUtils({ decompress: ... }). The live canvas renderer is not passed intodecompress, because that helper can resize the renderer and leave the visible viewport corrupted; omitting it lets three use a disposable renderer for the blit.STL/OBJ export behavior is unchanged; only the default GLB branch gains this hook.
Reviewed by Cursor Bugbot for commit 986995f. Bugbot is set up for automated code reviews on this repo. Configure here.