summaryrefslogtreecommitdiff
path: root/src/helpers/AnimatedVariable.hpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-07-20 19:26:10 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-07-20 19:26:10 +0200
commit6c1f4faff2602a6d834d8f641a8a39783bbb9465 (patch)
treeb7c662026ce9b584baf4a2d1d65d02464dd49d79 /src/helpers/AnimatedVariable.hpp
parent7940f779e9dd670157932ce17a872c14747ad490 (diff)
animationmgr: avoid looping over all avars in favor of only active ones
Diffstat (limited to 'src/helpers/AnimatedVariable.hpp')
-rw-r--r--src/helpers/AnimatedVariable.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp
index ccba625d..d234dce2 100644
--- a/src/helpers/AnimatedVariable.hpp
+++ b/src/helpers/AnimatedVariable.hpp
@@ -259,9 +259,14 @@ class CAnimatedVariable {
std::function<void(void* thisptr)> m_fBeginCallback;
std::function<void(void* thisptr)> m_fUpdateCallback;
+ bool m_bIsConnectedToActive = false;
+ void connectToActive();
+ void disconnectFromActive();
+
// methods
void onAnimationEnd() {
m_bIsBeingAnimated = false;
+ disconnectFromActive();
if (m_fEndCallback) {
// loading m_bRemoveEndAfterRan before calling the callback allows the callback to delete this animation safely if it is false.
@@ -274,6 +279,7 @@ class CAnimatedVariable {
void onAnimationBegin() {
m_bIsBeingAnimated = true;
+ connectToActive();
if (m_fBeginCallback) {
m_fBeginCallback(this);