diff --git a/Source/Engine/Level/Tags.cpp b/Source/Engine/Level/Tags.cpp index b9b3b1f79..b16928630 100644 --- a/Source/Engine/Level/Tags.cpp +++ b/Source/Engine/Level/Tags.cpp @@ -55,6 +55,24 @@ Tag Tags::Get(const StringView& tagName) return tag; } +Array Tags::GetSubTags(Tag parentTag) +{ + Array subTags = Array(); + + auto _parentTagName = parentTag.ToString(); + + for (int i = 0; i < Tags::List.Count(); i++) + { + auto& subTagName = Tags::List[i]; + if (subTagName.Contains(_parentTagName) && subTagName != _parentTagName) + { + subTags.Add(Tags::Get(subTagName)); + } + } + + return subTags; +} + bool Tags::HasTag(const Array& list, const Tag& tag) { if (tag.Index == 0) diff --git a/Source/Engine/Level/Tags.h b/Source/Engine/Level/Tags.h index 03b09a1fc..04ba76a23 100644 --- a/Source/Engine/Level/Tags.h +++ b/Source/Engine/Level/Tags.h @@ -92,6 +92,13 @@ API_CLASS(Static) class FLAXENGINE_API Tags /// The tag. API_FUNCTION() static Tag Get(const StringView& tagName); + /// + /// Get all subtags of the specific Tag + /// + /// + /// + API_FUNCTION() static Array GetSubTags(Tag tag); + public: /// /// Checks if the list of tags contains a given tag (including parent tags check). For example, HasTag({"A.B"}, "A") returns true, for exact check use HasTagExact.