Skip to content

Commit

Permalink
Only stop other atoms when the user presses stop
Browse files Browse the repository at this point in the history
  • Loading branch information
acidbubbles committed Sep 3, 2021
1 parent 5ddc9c9 commit 5658422
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/AtomAnimations/Animatables/Triggers/CustomTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public CustomTrigger()

public void Update(float clipTime)
{
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (clipTime >= startTime && (clipTime < endTime || startTime == endTime))
{
active = true;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/AtomAnimations/Animations/AtomAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 0 additions & 1 deletion src/AtomAnimations/Animations/AtomAnimationClip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ public void Reset(bool resetTime)
target.recording = false;
}
}

clipTime = resetTime ? 0f : clipTime.Snap();
}

Expand Down
4 changes: 4 additions & 0 deletions src/AtomAnimations/Editing/AtomAnimationEditContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class AnimationSettingsChanged : UnityEvent<string> { }
public readonly ScrubberRangeChangedEvent onScrubberRangeChanged = new ScrubberRangeChangedEvent();
public readonly CurrentAnimationChangedEvent onCurrentAnimationChanged = new CurrentAnimationChangedEvent();

public PeerManager peers;

public AtomClipboard clipboard { get; } = new AtomClipboard();

private bool _sampleAfterRebuild;
Expand Down Expand Up @@ -268,6 +270,8 @@ public void Stop()

onTimeChanged.Invoke(timeArgs);
Sample();

peers.SendStop();
}

public void PlayCurrentClip()
Expand Down
5 changes: 2 additions & 3 deletions src/AtomPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ private void AddAnimationComponents()
animationEditContext = gameObject.AddComponent<AtomAnimationEditContext>();
if (animationEditContext == null) throw new InvalidOperationException("Could not add animationEditContext component");
animationEditContext.logger = logger;
animationEditContext.peers = peers;
animationEditContext.animation = animation;
}

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 5658422

Please sign in to comment.