Skip to content

Commit

Permalink
Fix adding triggers track on layer with mismatched tracks overwriting…
Browse files Browse the repository at this point in the history
… some triggers
  • Loading branch information
acidbubbles committed Jun 15, 2022
1 parent 90155cc commit 54bb802
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/AtomAnimations/Serialization/AtomAnimationSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,16 @@ private void DeserializeClip(AtomAnimationClip clip, JSONClass clipJSON, Animata
var target = clip.Add(triggerTrackRef);
if (target == null)
{
SuperController.LogError($"The triggers track {triggerTrackName} exists more than once in clip {clip.animationNameQualified}. Only the first will be kept.");
continue;
target = clip.targetTriggers.FirstOrDefault(t => t.name == triggerTrackName);
if (target == null)
{
SuperController.LogError($"The triggers track {triggerTrackName} exists more than once in clip {clip.animationNameQualified}, but couldn't be linked in the clip. Only the first track will be kept.");
continue;
}
else
{
SuperController.LogError($"The triggers track {triggerTrackName} exists more than once in clip {clip.animationNameQualified}. Trigger keyframes may be overwritten.");
}
}
foreach (JSONClass entryJSON in triggerJSON["Triggers"].AsArray)
{
Expand Down
1 change: 1 addition & 0 deletions src/UI/Screens/AddRemoveTargetsScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private void AddTrack(TriggersTrackRef track)
{
foreach (var clip in currentLayer)
{
if (clip.targetTriggers.Any(t => t.TargetsSameAs(track))) continue;
var target = new TriggersTrackAnimationTarget(track, animation.logger);
target.AddEdgeFramesIfMissing(clip.animationLength);
clip.Add(target);
Expand Down

0 comments on commit 54bb802

Please sign in to comment.