Skip to content

Fix local file model loading (fileSystemAppFolderGLB/GLTF2) - #35

Open
Brian-Simmons1 wants to merge 1 commit into
hlefe:mainfrom
Brian-Simmons1:fix/local-glb-model-loading
Open

Fix local file model loading (fileSystemAppFolderGLB/GLTF2)#35
Brian-Simmons1 wants to merge 1 commit into
hlefe:mainfrom
Brian-Simmons1:fix/local-glb-model-loading

Conversation

@Brian-Simmons1

Copy link
Copy Markdown

NodeType.fileSystemAppFolderGLB currently cannot load any model — three bugs stack up in buildModelNode:

  1. The GLB branch is a no-op (fileLocation = fileLocation), so the bare filename reaches the model loader and every placement throws java.io.FileNotFoundException.
  2. The GLTF2 branch discards its work: it computes the correct dataDir/app_flutter/ path but assigns it to a shadowing local val, so the outer variable keeps the bare filename.
  3. Even a correct absolute path can't load: sceneview's string loader resolves non-http locations through AssetManager (nativeOpenAsset in 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 ByteBuffer via modelLoader.createModelInstance.

Verified on device (Galaxy S25+, ARCore): before — FileNotFoundException on every tap-to-place; after — local .glb models place and render correctly.

Found and fixed in production while building VEEOP, an AR social location platform (github.com/VEEOP-app).

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant