Jump to content

Error while trying to load Mesh using FilesInput


DarkLight
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :D

Thxs alot dude !

Regards

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...