Add OnStaticFlagsChanged to Actor

This commit is contained in:
Wojtek Figat
2024-05-09 16:55:05 +02:00
parent 7d7808af8f
commit dc1f15f18d
2 changed files with 20 additions and 10 deletions

View File

@@ -609,7 +609,10 @@ void Actor::SetIsActive(bool value)
void Actor::SetStaticFlags(StaticFlags value)
{
if (_staticFlags == value)
return;
_staticFlags = value;
OnStaticFlagsChanged();
}
void Actor::SetTransform(const Transform& value)
@@ -1226,6 +1229,14 @@ void Actor::OnOrderInParentChanged()
Level::callActorEvent(Level::ActorEventType::OnActorOrderInParentChanged, this, nullptr);
}
void Actor::OnStaticFlagsChanged()
{
}
void Actor::OnLayerChanged()
{
}
BoundingBox Actor::GetBoxWithChildren() const
{
BoundingBox result = GetBox();

View File

@@ -886,14 +886,12 @@ public:
/// Gets rotation of the actor oriented towards the specified world position with upwards direction.
/// </summary>
/// <param name="worldPos">The world position to orient towards.</param>
/// <param name="worldUp">The up direction that Constrains y axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel.</param>
/// <param name="worldUp">The up direction that constrains up axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel.</param>
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const;
public:
/// <summary>
/// Execute custom action on actors tree.
/// Action should returns false to stop calling deeper.
/// First action argument is current actor object.
/// </summary>
/// <param name="action">Actor to call on every actor in the tree. Returns true if keep calling deeper.</param>
/// <param name="args">Custom arguments for the function</param>
@@ -903,14 +901,12 @@ public:
if (action(this, args...))
{
for (int32 i = 0; i < Children.Count(); i++)
Children[i]->TreeExecute<Params...>(action, args...);
Children.Get()[i]->TreeExecute<Params...>(action, args...);
}
}
/// <summary>
/// Execute custom action on actor children tree.
/// Action should returns false to stop calling deeper.
/// First action argument is current actor object.
/// </summary>
/// <param name="action">Actor to call on every actor in the tree. Returns true if keep calling deeper.</param>
/// <param name="args">Custom arguments for the function</param>
@@ -918,7 +914,7 @@ public:
void TreeExecuteChildren(Function<bool(Actor*, Params ...)>& action, Params ... args)
{
for (int32 i = 0; i < Children.Count(); i++)
Children[i]->TreeExecute<Params...>(action, args...);
Children.Get()[i]->TreeExecute<Params...>(action, args...);
}
public:
@@ -1016,12 +1012,15 @@ public:
/// </summary>
virtual void OnOrderInParentChanged();
/// <summary>
/// Called when actor static flag gets changed.
/// </summary>
virtual void OnStaticFlagsChanged();
/// <summary>
/// Called when layer gets changed.
/// </summary>
virtual void OnLayerChanged()
{
}
virtual void OnLayerChanged();
/// <summary>
/// Called when adding object to the game.