From 5e5497ff18623a6f7b233aef5187424118ebe9e7 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 26 Apr 2024 19:06:39 +0200 Subject: [PATCH] Add `Tags.Find` utility #2492 --- Source/Engine/Level/Tags.cpp | 5 +++++ Source/Engine/Level/Tags.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/Source/Engine/Level/Tags.cpp b/Source/Engine/Level/Tags.cpp index c12fed765..f1edeb91c 100644 --- a/Source/Engine/Level/Tags.cpp +++ b/Source/Engine/Level/Tags.cpp @@ -55,6 +55,11 @@ Tag Tags::Get(const StringView& tagName) return tag; } +Tag Tags::Find(const StringView& tagName) +{ + return Tag(List.Find(tagName) + 1); +} + Array Tags::GetSubTags(Tag parentTag) { Array subTags; diff --git a/Source/Engine/Level/Tags.h b/Source/Engine/Level/Tags.h index 7c261f313..350c88796 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); + /// + /// Gets the tag. Returns empty one if it doesn't exist. + /// + /// The tag name. + /// The tag (might be empty). + API_FUNCTION() static Tag Find(const StringView& tagName); + /// /// Get all subtags of the specific Tag ///