Move scriptscheduler time update to function that handles time progression

To avoid potential future problems with scriptscheduler time progressing when simulation time doesn't
This commit is contained in:
Emma Broman
2022-01-21 13:46:15 +01:00
parent 7714acf32b
commit df56cdb68f

View File

@@ -256,6 +256,10 @@ void TimeManager::progressTime(double dt) {
// will override any timeline operations.
_currentTime.data().setTime(_timeNextFrame.j2000Seconds());
_integrateFromTime.data().setTime(_timeNextFrame.j2000Seconds());
// Also make sure the script scheduler is up to date
global::scriptScheduler->setCurrentTime(_timeNextFrame.j2000Seconds());
_shouldSetTime = false;
using K = CallbackHandle;
@@ -272,6 +276,7 @@ void TimeManager::progressTime(double dt) {
std::function<bool(const KeyframeBase&, double)> comparisonFunc =
(global::sessionRecording->isPlayingBack()) ?
&compareKeyframeTimeWithTime_playbackWithFrames : &compareKeyframeTimeWithTime;
auto firstFutureKeyframe = std::lower_bound(
keyframes.begin(),
keyframes.end(),
@@ -406,7 +411,6 @@ void TimeManager::setTimeNextFrame(Time t) {
_shouldSetTime = true;
_timeNextFrame = std::move(t);
clearKeyframes();
global::scriptScheduler->setCurrentTime(t.j2000Seconds());
}
void TimeManager::setDeltaTime(double deltaTime) {