* Prevent crash in Animation if no tracks are set on animation
* Ogre3D .material files will still load even if a single texture is not found * Show any exceptions that occur in material loading (if any are thrown) git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8519 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
45af20de0c
commit
36b6ab3286
engine/src
core/com/jme3/animation
ogre/com/jme3/scene/plugins/ogre
@ -106,6 +106,9 @@ public class Animation implements Savable, Cloneable {
|
||||
* @param channel the animation channel
|
||||
*/
|
||||
void setTime(float time, float blendAmount, AnimControl control, AnimChannel channel, TempVars vars) {
|
||||
if (tracks == null)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < tracks.length; i++){
|
||||
tracks[i].setTime(time, blendAmount, control, channel, vars);
|
||||
}
|
||||
|
@ -36,6 +36,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.asset.TextureKey;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.MaterialList;
|
||||
@ -140,7 +141,13 @@ public class MaterialLoader implements AssetLoader {
|
||||
key.setGenerateMips(genMips);
|
||||
key.setAsCube(cubic);
|
||||
|
||||
Texture loadedTexture = assetManager.loadTexture(key);
|
||||
Texture loadedTexture;
|
||||
try {
|
||||
loadedTexture = assetManager.loadTexture(key);
|
||||
} catch (AssetNotFoundException ex){
|
||||
logger.log(Level.WARNING, "Failed to load texture " + key + " for material " + matName, ex);
|
||||
loadedTexture = null;
|
||||
}
|
||||
if (loadedTexture == null){
|
||||
ByteBuffer tempData = BufferUtils.createByteBuffer(3);
|
||||
tempData.put((byte)0xFF).put((byte)0x00).put((byte)0x00);
|
||||
|
@ -785,12 +785,14 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
|
||||
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});
|
||||
logger.log(Level.WARNING, "", e);
|
||||
}
|
||||
} else {
|
||||
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});
|
||||
logger.log(Level.WARNING, "", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -799,6 +801,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
|
||||
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});
|
||||
logger.log(Level.WARNING, "", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user