- fix writing description file for texture atlas

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9048 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 3031875264
commit 576428d2ef
  1. 12
      sdk/jme3-core/src/com/jme3/gde/core/texture/BufferedImageTextureAtlas.java

@ -89,13 +89,14 @@ public class BufferedImageTextureAtlas {
}
public void write(FileObject file) {
BufferedWriter atlas = null;
try {
ImageIO.write(image, "png", file.getOutputStream());
FileObject atlasFile = file.getParent().getFileObject(file.getName(), "atl");
if (atlasFile == null) {
atlasFile = file.getParent().createData(file.getName(), "atl");
}
BufferedWriter atlas = new BufferedWriter(new OutputStreamWriter(atlasFile.getOutputStream()));
atlas = new BufferedWriter(new OutputStreamWriter(atlasFile.getOutputStream()));
for (Map.Entry<String, Rectangle> e : rectangleMap.entrySet()) {
Rectangle r = e.getValue();
@ -103,9 +104,16 @@ public class BufferedImageTextureAtlas {
atlas.newLine();
}
atlas.close();
} catch (IOException e) {
Exceptions.printStackTrace(e);
} finally {
if (atlas != null) {
try {
atlas.close();
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
}
}

Loading…
Cancel
Save