}
@Override
public void read(JmeImporter im) throws IOException {
super.read(im);
InputCapsule ic = im.getCapsule(this);
mesh = (Mesh) ic.readSavable("mesh", null);
material = null;
String matName = ic.readString("materialName", null);
if (matName != null) {
// Material name is set,
// Attempt to load material via J3M
try {
material = im.getAssetManager().loadMaterial(matName);
} catch (AssetNotFoundException ex) {
// Cannot find J3M file.
logger.log(Level.FINE, "Cannot locate {0} for geometry {1}", new Object[]{matName, key});
}
}
// If material is NULL, try to load it from the geometry
if (material == null) {
material = (Material) ic.readSavable("material", null);
}
ignoreTransform = ic.readBoolean("ignoreTransform", false);
if (ic.getSavableVersion(Geometry.class) == 0) {
// Fix shared mesh (if set)
Mesh sharedMesh = getUserData(UserData.JME_SHAREDMESH);
if (sharedMesh != null) {
getMesh().extractVertexData(sharedMesh);
}