I was wondering how the correct behavior should be for a call of AssetManager.loadAsset(String name) with a jme binary object?
Currently it gives me an error throwing the above Error as an IllegalStateException.
The loader is identified as a binary object loader, the final object is an instance of a ClonableSmartAsset, but the cloning processor is not present as the Key is a generic AssetKey.
So I am wondering how load asset with strings should work, as it seems it is not handling a proper lookup of Asset types to get the desired AssetKey.
Previously it worked fine and I tracked the changes down in DesktopAssetManager to come with revision 9309.
In my code I commented out theexception and cloned the asset if a processor is present, but is it the right way to do this?
What error?
This one:
java.lang.IllegalStateException: Asset implements CloneableSmartAsset but doesn’t have processor to handle cloning
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:318)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:337)
at com.l2client.app.L2JClient.simpleInitApp(L2JClient.java:109)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:228)
at com.l2client.app.L2JClient.initialize(L2JClient.java:102)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)
at java.lang.Thread.run(Thread.java:722)
I can load j3o files fine, how did you create the “binary files” and what do they contain?
@normen said:
I can load j3o files fine, how did you create the "binary files" and what do they contain?
@ghoust said:
The loader is identified as a binary object loader, the final object is an instance of a ClonableSmartAsset, but the cloning processor is not present as the Key is a generic AssetKey.
He must of had a old converted j3o, i think.
Was the file created with a nightly version? The stable versions should not exhibit this issue.
I have the same issue with some older j3o files. I’ll try re-creating them.
I have just tried loading newly created j3o meshes by using com.jme3.asset.DesktopAssetManager.loadAsset(“yourfile.j3o”) and it gives the same result.
I had the same problem with model = (Spatial) assetManager.loadAsset(“file.j3o”); (have worked in previous versions, using the SDK)
After I updated earlier today I had to change to model = assetManager.loadModel(“file.j3o”); to get it working.
Duh. If you used loadAsset for a model w/o using a ModelKey then you did something wrong anyway.
Thxs, using the ModelKey solves it.
To make sure I understand it the difference between a ModelKey and the original AssetKey is that the model is removed from the cache when there are no more references? And the AssetKey is for manual removal from the cache if needed and thus has no AssetProcessor by default?
For each type of asset (models, sounds, textures, etc.) this behavior can be different. And just out of curiosity is this asset caching behavior documented somewhere?
UTSL
So what is loadAsset(String name) good for?
I have an asset assembler, which only knows of what files names his components are. It loads skeletons, animations, meshes, or whole scenes. If I now have to know beforehand which assetkey to use to load it, I can also skip the whole assetkey stuff and get back to use loadModel, loadAnimation directly.
And why does the code work when loading a mesh, not a geometry? Or will that one also be a ClonableSmartAsset soon?
I am just trying to figure out if I have to write an own AssetManager for the assembler, or if I have missed a vital part.
My usecase is loading stored binary data without knowing of what type the asset is.
The assetKey contains information on how to import the asset so no, it cannot be replaced by a method. Meshes require special cloing methods, hence special asset keys. You use loadAsset() e.g. for FilterPostProcessor binary files from the SDK.
Would it be bette to create an own assetkey wich would return an own assetprocessor?
If you have spatials with meshes save them as j3o.