Add function to return a list of all tags

This commit is contained in:
Alexander Bock
2023-01-21 21:02:02 +01:00
parent 6c1692c2a8
commit 2926250be9
2 changed files with 17 additions and 0 deletions

View File

@@ -253,6 +253,13 @@ public:
std::vector<properties::Property*> 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<std::string> allTags();
private:
/**
* Accepts string version of a property value from a profile, converts it to the

View File

@@ -754,6 +754,16 @@ std::vector<properties::Property*> Scene::propertiesMatchingRegex(
return findMatchesInAllProperties(propertyString, allProperties(), "");
}
std::vector<std::string> Scene::allTags() {
std::set<std::string> result;
for (SceneGraphNode* node : _topologicallySortedNodes) {
const std::vector<std::string>& tags = node->tags();
result.insert(tags.begin(), tags.end());
}
return std::vector<std::string>(result.begin(), result.end());
}
scripting::LuaLibrary Scene::luaLibrary() {
return {
"",