Skip to content

Commit

Permalink
only reset state change on new frame
Browse files Browse the repository at this point in the history
Duo reported they are not getting values updated correctly.
Not sure if this is the (only) reason, but since we're resetting the state change on advance, if the state machine advances a second time in the same frame, it will reset its change status and could, down the line, not fire the state change notification.

This PR makes sure we only reset the state change if it's advancing on a new frame

Diffs=
88d24b0cd4 only reset state change on new frame (#8863)

Co-authored-by: hernan <[email protected]>
  • Loading branch information
bodymovin and bodymovin committed Jan 15, 2025
1 parent b08f843 commit 45e07d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ac230e44d00b42527bc774b45b63d1b81a0c8705
88d24b0cd44f46adc1ba0965689d16f6e1429693
9 changes: 6 additions & 3 deletions src/animation/state_machine_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,12 @@ class StateMachineLayerInstance
}
}

bool advance(float seconds)
bool advance(float seconds, bool newFrame)
{
m_stateMachineChangedOnAdvance = false;
if (newFrame)
{
m_stateMachineChangedOnAdvance = false;
}
m_currentState->advance(seconds, m_stateMachineInstance);
updateMix(seconds);

Expand Down Expand Up @@ -1542,7 +1545,7 @@ bool StateMachineInstance::advance(float seconds, bool newFrame)
}
for (size_t i = 0; i < m_layerCount; i++)
{
if (m_layers[i].advance(seconds))
if (m_layers[i].advance(seconds, newFrame))
{
m_needsAdvance = true;
}
Expand Down

0 comments on commit 45e07d1

Please sign in to comment.