- make OgreMeshKey-based import not fail on missing material

- add actual OgreMeshKey.setMaterialName() setter

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8114 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent c6d72764cd
commit 59f9f09e5f
  1. 12
      engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java
  2. 4
      engine/src/ogre/com/jme3/scene/plugins/ogre/OgreMeshKey.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 {

@ -66,4 +66,8 @@ public class OgreMeshKey extends ModelKey {
return materialName;
}
public void setMaterialName(String name) {
materialName = name;
}
}

Loading…
Cancel
Save