diff --git a/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java b/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java index 35e705535..7a11c27a3 100644 --- a/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java +++ b/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java @@ -784,9 +784,17 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { String materialName = meshKey.getMaterialName(); if (materialList == null) { if (materialName != null) { - materialList = (MaterialList) assetManager.loadAsset(new OgreMaterialKey(folderName + materialName + ".material")); + try { + materialList = (MaterialList) assetManager.loadAsset(new OgreMaterialKey(folderName + materialName + ".material")); + } catch (AssetNotFoundException e) { + logger.log(Level.WARNING, "Cannot locate {0}{1}.material for model {2}{3}.{4}", new Object[]{folderName, materialName, folderName, meshName, ext}); + } } else { - materialList = (MaterialList) assetManager.loadAsset(new OgreMaterialKey(folderName + meshName + ".material")); + try { + materialList = (MaterialList) assetManager.loadAsset(new OgreMaterialKey(folderName + meshName + ".material")); + } catch (AssetNotFoundException e) { + logger.log(Level.WARNING, "Cannot locate {0}{1}.material for model {2}{3}.{4}", new Object[]{folderName, meshName, folderName, meshName, ext}); + } } } } else { diff --git a/engine/src/ogre/com/jme3/scene/plugins/ogre/OgreMeshKey.java b/engine/src/ogre/com/jme3/scene/plugins/ogre/OgreMeshKey.java index 8919e0794..a2b54f087 100644 --- a/engine/src/ogre/com/jme3/scene/plugins/ogre/OgreMeshKey.java +++ b/engine/src/ogre/com/jme3/scene/plugins/ogre/OgreMeshKey.java @@ -65,5 +65,9 @@ public class OgreMeshKey extends ModelKey { public String getMaterialName() { return materialName; } + + public void setMaterialName(String name) { + materialName = name; + } }