diff --git a/src/AtomAnimations/Animatables/Triggers/CustomTrigger.cs b/src/AtomAnimations/Animatables/Triggers/CustomTrigger.cs index d3779cc7..3276aea5 100644 --- a/src/AtomAnimations/Animatables/Triggers/CustomTrigger.cs +++ b/src/AtomAnimations/Animatables/Triggers/CustomTrigger.cs @@ -17,6 +17,7 @@ public CustomTrigger() public void Update(float clipTime) { + // ReSharper disable once CompareOfFloatsByEqualityOperator if (clipTime >= startTime && (clipTime < endTime || startTime == endTime)) { active = true; @@ -37,7 +38,7 @@ public void Leave() #region JSON - public override JSONClass GetJSON(string subScenePrefix = null) + public override JSONClass GetJSON(string subScenePrefix) { var jc = base.GetJSON(subScenePrefix); jc["startTime"].AsFloat = startTime; diff --git a/src/AtomAnimations/Animations/AtomAnimation.cs b/src/AtomAnimations/Animations/AtomAnimation.cs index 6e5b9724..6cef8f50 100644 --- a/src/AtomAnimations/Animations/AtomAnimation.cs +++ b/src/AtomAnimations/Animations/AtomAnimation.cs @@ -300,7 +300,7 @@ public void PlayClip(AtomAnimationClip clip, bool sequencing, bool allowPreserve ScheduleNextAnimation( previousMain, clip, - previousMain.loop && previousMain.preserveLoops && clip.preserveLoops + previousMain.loop && previousMain.preserveLoops && clip.loop && clip.preserveLoops ? previousMain.animationLength - clip.blendInDuration / 2f - previousMain.clipTime : 0f); } diff --git a/src/AtomAnimations/Animations/AtomAnimationClip.cs b/src/AtomAnimations/Animations/AtomAnimationClip.cs index 706c8b08..a1e77d42 100644 --- a/src/AtomAnimations/Animations/AtomAnimationClip.cs +++ b/src/AtomAnimations/Animations/AtomAnimationClip.cs @@ -504,7 +504,6 @@ public void Reset(bool resetTime) target.recording = false; } } - clipTime = resetTime ? 0f : clipTime.Snap(); } diff --git a/src/AtomAnimations/Editing/AtomAnimationEditContext.cs b/src/AtomAnimations/Editing/AtomAnimationEditContext.cs index 0d420ff8..0d083e27 100644 --- a/src/AtomAnimations/Editing/AtomAnimationEditContext.cs +++ b/src/AtomAnimations/Editing/AtomAnimationEditContext.cs @@ -30,6 +30,8 @@ public class AnimationSettingsChanged : UnityEvent { } public readonly ScrubberRangeChangedEvent onScrubberRangeChanged = new ScrubberRangeChangedEvent(); public readonly CurrentAnimationChangedEvent onCurrentAnimationChanged = new CurrentAnimationChangedEvent(); + public PeerManager peers; + public AtomClipboard clipboard { get; } = new AtomClipboard(); private bool _sampleAfterRebuild; @@ -268,6 +270,8 @@ public void Stop() onTimeChanged.Invoke(timeArgs); Sample(); + + peers.SendStop(); } public void PlayCurrentClip() diff --git a/src/AtomPlugin.cs b/src/AtomPlugin.cs index c9c95f8a..44b6f9a0 100644 --- a/src/AtomPlugin.cs +++ b/src/AtomPlugin.cs @@ -479,6 +479,7 @@ private void AddAnimationComponents() animationEditContext = gameObject.AddComponent(); if (animationEditContext == null) throw new InvalidOperationException("Could not add animationEditContext component"); animationEditContext.logger = logger; + animationEditContext.peers = peers; animationEditContext.animation = animation; } @@ -781,9 +782,7 @@ private void OnIsPlayingChanged(AtomAnimationClip clip) { _isPlayingJSON.valNoCallback = animation.isPlaying; _freeControllerHook.enabled = !animation.isPlaying; - if (!animation.isPlaying) - peers.SendStop(); - else + if (animation.isPlaying) peers.SendPlaybackState(clip); }