Skip to content

Commit

Permalink
Event fixes
Browse files Browse the repository at this point in the history
Addresses issues brought up here:
https://2dimensions.slack.com/archives/CLLCU09T6/p1694766559770229

- Custom properties not updating when expected.
- Events not firing on first frame.

One important aspect of all of this:
- Custom properties on events update with LinearAnimation.apply.
- Events on timelines and state machines accrue/report during StateMachine/LinearAnimation.advance

These could happen when the state machine would transition to a layer with an animation. The first frame would apply with mix 0 meaning all non-mixable properties wouldn't be applied per https://github.com/rive-app/rive/pull/5960/files.

I took a slightly different approach. Now apply will always try to apply values. If mix is 0, non mixing properties will apply. I think semantically this makes more sense too. If you don't want to apply, don't apply. Apply with mix 0 is effectively a no-op as we had it before, so it was just a perf suck.

So I re-worked the various call sites for apply to not call it when attempting to mix in an effectively mixed-out animation. This has one caveat for blend states. Because the blend state advances all the animations in sync, .advance must still be called when mix is 0, so events will still report but custom property keyframes in mixed out animations will not update. I think that's reasonable, but may not be immediately apparent. We can opt to not report events when the mix is 0 by introducing a "reportEvents" boolean to advance, or add an option to the blend state for whether or not they should report.

Diffs=
236d788ea Event fixes (#5997)
  • Loading branch information
luigi-rosso committed Sep 15, 2023
1 parent aeb5f94 commit 469ed77
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
05e1afaf3419e5c5c46a747690c5591174801de6
236d788ea3cf8f184a026a1b69c14af60003169c
2 changes: 1 addition & 1 deletion .rive_renderer
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9bdbd252da66190187bbe2e383e85cb769173729
37532d9b2ca672b36968aff9435b413d846f6d23
2 changes: 1 addition & 1 deletion submodules/rive-cpp

0 comments on commit 469ed77

Please sign in to comment.