Ignore error Message with FilesInput

I am using BABYLON.FilesInput to upload my model on babylonjs :

this.modelImport = new BABYLON.FilesInput(this.engine, this.scene,
      this.sceneLoaded.bind(this), null, null, null,
      () => BABYLON.Tools.ClearLogCache(), null, this.sceneError.bind(this));

this.modelImport.monitorElementForDragNDrop(this.canvas);

I also implemented a .ply loader and I’m using it like:

this.modelImport.onProcessFileCallback = ((file, name, extension) => {
    if (extension === 'ply') {
        this.PLYLoader(file);
    }
    return true;
});

So my loader is working perfectly but I still have an error in my console. Is there a way to avoid having babylon raising this error?

Will be great to know what error you see. Otherwise we can’t really help

1 Like

The error is:
errorMessage
This occurs when I try to load a .ply format file. However my model is loading properly because of the call to PLYLoader as mentionned in my post.

Seems like somewhere along the way you are using the SceneLoader. You will need to register the plugin using this method: SceneLoader - Babylon.js Documentation
This way you could use Babylon’s native import mechanism

I’m not using the SceneLoader maybe the Babylon.FilesInput use it internally but in this particular case I don’t use it. I only drag my .ply file and drop in my canvas. Is there a way to register a plugin for the FilesInput?

Sorry, it seems to be fixed - Babylon.js/filesInput.ts at master · BabylonJS/Babylon.js · GitHub . This should be changed IMO, will raise this with the team.
However - if all you want is the drop files functionality, why not add it yourself instead of using the file input? Even after a fix you will need to register your plugin (which will be cleaner, but will require you to change the code structure of your plugin)

Ok thank you for your help, it’s not just the drop files functionnality I also import my files through an input DOMElement and then I call my model import (the Babylon.FilesInput) as:
this.modelImport.loadFiles(e);
So yes if there is a way to register a plugin in the filesInput that would be great and it would make my code cleaner.

Issue submitted here: FileInput should check for registered plugins · Issue #7983 · BabylonJS/Babylon.js · GitHub , a fix will hopefully come very soon :blush:

The issue was closed, implemented here - Fix #7983 · BabylonJS/Babylon.js@3015613 · GitHub

Which means you can create a PLY plugin using this interface: ISceneLoaderPlugin - Babylon.js Documentation . Once you have the plugin, you can register it in the sceneloader and then dragging and dropping will work.

2 Likes