focomoso Posted July 14, 2017 Share Posted July 14, 2017 I'm looking for a way to run the assetsManager (with all of its nifty file type checking) on a file chosen by the user via the file picker (or drag and drop). Is there a simple way to do this? The assetsManager seems only to take a url and filename. Is there a way to send it a file blob? If not, does anyone have any ideas on a relatively simple way to do this? Thanks Quote Link to comment Share on other sites More sharing options...
focomoso Posted July 16, 2017 Author Share Posted July 16, 2017 I'm able to load files using the specific plugin for the extension with: BABYLON.SceneLoader.GetPluginForExtension('.stl').load(this.scene,e.target.result,"root"); e.target.result is the file that comes from the file picker. This works fine, but... I have to do the file checking by hand (not ideal) I don't get a ref to the mesh like I do when I use the assetsManager which makes it hard to manipulate it after upload Any thoughts? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 17, 2017 Share Posted July 17, 2017 Hey As you mentioned, the AssetsManager is not designed to work with drag'n'drop unfortunately. Regarding your second point, the load function is synchronous so you can just check scene.meshes after calling load. Quote Link to comment Share on other sites More sharing options...
focomoso Posted July 17, 2017 Author Share Posted July 17, 2017 Thanks @Deltakosh Is there any guarantee that the most recently added mesh will be the last in the scene.meshes list (or something similar). If not, I'm going to have to save a copy of the meshes beforehand and look for the new name. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 18, 2017 Share Posted July 18, 2017 Yes this is the case focomoso 1 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.