Fix local file model loading (fileSystemAppFolderGLB/GLTF2) - #35
Open
Brian-Simmons1 wants to merge 1 commit into
Open
Fix local file model loading (fileSystemAppFolderGLB/GLTF2)#35Brian-Simmons1 wants to merge 1 commit into
Brian-Simmons1 wants to merge 1 commit into
Conversation
Three bugs made NodeType.fileSystemAppFolderGLB unusable: 1. The GLB branch of buildModelNode was a no-op (fileLocation = fileLocation), so the bare filename reached the model loader and threw FileNotFoundException on every placement. 2. The GLTF2 branch computed the correct documents-directory path but assigned it to a shadowing local val, discarding it. 3. Even with a correct absolute path, sceneview's string loader resolves non-http locations through AssetManager, which cannot open filesystem paths. Absolute paths are now read directly and passed to modelLoader.createModelInstance as a buffer. Found and fixed in production while building VEEOP (https://veeop.com), an AR social location platform - https://github.com/VEEOP-app
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.
NodeType.fileSystemAppFolderGLBcurrently cannot load any model — three bugs stack up inbuildModelNode:fileLocation = fileLocation), so the bare filename reaches the model loader and every placement throwsjava.io.FileNotFoundException.dataDir/app_flutter/path but assigns it to a shadowing localval, so the outer variable keeps the bare filename.AssetManager(nativeOpenAssetin the stack trace), which can't open filesystem paths.This PR resolves both branches against the Flutter documents directory and, for absolute paths, reads the bytes directly and hands Filament a
ByteBufferviamodelLoader.createModelInstance.Verified on device (Galaxy S25+, ARCore): before —
FileNotFoundExceptionon every tap-to-place; after — local.glbmodels place and render correctly.Found and fixed in production while building VEEOP, an AR social location platform (github.com/VEEOP-app).