From 2926250be979eb626876d5cf9fa3cb046702740a Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 21 Jan 2023 21:02:02 +0100 Subject: [PATCH] Add function to return a list of all tags --- include/openspace/scene/scene.h | 7 +++++++ src/scene/scene.cpp | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index 7a50b37c93..576282ee3d 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -253,6 +253,13 @@ public: std::vector propertiesMatchingRegex( std::string propertyString); + /** + * Returns a list of all unique tags that are used in the currently loaded scene. + * + * \return A list of all unique tags that are used in the currently loaded scene. + */ + std::vector allTags(); + private: /** * Accepts string version of a property value from a profile, converts it to the diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 46fa8a94e2..ed8654f588 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -754,6 +754,16 @@ std::vector Scene::propertiesMatchingRegex( return findMatchesInAllProperties(propertyString, allProperties(), ""); } +std::vector Scene::allTags() { + std::set result; + for (SceneGraphNode* node : _topologicallySortedNodes) { + const std::vector& tags = node->tags(); + result.insert(tags.begin(), tags.end()); + } + + return std::vector(result.begin(), result.end()); +} + scripting::LuaLibrary Scene::luaLibrary() { return { "",