private void RebuildTransition(AtomAnimationClip clip) { bool realign = false; var previous = clips.FirstOrDefault(c => c.nextAnimationName == clip.animationName); if (previous != null && (previous.IsDirty() || clip.IsDirty())) { clip.Paste(0f, previous.Copy(previous.animationLength, previous.GetAllCurveTargets().Cast <IAtomAnimationTarget>()), false); realign = true; } var next = GetClip(clip.nextAnimationName); if (next != null && (next.IsDirty() || clip.IsDirty())) { clip.Paste(clip.animationLength, next.Copy(0f, next.GetAllCurveTargets().Cast <IAtomAnimationTarget>()), false); realign = true; } if (realign) { foreach (var target in clip.targetControllers) { if (clip.ensureQuaternionContinuity) { UnitySpecific.EnsureQuaternionContinuityAndRecalculateSlope( target.rotX, target.rotY, target.rotZ, target.rotW); } } } }
private void RebuildTransition(AtomAnimationClip clip) { if (clip.autoTransitionPrevious) { var previous = clips.FirstOrDefault(c => c.nextAnimationName == clip.animationName); if (previous != null && (previous.IsDirty() || clip.IsDirty())) { CopySourceFrameToClip(previous, previous.animationLength, clip, 0f); } } if (clip.autoTransitionNext) { var next = GetClip(clip.animationLayer, clip.nextAnimationName); if (next != null && (next.IsDirty() || clip.IsDirty())) { CopySourceFrameToClip(next, 0f, clip, clip.animationLength); } } }
public AtomAnimationClip AddClip(AtomAnimationClip clip) { var lastIndexOfLayer = clips.FindLastIndex(c => c.animationLayer == clip.animationLayer); if (lastIndexOfLayer == -1) { clips.Add(clip); } else { clips.Insert(lastIndexOfLayer + 1, clip); } clip.onAnimationSettingsChanged.AddListener(OnAnimationSettingsChanged); clip.onAnimationKeyframesDirty.AddListener(OnAnimationKeyframesDirty); clip.onTargetsListChanged.AddListener(OnTargetsListChanged); onClipsListChanged.Invoke(); if (clip.IsDirty()) { clip.onAnimationKeyframesDirty.Invoke(); } index.Rebuild(); return(clip); }