Skip to content

Commit

Permalink
Fix Record not working if re-recording immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
acidbubbles committed Nov 27, 2022
1 parent cb1cfdc commit 73d6be9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/AtomAnimations/Animations/AtomAnimation.Playback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ public void StopAll()
{
StopClip(clip);
}
playTime = 0f;
foreach (var clip in clips)
{
clip.Reset(false);
Expand Down
11 changes: 9 additions & 2 deletions src/AtomAnimations/Operations/RecordOperations.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
Expand Down Expand Up @@ -28,6 +29,12 @@ public IEnumerator StartRecording(
bool exitOnMenuOpen,
bool showStartMarkers)
{
if (!recordExtendsLength && _clip.clipTime >= _clip.animationLength - 0.001)
{
SuperController.LogError("Timeline: Animation is already at the end; either enable extends recording or rewind.");
yield break;
}

if (_animation.recording)
{
SuperController.LogError("Timeline: Already recording");
Expand Down Expand Up @@ -225,7 +232,7 @@ private void AfterRecording(List<ICurveAnimationTarget> targets)
target.EndBulkUpdates();
}

_clip.clipTime = Mathf.Min(_clip.animationLength, _clip.clipTime).Snap();
_animation.StopAll();
}

private static void ClearAllGrabbedControllers(IEnumerable<ICurveAnimationTarget> targets)
Expand Down

0 comments on commit 73d6be9

Please sign in to comment.