Problem with AssetManager while loading a Model type
- by user1204548
Today I've tried the AssetManager for the first time with .g3db files and I'm having some problems.
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load dependencies of asset: data/data
at com.badlogic.gdx.assets.AssetManager.handleTaskError(AssetManager.java:508)
at com.badlogic.gdx.assets.AssetManager.update(AssetManager.java:342)
at com.lostchg.martagdx3d.MartaGame.render(MartaGame.java:78)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:207)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load dependencies of asset: data/data
at com.badlogic.gdx.assets.AssetLoadingTask.handleAsyncLoader(AssetLoadingTask.java:119)
at com.badlogic.gdx.assets.AssetLoadingTask.update(AssetLoadingTask.java:89)
at com.badlogic.gdx.assets.AssetManager.updateTask(AssetManager.java:445)
at com.badlogic.gdx.assets.AssetManager.update(AssetManager.java:340)
... 4 more
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: data/data
at com.badlogic.gdx.utils.async.AsyncResult.get(AsyncResult.java:31)
at com.badlogic.gdx.assets.AssetLoadingTask.handleAsyncLoader(AssetLoadingTask.java:117)
... 7 more
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: data/data
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:140)
at com.badlogic.gdx.assets.loaders.TextureLoader.loadAsync(TextureLoader.java:72)
at com.badlogic.gdx.assets.loaders.TextureLoader.loadAsync(TextureLoader.java:41)
at com.badlogic.gdx.assets.AssetLoadingTask.call(AssetLoadingTask.java:69)
at com.badlogic.gdx.assets.AssetLoadingTask.call(AssetLoadingTask.java:34)
at com.badlogic.gdx.utils.async.AsyncExecutor$2.call(AsyncExecutor.java:49)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: data\data (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:132)
at com.badlogic.gdx.files.FileHandle.length(FileHandle.java:586)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:220)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:137)
... 9 more
Why it tries to load that unexisting file?
It seems that the AssetManager manages to load my .g3db file at first, because earlier the java console threw some errors related to the textures associated to the 3D scene having to be a power of 2.
Relevant code:
public void show() {
...
assets = new AssetManager();
assets.load("data/levelprueba2.g3db", Model.class);
loading = true;
...
}
private void doneLoading() {
Model model = assets.get("data/levelprueba2.g3db", Model.class);
for (int i = 0; i < model.nodes.size; i++) {
String id = model.nodes.get(i).id;
ModelInstance instance = new ModelInstance(model, id);
Node node = instance.getNode(id);
instance.transform.set(node.globalTransform);
node.translation.set(0,0,0);
node.scale.set(1,1,1);
node.rotation.idt();
instance.calculateTransforms();
instances.add(instance);
}
loading = false;
}
public void render(float delta) {
super.render(delta);
if (loading && assets.update())
doneLoading();
...
}
The error points to the line with the assets.update() method. Please, help!
Sorry for my bad English and my amateurish doubts.