Skip to content

Commit

Permalink
Fix segments behavior applied on legacy animations, resulting in more…
Browse files Browse the repository at this point in the history
… than one animation running at a time
  • Loading branch information
acidbubbles committed Jun 16, 2022
1 parent 54bb802 commit 0623992
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/AtomAnimations/Animations/AtomAnimation.Clips.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public AtomAnimationClip GetClip(string animationSegment, string animationLayer,

public AtomAnimationClip AddClip(AtomAnimationClip clip)
{
if (_playingAnimationSegment == null) playingAnimationSegment = clip.animationSegment;
if (_playingAnimationSegment == null && clip.isOnSegment) playingAnimationSegment = clip.animationSegment;
var lastIndexOfSequence = clips.FindLastIndex(c => c.animationSegment == clip.animationSegment);
var lastIndexOfLayer = clips.FindLastIndex(c => c.animationLayerQualified == clip.animationLayerQualified);
int addIndex;
Expand Down
2 changes: 1 addition & 1 deletion src/AtomAnimations/Animations/AtomAnimation.Sequencing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void ProcessAnimationSequence(float deltaTime)
clip.playbackScheduledNextAnimation = null;
clip.playbackScheduledNextTimeLeft = float.NaN;

if (nextClip.animationSegment != AtomAnimationClip.SharedAnimationSegment && playingAnimationSegment != nextClip.animationSegment)
if (nextClip.isOnSegment && playingAnimationSegmentId != nextClip.animationSegmentId)
{
PlaySegment(nextClip);
}
Expand Down
8 changes: 4 additions & 4 deletions src/UI/Screens/AdvancedKeyframeToolsScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ private void ClearAllConfirm()
{
if(animation.isPlaying)
animation.StopAll();
animationEditContext.clipboard.Clear();
while (animation.clips.Count > 0)
animation.RemoveClip(animation.clips[0]);
animation.CreateClip(AtomAnimationClip.DefaultAnimationName, AtomAnimationClip.DefaultAnimationLayer, AtomAnimationClip.DefaultAnimationSegment);
animation.playingAnimationSegment = AtomAnimationClip.DefaultAnimationSegment;
animationEditContext.SelectAnimation(animation.clips[0]);
animationEditContext.clipboard.Clear();
var clip = animation.CreateClip(AtomAnimationClip.DefaultAnimationName, AtomAnimationClip.DefaultAnimationLayer, AtomAnimationClip.DefaultAnimationSegment);
animation.playingAnimationSegment = clip.animationSegment;
animationEditContext.SelectAnimation(clip);
animationEditContext.locked = false;
animationEditContext.snap = AtomAnimationEditContext.DefaultSnap;
animationEditContext.showPaths = true;
Expand Down

0 comments on commit 0623992

Please sign in to comment.