animationmgr: avoid looping over all avars in favor of only active ones
This commit is contained in:
parent
7940f779e9
commit
6c1f4faff2
4 changed files with 23 additions and 9 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue