* 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
This commit is contained in:
parent
c5aba505fc
commit
77dd6761ee
@ -344,10 +344,11 @@ 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);
|
||||
|
@ -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())) {
|
||||
|
@ -56,10 +56,15 @@ public class FileLocator implements AssetLocator {
|
||||
public void setRootPath(String rootPath) {
|
||||
if (rootPath == null)
|
||||
throw new NullPointerException();
|
||||
|
||||
root = new File(rootPath);
|
||||
if (!root.isDirectory())
|
||||
throw new IllegalArgumentException("Given root path \"" + root + "\" not a directory");
|
||||
|
||||
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…
x
Reference in New Issue
Block a user