Fixed a bug in AnimChannel which would cause it to keep repeatedly issuing Animation Complete callbacks every frame once the animation did complete rather than issueing one once each time the animation completed.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10509 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Zer..om 12 years ago
parent 85b3e7e8c5
commit 4d16f05f23
  1. 10
      engine/src/core/com/jme3/animation/AnimChannel.java

@ -60,6 +60,7 @@ public final class AnimChannel {
private float speed;
private float timeBlendFrom;
private float speedBlendFrom;
private boolean notified=false;
private LoopMode loopMode, loopModeBlendFrom;
@ -262,6 +263,7 @@ public final class AnimChannel {
time = 0;
speed = 1f;
loopMode = LoopMode.Loop;
notified = false;
}
/**
@ -360,6 +362,7 @@ public final class AnimChannel {
}
}
animation = null;
notified = false;
}
void update(float tpf, TempVars vars) {
@ -392,10 +395,11 @@ public final class AnimChannel {
time += tpf * speed;
if (animation.getLength() > 0){
if (time >= animation.getLength()) {
control.notifyAnimCycleDone(this, animation.getName());
} else if (time < 0) {
if (!notified && (time >= animation.getLength() || time < 0)) {
control.notifyAnimCycleDone(this, animation.getName());
if (loopMode == LoopMode.DontLoop) {
notified = true;
}
}
}

Loading…
Cancel
Save