Merge branch 'layeraddition' of https://github.com/Withaust/FlaxEngine into Withaust-layeraddition
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;
|
||||
@@ -476,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);
|
||||
}
|
||||
|
||||
void Actor::RemoveTag(const Tag& tag)
|
||||
{
|
||||
Tags.Remove(tag);
|
||||
@@ -505,6 +525,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)
|
||||
|
||||
@@ -102,6 +102,12 @@ public:
|
||||
/// <param name="layerIndex">The index of the layer.</param>
|
||||
API_PROPERTY() void SetLayer(int32 layerIndex);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the layer recursively for all underlying children.
|
||||
/// </summary>
|
||||
/// <param name="layerIndex">The index of the layer.</param>
|
||||
API_FUNCTION() void SetLayerRecursive(int32 layerIndex);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the layer.
|
||||
/// </summary>
|
||||
@@ -113,6 +119,11 @@ public:
|
||||
/// </summary>
|
||||
API_PROPERTY() void SetLayerName(const StringView& value);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the name of the layer recursively for actor and for all underlying child actors.
|
||||
/// </summary>
|
||||
API_FUNCTION() void SetLayerNameRecursive(const StringView& value);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this actor has any tag assigned.
|
||||
/// </summary>
|
||||
@@ -137,6 +148,11 @@ public:
|
||||
API_FUNCTION() void AddTag(const Tag& tag);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a tag to the actor and for all underlying child actors.
|
||||
/// </summary>
|
||||
/// <param name="tag">The tag to add.</param>
|
||||
API_FUNCTION() void AddTagRecursive(const Tag& tag);
|
||||
|
||||
/// Removes a tag to the actor
|
||||
/// </summary>
|
||||
/// <param name="tag">The tag to remove.</param>
|
||||
|
||||
Reference in New Issue
Block a user