* 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,11 +344,12 @@ public final class AnimChannel {
|
|||||||
time += tpf * speed;
|
time += tpf * speed;
|
||||||
|
|
||||||
if (animation.getLength() > 0){
|
if (animation.getLength() > 0){
|
||||||
if (time >= animation.getLength())
|
if (time >= animation.getLength()) {
|
||||||
control.notifyAnimCycleDone(this, animation.getName());
|
control.notifyAnimCycleDone(this, animation.getName());
|
||||||
else if (time < 0)
|
} else if (time < 0) {
|
||||||
control.notifyAnimCycleDone(this, animation.getName());
|
control.notifyAnimCycleDone(this, animation.getName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
time = clampWrapTime(time, animation.getLength(), loopMode);
|
time = clampWrapTime(time, animation.getLength(), loopMode);
|
||||||
if (time < 0){
|
if (time < 0){
|
||||||
|
@ -113,6 +113,9 @@ public final class BoneAnimation implements Animation, Savable, Cloneable {
|
|||||||
BitSet affectedBones = channel.getAffectedBones();
|
BitSet affectedBones = channel.getAffectedBones();
|
||||||
Skeleton skeleton = control.getSkeleton();
|
Skeleton skeleton = control.getSkeleton();
|
||||||
|
|
||||||
|
if (tracks == null)
|
||||||
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < tracks.length; i++) {
|
for (int i = 0; i < tracks.length; i++) {
|
||||||
if (affectedBones == null
|
if (affectedBones == null
|
||||||
|| affectedBones.get(tracks[i].getTargetBoneIndex())) {
|
|| affectedBones.get(tracks[i].getTargetBoneIndex())) {
|
||||||
|
@ -57,10 +57,15 @@ public class FileLocator implements AssetLocator {
|
|||||||
if (rootPath == null)
|
if (rootPath == null)
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
|
|
||||||
root = new File(rootPath);
|
try {
|
||||||
if (!root.isDirectory())
|
root = new File(rootPath).getCanonicalFile();
|
||||||
|
if (!root.isDirectory()){
|
||||||
throw new IllegalArgumentException("Given root path \"" + root + "\" not a directory");
|
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 {
|
private static class AssetInfoFile extends AssetInfo {
|
||||||
|
|
||||||
@ -76,7 +81,9 @@ public class FileLocator implements AssetLocator {
|
|||||||
try{
|
try{
|
||||||
return new FileInputStream(file);
|
return new FileInputStream(file);
|
||||||
}catch (FileNotFoundException ex){
|
}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);
|
throw new AssetLoadException("Failed to get file canonical path " + file, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new AssetInfoFile(manager, key, file);
|
return new AssetInfoFile(manager, key, file);
|
||||||
}else{
|
}else{
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user