Add recursive methods for layers
This commit is contained in:
@@ -456,6 +456,19 @@ void Actor::SetLayerName(const StringView& value)
|
||||
LOG(Warning, "Unknown layer name '{0}'", value);
|
||||
}
|
||||
|
||||
void Actor::SetLayerNameRecursive(const StringView& value)
|
||||
{
|
||||
for (int32 i = 0; i < 32; i++)
|
||||
{
|
||||
if (Level::Layers[i] == value)
|
||||
{
|
||||
SetLayerRecursive(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
LOG(Warning, "Unknown layer name '{0}'", value);
|
||||
}
|
||||
|
||||
bool Actor::HasTag() const
|
||||
{
|
||||
return Tags.Count() != 0;
|
||||
@@ -500,6 +513,17 @@ void Actor::SetLayer(int32 layerIndex)
|
||||
OnLayerChanged();
|
||||
}
|
||||
|
||||
void Actor::SetLayerRecursive(int32 layerIndex)
|
||||
{
|
||||
layerIndex = Math::Clamp(layerIndex, 0, 31);
|
||||
for (const auto& child : Children)
|
||||
child->SetLayerRecursive(layerIndex);
|
||||
if (layerIndex == _layer)
|
||||
return;
|
||||
_layer = layerIndex;
|
||||
OnLayerChanged();
|
||||
}
|
||||
|
||||
void Actor::SetName(const StringView& value)
|
||||
{
|
||||
if (_name == value)
|
||||
|
||||
Reference in New Issue
Block a user