I am using the following tutorial to import and export nodes and serialize them: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:save_and_load
My issue is that I have a node that contains several nodes (and each of them have a geometry with a certain unique material).
When I import, I am getting all these nodes back and the geometry but they all have the same default material as if the material variable was never passed. The code does handle materials no?
For this to make sense I use the code below to export:
// serialize the node into a j3o and save in animation folder
BinaryExporter exporter = BinaryExporter.getInstance();
tempoSerial = new File( "chapter"+ (counter) +".j3o");
try {
exporter.save(nodeToSerialize, tempoSerial);
} catch (IOException ex) {
System.err.println("Animatable serialization error: exception while exporting to .j3o!");
}
And this is the code below to import:
// Import j3o node
getAssetManager().registerLocator(VisitRecording.getLastVisitedDirectory(), FileLocator.class);
Node loadedNode = (Node) getAssetManager().loadModel(file.getName());
// NODES ATTACH
nodeAtt= (Node) loadedNode.getChild("Chapters");
rootNode.attachChild(nodeAtt);