Move Actor.DestroyChildren to C++

This commit is contained in:
2022-04-13 21:34:13 +02:00
parent 3d76b2c10f
commit e554b7f531
3 changed files with 17 additions and 17 deletions
+11
View File
@@ -418,6 +418,17 @@ Array<Actor*> Actor::GetChildren(const MClass* type) const
return result;
}
void Actor::DestroyChildren(float timeLeft)
{
Array<Actor*> children = Children;
const bool useGameTime = timeLeft > ZeroTolerance;
for (Actor* child : children)
{
child->SetParent(nullptr, false, false);
child->DeleteObject(timeLeft, useGameTime);
}
}
bool Actor::HasTag(const StringView& tag) const
{
return HasTag() && tag == Level::Tags[_tag];
-17
View File
@@ -296,23 +296,6 @@ namespace FlaxEngine
return output;
}
/// <summary>
/// Destroys the children. Calls Object.Destroy on every child actor and unlink them for the parent.
/// </summary>
/// <param name="timeLeft">The time left to destroy object (in seconds).</param>
[NoAnimate]
public void DestroyChildren(float timeLeft = 0.0f)
{
if (ChildrenCount == 0)
return;
Actor[] children = Children;
for (var i = 0; i < children.Length; i++)
{
children[i].Parent = null;
Destroy(children[i], timeLeft);
}
}
/// <summary>
/// Gets the matrix that transforms a point from the world space to local space of the actor.
/// </summary>
+6
View File
@@ -242,6 +242,12 @@ public:
return result;
}
/// <summary>
/// Destroys the children. Calls Object.Destroy on every child actor and unlinks them for this actor.
/// </summary>
/// <param name="timeLeft">The time left to destroy object (in seconds).</param>
API_FUNCTION(Attributes="NoAnimate") void DestroyChildren(float timeLeft = 0.0f);
public:
/// <summary>