mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-06-28 02:37:16 +08:00
force blend states to keepGoing
makes blend states keepGoing! fixes a regression introduced when looking at keep going of states when deciding if to advance them. for blend states specifically mixing is done as well as animating animation instances, and if the mix value changes we need to apply this change. @luigi-rosso struggled to build state machines into an automated test on the cpp side before. going to add one loading a `.riv` for this I think, at least to cover some basics here. btw, I assume we also want this behaviour for direct blend states https://2dimensions.slack.com/archives/CHMAP278R/p1677820699177779 Diffs= 2504d2ab2 force blend states to keepGoing (#4922)
This commit is contained in:
@ -1 +1 @@
|
||||
bc6c6f467b8f1e0f794be093a514768bd068088a
|
||||
2504d2ab24d258621fc89a0120c794f2b53a2ffc
|
||||
|
@ -27,18 +27,20 @@ abstract class BlendStateInstance<T extends BlendState<K>,
|
||||
.toList(growable: false),
|
||||
super(state);
|
||||
|
||||
bool _keepGoing = true;
|
||||
@override
|
||||
bool get keepGoing => _keepGoing;
|
||||
bool get keepGoing => true;
|
||||
|
||||
@mustCallSuper
|
||||
@override
|
||||
void advance(double seconds, StateMachineController controller) {
|
||||
_keepGoing = false;
|
||||
// Advance all the animations in the blend state
|
||||
// NOTE: we are intentionally ignoring the animationInstances' keepGoing
|
||||
// return value.
|
||||
// Blend states need to keep blending forever, as even if the animation
|
||||
// does not change the mix values may
|
||||
for (final animation in animationInstances) {
|
||||
if (animation.animationInstance.advance(seconds) && !keepGoing) {
|
||||
_keepGoing = true;
|
||||
if (animation.animationInstance.keepGoing) {
|
||||
animation.animationInstance.advance(seconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user