From d9a1eb349df0a0c5ae8ac7c9b38e0d24bdfdeb53 Mon Sep 17 00:00:00 2001 From: Wiktor Kocielski Date: Wed, 6 Sep 2023 05:43:27 +0300 Subject: [PATCH] Implement tags recursive addition --- Source/Engine/Level/Actor.cpp | 7 +++++++ Source/Engine/Level/Actor.h | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Level/Actor.cpp b/Source/Engine/Level/Actor.cpp index a0aa01cba..388379237 100644 --- a/Source/Engine/Level/Actor.cpp +++ b/Source/Engine/Level/Actor.cpp @@ -489,6 +489,13 @@ void Actor::AddTag(const Tag& tag) Tags.AddUnique(tag); } +void Actor::AddTagRecursive(const Tag& tag) +{ + for (const auto& child : Children) + child->AddTagRecursive(tag); + Tags.AddUnique(tag); +} + PRAGMA_DISABLE_DEPRECATION_WARNINGS const String& Actor::GetTag() const diff --git a/Source/Engine/Level/Actor.h b/Source/Engine/Level/Actor.h index 7a75b12f7..31cfe2473 100644 --- a/Source/Engine/Level/Actor.h +++ b/Source/Engine/Level/Actor.h @@ -120,7 +120,7 @@ public: API_PROPERTY() void SetLayerName(const StringView& value); /// - /// Sets the name of the layer recursively for all underlying children. + /// Sets the name of the layer recursively for actor and for all underlying child actors. /// API_FUNCTION() void SetLayerNameRecursive(const StringView& value); @@ -147,6 +147,12 @@ public: /// The tag to add. API_FUNCTION() void AddTag(const Tag& tag); + /// + /// Adds a tag to the actor and for all underlying child actors. + /// + /// The tag to add. + API_FUNCTION() void AddTagRecursive(const Tag& tag); + /// /// Gets the name of the tag. /// [Deprecated in v1.5]