diff options
author | Julien Gouesse <[email protected]> | 2014-07-13 01:54:17 +0200 |
---|---|---|
committer | Julien Gouesse <[email protected]> | 2014-07-13 01:54:17 +0200 |
commit | edbfbc733dd7b08c833246562814074721aa1c1d (patch) | |
tree | c2aed992b46d073a164bd2d0a4f73259eff4358c /ardor3d-extras/src | |
parent | 89862bbdfbe9bf0b7b3575e6adb07b4a86ce1588 (diff) |
Drives the WaveFront OBJ exporter more robust when manipulating a texture key
Diffstat (limited to 'ardor3d-extras/src')
-rw-r--r-- | ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java index de81d4a..0078067 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java @@ -357,25 +357,30 @@ public class ObjExporter { final TextureState textureState = (TextureState) mesh.getLocalRenderState(StateType.Texture); if (textureState.isEnabled() && textureState.getTexture() != null) { final TextureKey tKey = textureState.getTexture().getTextureKey(); - final String tmpTextureName = tKey.getSource().getName(); - final int lastIndexOfUnixPathSeparator = tmpTextureName.lastIndexOf('/'); - final int lastIndexOfWindowsPathSeparator = tmpTextureName.lastIndexOf('\\'); - if (lastIndexOfUnixPathSeparator != -1) { - textureName = tmpTextureName.substring(lastIndexOfUnixPathSeparator + 1); - } else { - if (lastIndexOfWindowsPathSeparator != -1) { - textureName = tmpTextureName.substring(lastIndexOfWindowsPathSeparator + 1); + if (tKey != null && tKey.getSource() != null) { + final String tmpTextureName = tKey.getSource().getName(); + final int lastIndexOfUnixPathSeparator = tmpTextureName.lastIndexOf('/'); + final int lastIndexOfWindowsPathSeparator = tmpTextureName.lastIndexOf('\\'); + if (lastIndexOfUnixPathSeparator != -1) { + textureName = tmpTextureName.substring(lastIndexOfUnixPathSeparator + 1); } else { - textureName = tmpTextureName; + if (lastIndexOfWindowsPathSeparator != -1) { + textureName = tmpTextureName.substring(lastIndexOfWindowsPathSeparator + 1); + } else { + textureName = tmpTextureName; + } + } + if (tKey.isFlipped()) { + ObjExporter.logger.warning("The texture " + tmpTextureName + + " will have to be flipped manually when loading this OBJ file"); + } else { + ObjExporter.logger.warning("The texture " + tmpTextureName + + " might need to be flipped manually when loading this OBJ file"); } - } - if (tKey.isFlipped()) { - ObjExporter.logger.warning("The texture " + tmpTextureName - + " will have to be flipped manually when loading this OBJ file"); } else { - ObjExporter.logger.warning("The texture " + tmpTextureName - + " might need to be flipped manually when loading this OBJ file"); + textureName = null; } + } else { textureName = null; } |