Hello All,
I am trying to import models from blender, and I've seen some threads on this forum as well as this tutorial:
http://www.jmonkeyengine.com/wiki/doku.php?id=importing_models_from_blender
However, the code in the wiki and the discussions I've found here seem to all use the deprecated class JMEBinaryReader. My questions are:
1) Is there a way to import the xml file generated by heevee's blender script without using deprecated code?
2) Is there an alternate way to import from Blender? I tried 3ds, but that seems to generate some odd material changes.
Any help would be appreciated. Thanks!
you will have to use BinaryImporter… something like this:(here I use to load a 3DS model, but you can use XML from blender, just replacing MaxToJme with XMLtoBinary)
// define the location
URL modelToLoad = CriaLaboratorioCentral.class.getClassLoader().getResource(
"modelos/PIAS.3DS");
Node modelo = new Node();
try {
//Max Converter
MaxToJme C1 = new MaxToJme();
//Output ByteArray
ByteArrayOutputStream BO = new ByteArrayOutputStream();
//converts
C1.convert(new BufferedInputStream(modelToLoad.openStream()), BO);
//Here is What you have to do.... Use BinaryImporter
modelo = (Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray())); <
//model Bound
modelo.setModelBound(new OrientedBoundingBox());
modelo.updateModelBound();
} catch (IOException e) {
System.out.println("Ops, exceptions...:" + e);
e.printStackTrace();
}
I hope that it helps you...
any question... you can post here... ;) ;)
BinaryImporter + XML = no
yes it's deprecated but its still there at this point expressly to support the xml format
Oh… yes… sorry… XD
mcbeth said:
BinaryImporter + XML = no
Yeah, you can still use it deprecated... :)
Yes, basically until there is a XMLImporter/Exporter that extends JMEImporter/Exporter you'll have to deal with the deprecation warnings.