From b68e56c5bfed0e28ddd7b6bf70cbb83579026884 Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Sun, 20 Mar 2011 08:55:42 +0000 Subject: [PATCH] MeshLoader catch AssetNotFoundException when trying to locate the .material of a model git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7056 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../ogre/com/jme3/scene/plugins/ogre/MeshLoader.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 544206af4..c92689eff 100644 --- a/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java +++ b/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java @@ -38,6 +38,7 @@ import com.jme3.asset.AssetInfo; import com.jme3.asset.AssetKey; import com.jme3.asset.AssetLoader; import com.jme3.asset.AssetManager; +import com.jme3.asset.AssetNotFoundException; import com.jme3.material.Material; import com.jme3.material.MaterialList; import com.jme3.math.ColorRGBA; @@ -797,12 +798,17 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { } assetManager = info.getManager(); - OgreMeshKey meshKey = null; + OgreMeshKey meshKey = null; if (key instanceof OgreMeshKey){ meshKey = (OgreMeshKey) key; materialList = meshKey.getMaterialList(); - }else{ - materialList = (MaterialList) assetManager.loadAsset(folderName + meshName + ".material"); + }else{ + try { + materialList = (MaterialList) assetManager.loadAsset(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}); + } + } XMLReader xr = XMLReaderFactory.createXMLReader();