From 902da116e782869df0262770c03a4a878eef91ba Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 9 Jan 2024 15:34:54 +0100 Subject: [PATCH] Remove interesting times (closes #2991) --- include/openspace/scene/scene.h | 19 --------------- modules/imgui/src/guispacetimecomponent.cpp | 24 ------------------- .../include/topics/flightcontrollertopic.h | 1 - .../src/topics/flightcontrollertopic.cpp | 19 --------------- src/scene/scene.cpp | 9 ------- src/scene/scene_lua.inl | 10 -------- 6 files changed, 82 deletions(-) diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index 7aed9df083..72580a8a9e 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -213,24 +213,6 @@ public: */ void updateInterpolations(); - /** - * Adds the provided \p time as an interesting time to this scene. The same time can - * be added multiple times. - * - * \param time The time that should be added - * - * \pre \p time.time must not be empty - * \pre \p time.name must not be empty - */ - void addInterestingTime(InterestingTime time); - - /** - * Returns the list of all interesting times that are defined for this scene. - * - * \return The list of all interesting times that are defined for this scene - */ - const std::vector& interestingTimes() const; - /** * Returns the Lua library that contains all Lua functions available to change the * scene graph. @@ -334,7 +316,6 @@ private: SceneGraphNode _rootDummy; std::unique_ptr _initializer; std::string _profilePropertyName; - std::vector _interestingTimes; bool _valueIsTable = false; std::mutex _programUpdateLock; diff --git a/modules/imgui/src/guispacetimecomponent.cpp b/modules/imgui/src/guispacetimecomponent.cpp index 0a7bf9dbc7..336000d2f5 100644 --- a/modules/imgui/src/guispacetimecomponent.cpp +++ b/modules/imgui/src/guispacetimecomponent.cpp @@ -192,30 +192,6 @@ void GuiSpaceTimeComponent::render() { CaptionText("Time Controls"); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.f); - const std::vector& interestingTimes = - global::renderEngine->scene()->interestingTimes(); - if (!interestingTimes.empty()) { - ImGui::Text("%s", "Interesting Times"); - - for (size_t i = 0; i < interestingTimes.size(); ++i) { - const Scene::InterestingTime& t = interestingTimes[i]; - if (ImGui::Button(t.name.c_str())) { - - // No sync or send because time settings are always synced and sent - // to the connected nodes and peers - global::scriptEngine->queueScript( - "openspace.time.setTime(\"" + t.time + "\")", - scripting::ScriptEngine::ShouldBeSynchronized::No, - scripting::ScriptEngine::ShouldSendToRemote::No - ); - } - - if (i != interestingTimes.size() - 1) { - ImGui::SameLine(); - } - } - } - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.f); ImGui::Text( diff --git a/modules/server/include/topics/flightcontrollertopic.h b/modules/server/include/topics/flightcontrollertopic.h index 4a58a30696..97afe52a41 100644 --- a/modules/server/include/topics/flightcontrollertopic.h +++ b/modules/server/include/topics/flightcontrollertopic.h @@ -63,7 +63,6 @@ private: void disconnect(); void processInputState(const nlohmann::json& json); void setFocusNodes(); - void setInterestingTimes(); void updateView(const nlohmann::json& json) const; void changeFocus(const nlohmann::json& json) const; void setRenderableEnabled(const nlohmann::json& json) const; diff --git a/modules/server/src/topics/flightcontrollertopic.cpp b/modules/server/src/topics/flightcontrollertopic.cpp index ec1b172e0e..4bba9cfa65 100644 --- a/modules/server/src/topics/flightcontrollertopic.cpp +++ b/modules/server/src/topics/flightcontrollertopic.cpp @@ -213,7 +213,6 @@ void FlightControllerTopic::connect() { std::fill(_inputState.axes.begin(), _inputState.axes.end(), 0.f); _payload[TypeKey] = Connect; setFocusNodes(); - setInterestingTimes(); _payload[Connect][FocusNodesKey] = _focusNodes; _payload[Connect][AllNodesKey] = _allNodes; _payload[Connect][InterestingTimesKey] = _interestingTimes; @@ -258,25 +257,7 @@ void FlightControllerTopic::setFocusNodes() { } } -void FlightControllerTopic::setInterestingTimes() { - std::vector times = - global::renderEngine->scene()->interestingTimes(); - - std::sort( - times.begin(), - times.end(), - [](Scene::InterestingTime lhs, Scene::InterestingTime rhs) { - return lhs.name < rhs.name; - } - ); - - for (const Scene::InterestingTime& t : times) { - _interestingTimes[t.name] = t.time; - } -} - void FlightControllerTopic::updateView(const nlohmann::json& json) const { - if (json.find(RenderableKey) != json.end()) { setRenderableEnabled(json); } diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 5b020fb8df..1134d008fd 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -572,14 +572,6 @@ void Scene::updateInterpolations() { ); } -void Scene::addInterestingTime(InterestingTime time) { - _interestingTimes.push_back(std::move(time)); -} - -const std::vector& Scene::interestingTimes() const { - return _interestingTimes; -} - void Scene::setPropertiesFromProfile(const Profile& p) { ghoul::lua::LuaState L(ghoul::lua::LuaState::IncludeStandardLibrary::Yes); @@ -873,7 +865,6 @@ scripting::LuaLibrary Scene::luaLibrary() { codegen::lua::SceneGraphNodes, codegen::lua::NodeByRenderableType, codegen::lua::ScreenSpaceRenderables, - codegen::lua::AddInterestingTime, codegen::lua::WorldPosition, codegen::lua::WorldRotation, codegen::lua::SetParent, diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index f5728f5ed5..3d7bc74554 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -924,16 +924,6 @@ namespace { return res; } -/** - * Adds an interesting time to the current scene. The first argument is the name of the - * time and the second argument is the time itself in the format YYYY-MM-DDThh:mm:ss.uuu - */ -[[codegen::luawrap]] void addInterestingTime(std::string name, std::string time) { - openspace::global::renderEngine->scene()->addInterestingTime( - { std::move(name), std::move(time) } - ); -} - /** * Returns the world position of the scene graph node with the given string as identifier. */