Merge branch 'layer-methods' of https://github.com/Tryibion/FlaxEngine into Tryibion-layer-methods

This commit is contained in:
Wojtek Figat
2025-08-24 13:43:35 +02:00
4 changed files with 100 additions and 2 deletions

View File

@@ -60,11 +60,31 @@ void LargeWorlds::UpdateOrigin(Vector3& origin, const Vector3& position)
}
}
bool LayersMask::HasLayer(const StringView& layerName) const
bool LayersMask::HasLayer(const StringView& layerName)
{
return HasLayer(Level::GetLayerIndex(layerName));
}
LayersMask LayersMask::GetMask(StringView layerNames[])
{
LayersMask mask(0);
if (layerNames == nullptr)
return mask;
for (int i = 0; i < layerNames->Length(); i++)
{
StringView& layerName = layerNames[i];
// Ignore blank entries
if (layerName.Length() == 0)
continue;
int index = Level::GetLayerIndex(layerName);
if (index != -1 && !mask.HasLayer(index))
{
mask.Mask |= static_cast<uint32>(1 << index);
}
}
return mask;
}
enum class SceneEventType
{
OnSceneSaving = 0,
@@ -729,6 +749,18 @@ int32 Level::GetLayerIndex(const StringView& layer)
return result;
}
StringView Level::GetLayerName(const int32 layerIndex)
{
for (int32 i = 0; i < 32; i++)
{
if (i == layerIndex)
{
return Layers[i];
}
}
return TEXT("");
}
void Level::callActorEvent(ActorEventType eventType, Actor* a, Actor* b)
{
PROFILE_CPU();