Merge branch 'RuanLucasGD-master'

This commit is contained in:
Wojtek Figat
2023-05-06 23:01:47 +02:00
2 changed files with 25 additions and 0 deletions

View File

@@ -55,6 +55,24 @@ Tag Tags::Get(const StringView& tagName)
return tag;
}
Array<Tag> Tags::GetSubTags(Tag parentTag)
{
Array<Tag> subTags;
const String& parentTagName = parentTag.ToString();
for (int i = 0; i < Tags::List.Count(); i++)
{
const Tag tag = Tag(i + 1);
const String& tagName = Tags::List[i];
if (tagName.StartsWith(parentTagName) && parentTag.Index != tag.Index)
{
subTags.Add(tag);
}
}
return subTags;
}
bool Tags::HasTag(const Array<Tag>& list, const Tag tag)
{
if (tag.Index == 0)

View File

@@ -92,6 +92,13 @@ API_CLASS(Static) class FLAXENGINE_API Tags
/// <returns>The tag.</returns>
API_FUNCTION() static Tag Get(const StringView& tagName);
/// <summary>
/// Get all subtags of the specific Tag
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
API_FUNCTION() static Array<Tag> GetSubTags(Tag tag);
public:
/// <summary>
/// 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.