Merge branch 'getprefabroot' of https://github.com/Menotdan/FlaxEngine into Menotdan-getprefabroot

This commit is contained in:
Wojtek Figat
2024-02-18 20:13:30 +01:00
2 changed files with 21 additions and 0 deletions

View File

@@ -1356,6 +1356,21 @@ bool Actor::IsPrefabRoot() const
return _isPrefabRoot != 0;
}
Actor* Actor::GetPrefabRoot()
{
if (!this->HasPrefabLink())
{
return NULL;
}
Actor* result = this;
while (!result == NULL && !result->IsPrefabRoot())
{
result = result->GetParent();
}
return result;
}
Actor* Actor::FindActor(const StringView& name) const
{
Actor* result = nullptr;