[SOLVED] Convert GLTF file to J3O in SDK (error)

Hello,

I compiled the SDK (today 02/11/2017) with the master branch and I try to convert a GLTF file to J3o in the SDK but an error appears:

java.lang.ClassCastException: com.jme3.asset.AssetKey can not be cast to com.jme3.asset.ModelKey
at com.jme3.gde.blender.GLTFDataObject.getAssetKey (GLTFDataObject.java:94)
at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset (SpatialAssetDataObject.java:94)
at com.jme3.gde.core.assets.actions.ConvertModel $ 1.run (ConvertModel.java:65)
at java.lang.Thread.run (Thread.java:748)

I used the box.gltf file contained in the resources

My question is it currently possible to convert GLTF files with the master branch of the SDK ?

thank you in advance

2 Likes

I m actually wondering if GLTF 2.0 will be supported or is supported? :open_mouth:

Can you check this model in SpaceShift editor?

It works well with Spaceshift editor, so the problem has to come from the SDK

2 Likes

It is really strange since it used to work as I implemented the gltf support.
I’ll have a look asap

Edit: did you do that in the resources folder or Copy the File into your assets directory?

1 Like

I copied the box.gltf and box.bin files into my asset directory of my project.

When I create my own models with Blender and I export the model with the Khronos script (with the material provided by Khronos), the same problem happens. On the other hand, using the spaceship editor, it works.

I hope I have compiled the SDK correctly. I followed the procedure on the Github site (I compiled the engine and then compiled the SDK). The SDK starts well with the command gradlew run.

did I do it the right way ?

Thoced

That should be the right way, yeah. I have no clue why it didn’t work that way.
I however released a commit which might fix your issue, so it would be nice if you could try it

I just recompile and it works with many models but sometimes I still have this kind of error on some models:

java.lang.IllegalArgumentException: Key Models / bridge / bridge.bin specified no cache.
at com.jme3.asset.DesktopAssetManager.deleteFromCache (DesktopAssetManager.java:230)
at com.jme3.gde.core.assets.AssetDataObject.closeAsset (AssetDataObject.java:259)
at com.jme3.gde.core.assets.actions.ConvertModel $ 1.run (ConvertModel.java:68)
at java.lang.Thread.run (Thread.java:748)

Does this also happen in JMonkeyBuilder?
To me it looks like a clear engine bug, though, maybe triggered by gltf and the fact that noone usually closes their assets.

Reasoning behind that: AssetKeys getCacheType explictly specifies “return null if you want to disable caching”, however the DesktopAssetManager should not throw an Exception then, but rather return (like specified no cache, that’s fine).

I do not have an error in JMonkeyBuilder, it only appears with the SDK

We’ve had a look at it, could you maybe share the bridge model so we can have a look at it?

Ok I’m doing this, but I just noticed that when the Buffer is integrated with the gltf file. The problem does not occur and the construction of the j3o file works.

When a * .bin file is created, then the exception appears.

1 Like

Should be fixed now

Super, I just compile the Sdk, I have no expection now.

Thank you

Thoced

2 Likes