Fixed minor timing bugs while running full test of record/playback

This commit is contained in:
GPayne
2021-04-26 21:29:52 -06:00
parent 7ceb4850c6
commit e95ca6c3e8
2 changed files with 10 additions and 11 deletions

View File

@@ -555,6 +555,7 @@ protected:
};
ExternInteraction _externInteract;
double _timestampRecordStarted = 0.0;
Timestamps _timestamps3RecordStarted;
double _timestampPlaybackStarted_application = 0.0;
double _timestampPlaybackStarted_simulation = 0.0;
double _timestampApplicationStarted_simulation = 0.0;
@@ -665,7 +666,6 @@ protected:
bool _playbackActive_time = false;
bool _playbackActive_script = false;
bool _hasHitEndOfCameraKeyframes = false;
bool _setSimulationTimeWithNextCameraKeyframe = false;
bool _playbackStartedPaused = false;
double _playbackPauseOffset = 0.0;
double _previousTime = 0.0;
@@ -702,6 +702,7 @@ protected:
"NavigationHandler.OrbitalNavigator.RetargetAnchor",
"NavigationHandler.OrbitalNavigator.RetargetAim"
};
//A script that begins with an exact match of any of the strings contained in _scriptRejects will not be recorded
const std::vector<std::string> _scriptRejects = {
"openspace.sessionRecording",
"openspace.scriptScheduler.clear",

View File

@@ -230,7 +230,7 @@ bool SessionRecording::startRecording(const std::string& filename) {
//Record the current delta time as the first property to save in the file.
//This needs to be saved as a baseline whether or not it changes during recording.
Timestamps timestampsRecStarted = {
_timestamps3RecordStarted = {
_timestampRecordStarted,
0.0,
global::timeManager->time().j2000Seconds()
@@ -261,14 +261,13 @@ void SessionRecording::stopRecording() {
if (_state == SessionState::Recording) {
//Add all property baseline scripts to the beginning of the recording file
datamessagestructures::ScriptMessage smTmp;
Timestamps timeRecStart = generateCurrentTimestamp3(_timestampRecordStarted);
for (timelineEntry initPropScripts : _keyframesSavePropertiesBaseline_timeline) {
if (initPropScripts.keyframeType == RecordedType::Script) {
smTmp._script = _keyframesSavePropertiesBaseline_scripts
[initPropScripts.idxIntoKeyframeTypeArray];
saveSingleKeyframeScript(
smTmp,
timeRecStart,
_timestamps3RecordStarted,
_recordingDataMode,
_recordFile,
_keyframeBuffer
@@ -452,7 +451,6 @@ bool SessionRecording::startPlayback(std::string& filename,
_loadedNodes.clear();
populateListofLoadedSceneGraphNodes();
_setSimulationTimeWithNextCameraKeyframe = forceSimTimeAtStart;
if (!playbackAddEntriesToTimeline()) {
cleanUpPlayback();
return false;
@@ -463,6 +461,11 @@ bool SessionRecording::startPlayback(std::string& filename,
cleanUpPlayback();
return false;
}
if (forceSimTimeAtStart) {
Timestamps times = _timeline[_idxTimeline_cameraFirstInTimeline].t3stamps;
global::timeManager->setTimeNextFrame(Time(times.timeSim));
_saveRenderingCurrentRecordedTime = times.timeRec;
}
LINFO(fmt::format(
"Playback session started: ({:8.3f},0.0,{:13.3f}) with {}/{}/{} entries, "
@@ -1090,11 +1093,6 @@ bool SessionRecording::playbackCamera() {
_playbackLineNum
);
if (_setSimulationTimeWithNextCameraKeyframe) {
global::timeManager->setTimeNextFrame(Time(times.timeSim));
_setSimulationTimeWithNextCameraKeyframe = false;
_saveRenderingCurrentRecordedTime = times.timeRec;
}
interaction::KeyframeNavigator::CameraPose pbFrame(std::move(kf));
if (success) {
success = addKeyframe(
@@ -1184,7 +1182,7 @@ bool SessionRecording::readCameraKeyframeBinary(Timestamps& times,
));
return false;
}
times.timeOs = kf._timestamp;
//times.timeOs = kf._timestamp;
if (!file) {
LINFO(fmt::format(