From dc1f15f18d41cf1046f05d7e4b74cb2ed4f6b2c1 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 9 May 2024 16:55:05 +0200 Subject: [PATCH] Add `OnStaticFlagsChanged` to Actor --- Source/Engine/Level/Actor.cpp | 11 +++++++++++ Source/Engine/Level/Actor.h | 19 +++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Source/Engine/Level/Actor.cpp b/Source/Engine/Level/Actor.cpp index 2615f09fa..479d67bcd 100644 --- a/Source/Engine/Level/Actor.cpp +++ b/Source/Engine/Level/Actor.cpp @@ -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(); diff --git a/Source/Engine/Level/Actor.h b/Source/Engine/Level/Actor.h index 98045fc85..dc77cdbee 100644 --- a/Source/Engine/Level/Actor.h +++ b/Source/Engine/Level/Actor.h @@ -886,14 +886,12 @@ public: /// Gets rotation of the actor oriented towards the specified world position with upwards direction. /// /// The world position to orient towards. - /// 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. + /// 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. API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const; public: /// /// Execute custom action on actors tree. - /// Action should returns false to stop calling deeper. - /// First action argument is current actor object. /// /// Actor to call on every actor in the tree. Returns true if keep calling deeper. /// Custom arguments for the function @@ -903,14 +901,12 @@ public: if (action(this, args...)) { for (int32 i = 0; i < Children.Count(); i++) - Children[i]->TreeExecute(action, args...); + Children.Get()[i]->TreeExecute(action, args...); } } /// /// Execute custom action on actor children tree. - /// Action should returns false to stop calling deeper. - /// First action argument is current actor object. /// /// Actor to call on every actor in the tree. Returns true if keep calling deeper. /// Custom arguments for the function @@ -918,7 +914,7 @@ public: void TreeExecuteChildren(Function& action, Params ... args) { for (int32 i = 0; i < Children.Count(); i++) - Children[i]->TreeExecute(action, args...); + Children.Get()[i]->TreeExecute(action, args...); } public: @@ -1016,12 +1012,15 @@ public: /// virtual void OnOrderInParentChanged(); + /// + /// Called when actor static flag gets changed. + /// + virtual void OnStaticFlagsChanged(); + /// /// Called when layer gets changed. /// - virtual void OnLayerChanged() - { - } + virtual void OnLayerChanged(); /// /// Called when adding object to the game.