Importing .j3o/xml with different extension

Hello! I’ve come pretty far with my game recently and most everything is working correctly & it’s more than playable. But I recently updated my GUI so I can load files from a folder so the users can add their own mods (car files and levels atm). These load correctly but the GUI became cluttered with all the .j3o’s that wind up in the folder for different track and car assets.

So I’d like to know how I can add a new loader to the asset manager that will load “.track” files, but treat them exactly like a “.j3o” extension? The .track file is literally just a .j3o re-named to .track so the loader should work fine, but I haven’t been able to find the right class loader to add to the asset manger.

Could anyone point me in the right direction please?
Thanks in advance :slight_smile:

[java]assetManager.registerLoader(???, “.track”);[/java]

Well just let your loader extend the j3o loader should do the trick or?

Also shouldnt it be able to just register the original j3oloader for your extension?

It should yes, problem is I can’t find the original loader >.< I’ll go back to looking though

To be a little more clear: I can’t find where jme is loading the .j3o extension. I’ve been digging through but I don’t see any sort of loader being started anywhere though I could just be blind >.< When have jme list it’s loader’s it’s empty :confused:
[java]logger.log(Level.INFO, assetManager.getClassLoaders().toString());[/java]

returns
Mar 22, 2014 5:34:09 PM com.rccg.engine.MenuAppState initialize
INFO: []

Solved!

Didn’t realize BinaryImporter was a loader as well.

[java]
assetManager.registerLoader(BinaryImporter.class, “track”);
Node scene = (Node)assetManager.loadModel(“Scenes/Maps/SuspensionTest/SuspensionTestScene.track”);
[/java]

works like a charm

1 Like