diff --git a/src/AtomAnimations/Animations/AtomAnimation.cs b/src/AtomAnimations/Animations/AtomAnimation.cs index c591a7fb..68a40800 100644 --- a/src/AtomAnimations/Animations/AtomAnimation.cs +++ b/src/AtomAnimations/Animations/AtomAnimation.cs @@ -569,22 +569,6 @@ private static AtomAnimationClip GetSiblingInLayer(IList laye return sibling; } - public static AtomAnimationClip GetPrincipalClipInLayer(IList layer, string animationName, string animationSet) - { - #warning Optimize and move to a Layer object - var clip = (animationSet != null ? layer.FirstOrDefault(c => c.animationSet == animationSet) : null) ?? - layer.FirstOrDefault(c => c.playbackMainInLayer) ?? - layer.FirstOrDefault(c => c.animationName == animationName) ?? - layer.FirstOrDefault(c => c.autoPlay) ?? - layer[0]; - - // This is to prevent playing on the main layer, starting a set on another layer, which will then override the clip you just played on the main layer - if (clip.animationSet != null && clip.animationSet != animationSet) - clip = null; - - return clip; - } - public void PlayOneAndOtherMainsInLayers(AtomAnimationClip selected, bool sequencing = true) { foreach (var clip in GetMainClipPerLayer()) diff --git a/src/AtomAnimations/Editing/AtomAnimationEditContext.cs b/src/AtomAnimations/Editing/AtomAnimationEditContext.cs index c129b33a..32a024b7 100644 --- a/src/AtomAnimations/Editing/AtomAnimationEditContext.cs +++ b/src/AtomAnimations/Editing/AtomAnimationEditContext.cs @@ -579,7 +579,7 @@ private AtomAnimationClip[] GetMainClipPerLayer() var layer = layers[i]; list[i] = layer[0].animationLayer == current.animationLayer ? current - : AtomAnimation.GetPrincipalClipInLayer(layer, current.animationName, current.animationSet); + : GetPrincipalClipInLayer(layer, current.animationName, current.animationSet); } // Always start with the selected clip to avoid animation sets starting another animation on the currently shown layer @@ -593,6 +593,22 @@ private AtomAnimationClip[] GetMainClipPerLayer() return list; } + private static AtomAnimationClip GetPrincipalClipInLayer(IList layer, string animationName, string animationSet) + { + #warning Optimize and move to a Layer object + var clip = (animationSet != null ? layer.FirstOrDefault(c => c.animationSet == animationSet) : null) ?? + layer.FirstOrDefault(c => c.playbackMainInLayer) ?? + layer.FirstOrDefault(c => c.animationName == animationName) ?? + layer.FirstOrDefault(c => c.autoPlay) ?? + layer[0]; + + // This is to prevent playing on the main layer, starting a set on another layer, which will then override the clip you just played on the main layer + if (clip.animationSet != null && clip.animationSet != animationSet) + clip = null; + + return clip; + } + #endregion #region Selection