diff --git a/engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java b/engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java index a366a61f7..791ce96c4 100644 --- a/engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java +++ b/engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java @@ -47,9 +47,13 @@ import java.io.IOException; import java.io.InputStream; import java.util.Locale; import java.util.Scanner; +import java.util.logging.Level; +import java.util.logging.Logger; public class MTLLoader implements AssetLoader { + private static final Logger logger = Logger.getLogger(MTLLoader.class.getName()); + protected Scanner scan; protected MaterialList matList; //protected Material material; @@ -242,7 +246,7 @@ public class MTLLoader implements AssetLoader { // Ke: emission color skipLine(); }else{ - System.out.println("Unknown statement in MTL! "+cmd); + logger.log(Level.WARNING, "Unknown statement in MTL! {0}", cmd); skipLine(); } diff --git a/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java b/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java index 3f56c3966..b6b66d08b 100644 --- a/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java +++ b/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java @@ -49,6 +49,7 @@ import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.mesh.IndexBuffer; import com.jme3.scene.mesh.IndexIntBuffer; import com.jme3.scene.mesh.IndexShortBuffer; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.FloatBuffer; @@ -61,7 +62,6 @@ import java.util.Map.Entry; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; -import java.util.regex.Pattern; /** * Reads OBJ format models. @@ -321,6 +321,8 @@ public final class OBJLoader implements AssetLoader { if (!name.toLowerCase().endsWith(".mtl")) throw new IOException("Expected .mtl file! Got: " + name); + // NOTE: Cut off any relative/absolute paths + name = new File(name).getName(); matList = (MaterialList) assetManager.loadAsset(key.getFolder() + name); if (matList != null){ @@ -373,7 +375,7 @@ public final class OBJLoader implements AssetLoader { nextStatement(); }else{ // skip entire command until next line - System.out.println("Unknown statement in OBJ! "+cmd); + logger.log(Level.WARNING, "Unknown statement in OBJ! {0}", cmd); nextStatement(); } diff --git a/engine/src/core/com/jme3/material/MatParam.java b/engine/src/core/com/jme3/material/MatParam.java index 77b586487..ddf462db6 100644 --- a/engine/src/core/com/jme3/material/MatParam.java +++ b/engine/src/core/com/jme3/material/MatParam.java @@ -207,6 +207,10 @@ public class MatParam implements Savable, Cloneable { case TextureCubeMap: Texture texVal = (Texture) value; TextureKey texKey = (TextureKey) texVal.getKey(); + if (texKey == null){ + throw new UnsupportedOperationException("The specified MatParam cannot be represented in J3M"); + } + String ret = ""; if (texKey.isFlipY()) { ret += "Flip ";