Hey,
I am using the town.zip scene from the tutorials for a simple application. I put the .zip file in the Scenes subfolder of the project assets. I load it with
[java]assetManager.registerLocator("assets/Scenes/town.zip", ZipLocator.class);
sceneModel = assetManager.loadModel("main.scene");[/java]
In the SDK it works fine, but when I deploy the programme in a .jar it throws an AssetNotFoundException, but the town.zip is in the assets.jar in the lib directory of the deployment.
Which path do I have to use in the code?
registerLocator() is used for registering files outside of the assets folder, which can then be used with the assetManager
So what do I have to use instead?
No asset will ever start with “assets”. I don’t know enough about the ZipLocator to know if it will relookup a resource but I assume so.
Try changing “assets/Scenes/town.zip” to just “Scenes/town.zip” like any other asset.
@pspeed said:
No asset will ever start with "assets". I don't know enough about the ZipLocator to know if it will relookup a resource but I assume so.
Try changing "assets/Scenes/town.zip" to just "Scenes/town.zip" like any other asset.
Doesn't work.
a quick search yielded this from momoko_fan (1 year ago):
There might be a way to support loading zip files inside the assets .. although I don’t see the point
http://hub.jmonkeyengine.org/groups/android/forum/topic/assetmanager-problem-with-android#post-139399
So then your options are to expand town.zip into the assets folder or distribute it separately and use the resource locator to point to it.
Just unpack the zip to the assets folder and omit the locator.
Or you can expand the town zip into the assets folder and omit the locator.
:evilmonkey:
^^
I have unpacked all files to a new folder town and put it in the assets/Scenes directory. If I run the programme in the IDE using
[java]assetManager.loadModel(“Scenes/Town/main.scene”);[/java]
without any locator it works correct. But if I distribute the project both the .jar file and .exe file crashes because they are unable to find the scene.
If I use just [java]assetManager.loadModel(“main.scene”);[/java] it doesn’t work…
The ogre files are excluded as you should convert them to j3o. Just double-click the .scene file and then change the name to “Scenes/Town/main.j3o”.
@normen said:
The ogre files are excluded as you should convert them to j3o. Just double-click the .scene file and then change the name to "Scenes/Town/main.j3o".
That fixed it, thank you very much for this!