From 6c5a81a67714af959d30c17367fe8f5773c57367 Mon Sep 17 00:00:00 2001 From: GPayne Date: Tue, 21 Sep 2021 14:59:39 -0600 Subject: [PATCH 1/4] Removed hard-coded path exepectations to allow drag-drop playback --- scripts/drag_drop_handler.lua | 2 +- src/interaction/sessionrecording.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/drag_drop_handler.lua b/scripts/drag_drop_handler.lua index 65ad51302f..36c2bd25ce 100644 --- a/scripts/drag_drop_handler.lua +++ b/scripts/drag_drop_handler.lua @@ -42,5 +42,5 @@ elseif extension == ".asset" then return [[openspace.printInfo("Adding asset: ']] .. filename .. [[' (drag-and-drop)"); openspace.asset.add("]] .. filename .. [[");]] .. ReloadUIScript elseif extension == ".osrec" or extension == ".osrectxt" then - return [[openspace.sessionRecording.startPlayback("]] .. basename .. [[")]] + return [[openspace.sessionRecording.startPlayback("]] .. filename .. [[")]] end diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index ab2501cd8a..4d5429e1b6 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -355,15 +355,15 @@ bool SessionRecording::startPlayback(std::string& filename, bool loop) { std::string absFilename; - // Run through conversion in case file is older. Does nothing if the file format - // is up-to-date - filename = convertFile(filename); if (std::filesystem::is_regular_file(filename)) { absFilename = filename; } else { absFilename = absPath("${RECORDINGS}/" + filename).string(); } + // Run through conversion in case file is older. Does nothing if the file format + // is up-to-date + absFilename = convertFile(absFilename); if (_state == SessionState::Recording) { LERROR("Unable to start playback while in session recording mode"); @@ -2202,7 +2202,7 @@ void SessionRecording::readFileIntoStringStream(std::string filename, std::ifstream& inputFstream, std::stringstream& stream) { - std::filesystem::path conversionInFilename = absPath("${RECORDINGS}/" + filename); + std::filesystem::path conversionInFilename = absPath(filename); if (!std::filesystem::is_regular_file(conversionInFilename)) { throw ConversionError(fmt::format( "Cannot find the specified playback file {} to convert", conversionInFilename From b00b90027865e266e9f527fdc28981ba44f8619b Mon Sep 17 00:00:00 2001 From: GPayne Date: Wed, 22 Sep 2021 15:58:59 -0600 Subject: [PATCH 2/4] Get rid of some sessionrecording warnings --- include/openspace/interaction/sessionrecording.h | 10 +++++----- src/interaction/sessionrecording.cpp | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/openspace/interaction/sessionrecording.h b/include/openspace/interaction/sessionrecording.h index bf3c1da067..c04a13ece1 100644 --- a/include/openspace/interaction/sessionrecording.h +++ b/include/openspace/interaction/sessionrecording.h @@ -832,16 +832,16 @@ public: ~SessionRecording_legacy_0085() {} char FileHeaderVersion[FileHeaderVersionLength+1] = "00.85"; char TargetConvertVersion[FileHeaderVersionLength+1] = "01.00"; - std::string fileFormatVersion() { + std::string fileFormatVersion() override { return std::string(FileHeaderVersion); } - std::string targetFileFormatVersion() { + std::string targetFileFormatVersion() override { return std::string(TargetConvertVersion); } - std::string getLegacyConversionResult(std::string filename, int depth); + std::string getLegacyConversionResult(std::string filename, int depth) override; struct ScriptMessage_legacy_0085 : public datamessagestructures::ScriptMessage { - void read(std::istream* in) { + void read(std::istream* in) override { size_t strLen; //Read string length from file in->read(reinterpret_cast(&strLen), sizeof(strLen)); @@ -860,7 +860,7 @@ public: protected: bool convertScript(std::stringstream& inStream, DataMode mode, int lineNum, - std::string& inputLine, std::ofstream& outFile, unsigned char* buffer); + std::string& inputLine, std::ofstream& outFile, unsigned char* buffer) override; }; } // namespace openspace diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index ab2501cd8a..9d612cec13 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -1777,7 +1777,6 @@ bool SessionRecording::addKeyframe(Timestamps t3stamps, void SessionRecording::moveAheadInTime() { using namespace std::chrono; - bool paused = global::timeManager->isPaused(); bool playbackPaused = (_state == SessionState::PlaybackPaused); if (playbackPaused) { _playbackPauseOffset From 2abf191f09d58a092934579e9e61b76984201068 Mon Sep 17 00:00:00 2001 From: GPayne Date: Wed, 22 Sep 2021 16:00:09 -0600 Subject: [PATCH 3/4] Improve scale value precision in ascii format recordings --- include/openspace/network/messagestructures.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/openspace/network/messagestructures.h b/include/openspace/network/messagestructures.h index effe727cbe..f7b0d78fab 100644 --- a/include/openspace/network/messagestructures.h +++ b/include/openspace/network/messagestructures.h @@ -196,7 +196,9 @@ struct CameraKeyframe { << std::fixed << std::setprecision(7) << _rotation.y << ' ' << std::fixed << std::setprecision(7) << _rotation.z << ' ' << std::fixed << std::setprecision(7) << _rotation.w << ' '; - out << std::scientific << _scale << ' '; + out << std::fixed + << std::setprecision(std::numeric_limits::max_digits10) + << _scale << ' '; if (_followNodeRotation) { out << "F "; } From 679d723930910336b5189c68fd2a011eb9d8017f Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Fri, 24 Sep 2021 15:02:12 +0200 Subject: [PATCH 4/4] Fix problems with camera paths when multiple nodes have the same position --- src/navigation/path.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/navigation/path.cpp b/src/navigation/path.cpp index ecb776b0d4..8e6b03cdff 100644 --- a/src/navigation/path.cpp +++ b/src/navigation/path.cpp @@ -291,7 +291,12 @@ SceneGraphNode* findNodeNearTarget(const SceneGraphNode* node) { global::navigationHandler->pathNavigator().relevantNodes(); for (SceneGraphNode* n : relevantNodes) { - if (n->identifier() == node->identifier()) { + bool isSame = (n->identifier() == node->identifier()); + // If the nodes are in the very same position, they are probably representing + // the same object + isSame |= glm::distance(n->worldPosition(), node->worldPosition()) < Epsilon; + + if (isSame) { continue; }