From d1bfc7d0bc6967c96ee4edc3d50f231a7b0be090 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 10 Feb 2025 12:10:54 +0100 Subject: [PATCH] [Animation] Adjust action processing This commit slightly changes how actions are processed by the animator to avoid an issue with progress events reporting a wrong value after restarting a running animation. --- RELEASE_NOTES.md | 1 + .../Animation/Animator/AnimatorApp.fs | 8 ++++++-- .../Animation/State/StateMachine.fs | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 993d3d9f..a6ffe728 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,6 +1,7 @@ - Fixed multisampled raw download - [Animation] Improved adaptive sampling scheme for splines to avoid infinite recursion when control points are coinciding - [Animation] Fixed issue with ticks not being processed when all animations are paused +- [Animation] Adjust action processing to resolve an issue with events when restarting an animation ### 5.5.2 - updated Adaptify.Core to 1.3.0 (using local, new style adaptify) diff --git a/src/Aardvark.UI.Primitives/Animation/Animator/AnimatorApp.fs b/src/Aardvark.UI.Primitives/Animation/Animator/AnimatorApp.fs index fde527f1..4db0c69e 100644 --- a/src/Aardvark.UI.Primitives/Animation/Animator/AnimatorApp.fs +++ b/src/Aardvark.UI.Primitives/Animation/Animator/AnimatorApp.fs @@ -76,11 +76,15 @@ module Animator = let animator = { Optic.get lens model with CurrentTick = ValueSome time } let mutable model = model |> Optic.set lens animator - // Update all running animations + // Process pending actions + for (_, s) in animator.Slots do + model <- s.Commit(model, time) + + // Update all running animations by generating and enqueuing Update actions for (_, s) in animator.Slots do s.Update time - // Notify all observers + // Process Update actions for (_, s) in animator.Slots do model <- s.Commit(model, time) diff --git a/src/Aardvark.UI.Primitives/Animation/State/StateMachine.fs b/src/Aardvark.UI.Primitives/Animation/State/StateMachine.fs index 7e69fdef..ace935c0 100644 --- a/src/Aardvark.UI.Primitives/Animation/State/StateMachine.fs +++ b/src/Aardvark.UI.Primitives/Animation/State/StateMachine.fs @@ -45,7 +45,6 @@ module private StateMachine = machine.State <- State.Running (tick - startFrom) machine.Position <- startFrom queue.Enqueue { Type = EventType.Start; Value = machine.Value } - queue.Enqueue { Type = EventType.Progress; Value = machine.Value } | Action.Pause -> match machine.State with