-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support loading models from app private storage #2987
Comments
I’m actually already using the prerelease version in #2982. It’s still not able to load any files from the private storage. (It is, however, able to load from bundled assets using require(…) though)
…________________________________
From: Cody Bennett ***@***.***>
Sent: Monday, September 4, 2023 8:28:26 AM
To: pmndrs/react-three-fiber ***@***.***>
Cc: l3utterfly ***@***.***>; Author ***@***.***>
Subject: Re: [pmndrs/react-three-fiber] Support loading models from app private storage (Issue #2987)
Is this related to #2986<#2986> or still a problem despite our use of expo-asset? We don't assume that loaders implement parse nor is that implemented consistently, so we default to the networking stack except in specific cases (#2982<#2982>). This could be one of them.
—
Reply to this email directly, view it on GitHub<#2987 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABVFX2ZGJCXL2HEBS3MSN43XYUOCVANCNFSM6AAAAAA4JM74I4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
We had a similar case already implemented for Android release mode where we have to copy to a cache directory. Included a possible fix in dd4b300 or https://pkg.csb.dev/pmndrs/react-three-fiber/commit/dd4b3006/@react-three/fiber. |
Thanks, I’ll try this and get back to you
…________________________________
From: Cody Bennett ***@***.***>
Sent: Monday, September 4, 2023 10:48:00 AM
To: pmndrs/react-three-fiber ***@***.***>
Cc: l3utterfly ***@***.***>; Author ***@***.***>
Subject: Re: [pmndrs/react-three-fiber] Support loading models from app private storage (Issue #2987)
We had a similar case already implemented for Android release mode where we have to copy to a cache directory. Included a possible fix in dd4b300<dd4b300> or ***@***.***/fiber.
—
Reply to this email directly, view it on GitHub<#2987 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABVFX2ZSTHU7GX7OKODR5NLXYU6OBANCNFSM6AAAAAA4JM74I4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hi, I quickly tried that branch with a local file, got the error: Tracing through the code a little, I think the issue is this:
Here's the polyfill code I found:
I don't think this is sufficient for local storage files. Even after getting the asset local uri, your polyfill still attempts to use XMLRequest to get the file, which results in the error above. I think a suitable change could be modifying the polyfill function to detect if the uri starts with |
Typical use-case:
react-native-fs
. Those files will be present in a path such as${RNFS.DocumentDirectoryPath}/path/to/model
. They can be accessed through expo assets via:file://{full path}
const fbx = useLoader(FBXLoader, 'file://' + path)
The current implementation of does not seem to support this. It tries to call "load" from threejs, which tries to download the file from the internet, which does not work.
This is a modified
FBXLoader
that will work for loading local FBX files:I have a working version of this loader being used in my app. If you feel this is a worthwhile inclusion, I can make a pull request.
The text was updated successfully, but these errors were encountered: