DarkLight Posted November 24, 2017 Share Posted November 24, 2017 Hello all, Im trying to load a mesh using FilesInput via Drag and drop like in the sandbox. Im always getting the following error: 'Error: No camera defined babylon.js:10:28650' I tried alot of solutions and im always getting the same error. The scene is already created and rendering perfectly i want just to get the meshes from the files. Here the code for the creation of the FilesInput instance. filesInput = new BABYLON.FilesInput(sceneManager.engine, sceneManager.scene, sceneLoaded, null, null, null, function () { BABYLON.Tools.ClearLogCache() }, null, sceneError); And here the call for the loadFiles on drop event. function drop_handler(ev) { console.log("Drop"); ev.preventDefault(); filesInput.loadFiles(ev); } Please note that sceneLoaded callback is not even called. Thxs in advance Regards Darklight Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 24, 2017 Share Posted November 24, 2017 Could you try to repro in the playground ? (agree it could be a bit tougher than usual) Please take a look at how we use it in the sandbox: https://github.com/sebavan/Babylon.js/blob/master/sandbox/index.js#L158 Also, please include the loader you intent in your script refereneces. Quote Link to comment Share on other sites More sharing options...
DarkLight Posted November 25, 2017 Author Share Posted November 25, 2017 I'll try to do it on playground. I have a question regardint this FilesInput, does it create a new scene every time ? cause i noticed that the scene was modified in the engine instance. I want to keep the old scene and just take the meshes from the loaded scene, is that possible or not ? Regards Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 25, 2017 Share Posted November 25, 2017 By default it creates a new scene but you can override this behavior by adding your own reloadCallback. Quote Link to comment Share on other sites More sharing options...
DarkLight Posted November 25, 2017 Author Share Posted November 25, 2017 Hello thxs @Sebavan that was the solution. I checked the FilesInput code and it was calling the Load function, this one is creating a new instance so i used instead of it the Append and i pass my scene in argument. BABYLON.FilesInput.prototype.reload = function() { var onSuccess = function(scene) { console.log('onSuccess'); }; var onProgress = function() { console.log('onProgress'); }; var onError = function() { console.log('onError'); }; BABYLON.SceneLoader.Append("file:", filesInput._sceneFileToLoad, sceneManager.scene, onSuccess, onProgress, onError); }; And this works Thxs alot dude ! Regards 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.