Jump to content

Extending the default babylon file parser


tomph
 Share

Recommended Posts

Does anyone know how to extend the default babylon.js file parser?  I'm successfuly loading a scene with the JSON data I have (Babylon File Format), but my JSON contains some custom metadata, which I'd like to handle when i load/parse.  I'm aware of Scene.AddParser, but I feel like that is too far down the chain (my custom properties have been stripped out by the time it hits my parser function).

Another thing I've noticed is you can do the following:

BABYLON.SceneLoader.OnPluginActivatedObservable.add(function (loader:ISceneLoaderPlugin) {

});

Is there anything I can hijack at that point? I can see loader has an extensions property.....

Any help would be appreciated, thanks!
Link to comment
Share on other sites

Hiya tomph.  I don't know if useful/not, but the BJS SCENE class... has a .metadata property.  I'm pretty sure... it wants a string.

I heard that .metadata exports into BJS... just fine.  When OnSceneReady... json-parse the giant serialized-json string found in scene.metadata. 

A database... in a storage pocket of a .babylon file!  YAY! 

Also, all "nodes" have their own .metadata property, too... lights, cameras, mesh-erschmitts.  ;)

A guy COULD... put a very large chunk of serialized json poop, inside a .metadata property.  Would THAT work for you?  Maybe.

Here's a playground search for scene.metadata.

Link to comment
Share on other sites

Can we mark as "solved"?  Close-up this issue and head for the tavern?  PARTY!!!

(Wingnut digs-into tomph's metadata to see if there's some Blackberry Brandy included.  Yum!  Maybe some serialized cereal.)  :)

(No brandy or cereal, but there's an aerosol can of BJS Scene Lube, in there.  Greasome!)

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