Jump to content

Creating your own file importer


dpanzo
 Share

Recommended Posts

Greetings to the community,

 

Has anyone succeded creating their own file importer? From the tutorial, I've tried setting up and registering a dummy importer for a random file extension (it doesn't matter at this stage) but it doesn't work at all.

 

Obviously I'm doing something wrong. I'll be pleased if someone could show me the right way.

 

 

Link to comment
Share on other sites

There's not much to share really. Here's the code :

var canvas = document.getElementById("renderCanvas");var engine = new BABYLON.Engine(canvas, true);var scene = new BABYLON.Scene(engine);		BABYLON.SceneLoader.RegisterPlugin({	extensions: ".dummy",	importMesh: function (meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons) {		return true;	},	load: function (scene, data, rootUrl) {		return true;	}});		BABYLON.SceneLoader.Load(scene, "file.dummy", "./");

It yields an "Uncaught TypeError: undefined is not a function" on line 32 (first line of the RegisterPlugin call)

 

Thanks a lot

Link to comment
Share on other sites

Hi,

 

Dad72, thank you for trying to help but your answer does not make sense, the "return true" cannot cause this error, so even if you put some other code into the two function the error still be there.

 

As dpanzo said, his error was "Uncaught TypeError: undefined is not a function" on line 32.

 

For me it means that your are trying to call the .RegisterPlugin function which is not defined.

 

Could you please check in your "babylon.sceneLoader.js" file if you have the registerPlugin method, if not it means you do not have the latest version on babylonJS.

 

Else sorry i have no other idea.

 

Hope it was helful.

 

Thanks for reading.

Link to comment
Share on other sites

ok thanks I'll do that and keep you posted.

 

edit : Ok, I see my mistake. I included babylon.js and thought I had everything I needed. Actually, just as you suggested., the "RegisterPlugin" function is nowhere to be found in my babylon.1.11.js, which I thought was a complete release.

 

Does that mean I must include one by one every library I intend to use? In my case, adding "babylon.sceneLoader.js" did not work well unfortunately, but for another reason perhaps.

Link to comment
Share on other sites

  • 2 weeks later...

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...