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...
Guest Posted November 13, 2018 Share Posted November 13, 2018 Pinging @bghgary Quote Link to comment Share on other sites More sharing options...
bghgary Posted November 13, 2018 Share Posted November 13, 2018 This sounds like a bug. I will investigate. Quote Link to comment Share on other sites More sharing options...
bghgary Posted November 14, 2018 Share Posted November 14, 2018 The fix for this is here: https://github.com/BabylonJS/Babylon.js/pull/5510 @jeremejevs Thanks for reporting it! Quote Link to comment Share on other sites More sharing options...
jeremejevs Posted November 19, 2018 Author Share Posted November 19, 2018 Thank you for the fix! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.