From 9cd1a514a66c662efcd7bda9cdea6c45c86ef2eb Mon Sep 17 00:00:00 2001 From: Nehon Date: Mon, 20 Oct 2014 15:09:38 +0200 Subject: [PATCH] Fixed an issue with cinematic that was causing the first frame of the cinematic to not be rendered. Also fix some static constant calls the non static way in MotionPath --- .../src/main/java/com/jme3/cinematic/Cinematic.java | 12 +++++++----- .../java/com/jme3/cinematic/events/MotionEvent.java | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java b/jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java index 2fa9b24bb..373f6fac0 100644 --- a/jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java +++ b/jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java @@ -328,11 +328,6 @@ public class Cinematic extends AbstractCinematicEvent implements AppState { */ @Override public void onUpdate(float tpf) { - for (int i = 0; i < cinematicEvents.size(); i++) { - CinematicEvent ce = cinematicEvents.get(i); - ce.internalUpdate(tpf); - } - int keyFrameIndex = timeLine.getKeyFrameIndexFromTime(time); //iterate to make sure every key frame is triggered @@ -343,6 +338,13 @@ public class Cinematic extends AbstractCinematicEvent implements AppState { } } + + for (int i = 0; i < cinematicEvents.size(); i++) { + CinematicEvent ce = cinematicEvents.get(i); + ce.internalUpdate(tpf); + } + + lastFetchedKeyFrame = keyFrameIndex; } diff --git a/jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java b/jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java index ff6ca5feb..2349461b5 100644 --- a/jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java +++ b/jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java @@ -171,10 +171,10 @@ public class MotionEvent extends AbstractCinematicEvent implements Control { public void internalUpdate(float tpf) { if (playState == PlayState.Playing) { time = time + (tpf * speed); - if (loopMode == loopMode.Loop && time < 0) { + if (loopMode == LoopMode.Loop && time < 0) { time = initialDuration; } - if ((time >= initialDuration || time < 0) && loopMode == loopMode.DontLoop) { + if ((time >= initialDuration || time < 0) && loopMode == LoopMode.DontLoop) { if (time >= initialDuration) { path.triggerWayPointReach(path.getNbWayPoints() - 1, this); }