Merge branch 'getprefabroot' of https://github.com/Menotdan/FlaxEngine into Menotdan-getprefabroot
This commit is contained in:
@@ -1356,6 +1356,21 @@ bool Actor::IsPrefabRoot() const
|
|||||||
return _isPrefabRoot != 0;
|
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* Actor::FindActor(const StringView& name) const
|
||||||
{
|
{
|
||||||
Actor* result = nullptr;
|
Actor* result = nullptr;
|
||||||
|
|||||||
@@ -737,6 +737,12 @@ public:
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
API_PROPERTY() bool IsPrefabRoot() const;
|
API_PROPERTY() bool IsPrefabRoot() const;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the root of the prefab this actor is attached to.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The root prefab object, or null if this actor is not a prefab.</returns>
|
||||||
|
API_FUNCTION() Actor* GetPrefabRoot();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to find the actor with the given name in this actor hierarchy (checks this actor and all children hierarchy).
|
/// Tries to find the actor with the given name in this actor hierarchy (checks this actor and all children hierarchy).
|
||||||
|
|||||||
Reference in New Issue
Block a user