jeremejevs Posted November 13, 2018 Share Posted November 13, 2018 As of this PR, it's no longer possible to load a scene from a local file: const sceneFile = new File('foo.babylon') const scene = await SceneLoader.LoadAsync('file:', sceneFile, engine) The only workaround I have found, which doesn't involve the inefficient conversion into a "data:" string, is this: import XMLHttpRequest from 'xmlhttprequest' global.XMLHttpRequest = XMLHttpRequest.XMLHttpRequest // ... const scene = await SceneLoader.LoadAsync('', 'file:foo.babylon', engine) It works, but I dislike having an extra dependency - "xmlhttprequest" - for no good reason. I've combed through the code, and looks like there's no alternative path. There's a handy utility called "LoadFile", but the only way to reach it without copy-pasting a ton of code is really convoluted, involving the "FilesInput.FilesToLoad" global. What's the rationale behind that PR? And would you mind adding the in-memory file support back? Edit: On the other hand, it appears I don't need to shim "FileReader" anymore with this new approach. Hmm. Either way, documenting the correct way to go about this would be greatly appreciated. Having a shimless way to load a local scene would be even better E.g. by just passing a Buffer. But I can live without that. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.