Hi all,
I'm creating some objects under blender that are the aggregation of other blend files, and in the end, I select all the parts of my scene, and export them as .obj (that's what I'm using all the time). This is the first time I tried to export a whole scene. Then in my code, I run as usual something like
ObjToJme converter=new ObjToJme();
try {
URL objFile=RoomsManager.class.getClassLoader().getResource(path);
converter.setProperty("mtllib",objFile);
converter.setProperty("texdir",objFile);
ByteArrayOutputStream BO=new ByteArrayOutputStream();
InsideMap.logger.info("Starting to convert .obj to .jme");
converter.convert(objFile.openStream(),BO);
//jbr.setProperty("texurl",new File(".").toURL());
InsideMap.logger.info("Done converting, now watch how fast it loads!");
long time=System.currentTimeMillis();
TriMesh r=(TriMesh)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
InsideMap.logger.info("Finished loading time is "+(System.currentTimeMillis()-time));
r.setModelBound(new BoundingBox());
r.updateModelBound();
return r;
} catch (IOException e) {
InsideMap.logger.logp(Level.SEVERE, this.getClass().toString(),"simpleInitGame()", "Exception", e);
}
but then! I receive an error message saying that at the line
TriMesh r=(TriMesh)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
'cannot cast Node to TriMesh'
first I tried to modifiy quickly the code
Node r=(Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
but then I only managed to import part of the scene (some objects but not all)
finally I just did this to get around the problem : I broke my blender scene, imported each obejct and merged them in jme ....
is there a way I could manage to import a whole blender scene ?
(btw after exporting the whole scene through blender, I tried to read the .obj with blender, and it was fine, the whole scene was there)
any idea ?
Thanks,
Adrien