* Added fix for when an mesh xml animation has no tracks will no longer throw NPE

* FileLocator now supports "." as a path

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7990 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent c5aba505fc
commit 77dd6761ee
  1. 5
      engine/src/core/com/jme3/animation/AnimChannel.java
  2. 3
      engine/src/core/com/jme3/animation/BoneAnimation.java
  3. 14
      engine/src/desktop/com/jme3/asset/plugins/FileLocator.java

@ -344,11 +344,12 @@ public final class AnimChannel {
time += tpf * speed;
if (animation.getLength() > 0){
if (time >= animation.getLength())
if (time >= animation.getLength()) {
control.notifyAnimCycleDone(this, animation.getName());
else if (time < 0)
} else if (time < 0) {
control.notifyAnimCycleDone(this, animation.getName());
}
}
time = clampWrapTime(time, animation.getLength(), loopMode);
if (time < 0){

@ -113,6 +113,9 @@ public final class BoneAnimation implements Animation, Savable, Cloneable {
BitSet affectedBones = channel.getAffectedBones();
Skeleton skeleton = control.getSkeleton();
if (tracks == null)
return;
for (int i = 0; i < tracks.length; i++) {
if (affectedBones == null
|| affectedBones.get(tracks[i].getTargetBoneIndex())) {

@ -57,10 +57,15 @@ public class FileLocator implements AssetLocator {
if (rootPath == null)
throw new NullPointerException();
root = new File(rootPath);
if (!root.isDirectory())
try {
root = new File(rootPath).getCanonicalFile();
if (!root.isDirectory()){
throw new IllegalArgumentException("Given root path \"" + root + "\" not a directory");
}
} catch (IOException ex) {
throw new AssetLoadException("Root path is invalid", ex);
}
}
private static class AssetInfoFile extends AssetInfo {
@ -76,7 +81,9 @@ public class FileLocator implements AssetLocator {
try{
return new FileInputStream(file);
}catch (FileNotFoundException ex){
return null;
// NOTE: Can still happen even if file.exists() is true, e.g.
// permissions issue and similar
throw new AssetLoadException("Failed to open file: " + file, ex);
}
}
}
@ -97,7 +104,6 @@ public class FileLocator implements AssetLocator {
throw new AssetLoadException("Failed to get file canonical path " + file, ex);
}
return new AssetInfoFile(manager, key, file);
}else{
return null;

Loading…
Cancel
Save