public static void ConvertToClipMode(this AnimationTrack track)
 {
     if (track.CanConvertToClipMode())
     {
         TimelineUndo.PushUndo(track, "Convert To Clip");
         if (!track.animClip.get_empty())
         {
             TimelineUndo.PushUndo(track.animClip, "Convert To Clip");
             float num = AnimationClipCurveCache.Instance.GetCurveInfo(track.animClip).keyTimes.FirstOrDefault <float>();
             track.animClip.ShiftBySeconds(-num);
             TimelineClip timelineClip = track.CreateClipFromAsset(track.animClip);
             TimelineCreateUtilities.SaveAssetIntoObject(timelineClip.asset, track);
             timelineClip.start = (double)num;
             timelineClip.preExtrapolationMode  = track.openClipPreExtrapolation;
             timelineClip.postExtrapolationMode = track.openClipPostExtrapolation;
             timelineClip.recordable            = true;
             if (Math.Abs(timelineClip.duration) < 1.4012984643248171E-45)
             {
                 timelineClip.duration = 1.0;
             }
             AnimationPlayableAsset animationPlayableAsset = timelineClip.asset as AnimationPlayableAsset;
             if (animationPlayableAsset)
             {
                 animationPlayableAsset.position = track.openClipOffsetPosition;
                 animationPlayableAsset.rotation = track.openClipOffsetRotation;
                 track.openClipOffsetPosition    = Vector3.get_zero();
                 track.openClipOffsetRotation    = Quaternion.get_identity();
             }
             track.CalculateExtrapolationTimes();
         }
         track.animClip = null;
         EditorUtility.SetDirty(track);
     }
 }
        internal static void ConvertToClipMode(this AnimationTrack track)
        {
            if (!track.CanConvertToClipMode())
            {
                return;
            }

            UndoExtensions.RegisterTrack(track, L10n.Tr("Convert To Clip"));

            if (!track.infiniteClip.empty)
            {
                var animClip = track.infiniteClip;
                TimelineUndo.PushUndo(animClip, L10n.Tr("Convert To Clip"));
                UndoExtensions.RegisterTrack(track, L10n.Tr("Convert To Clip"));
                var start = AnimationClipCurveCache.Instance.GetCurveInfo(animClip).keyTimes.FirstOrDefault();
                animClip.ShiftBySeconds(-start);

                track.infiniteClip = null;
                var clip = track.CreateClip(animClip);

                clip.start = start;
                clip.preExtrapolationMode  = track.infiniteClipPreExtrapolation;
                clip.postExtrapolationMode = track.infiniteClipPostExtrapolation;
                clip.recordable            = true;
                if (Mathf.Abs(animClip.length) < TimelineClip.kMinDuration)
                {
                    clip.duration = 1;
                }

                var animationAsset = clip.asset as AnimationPlayableAsset;
                if (animationAsset)
                {
                    animationAsset.position    = track.infiniteClipOffsetPosition;
                    animationAsset.eulerAngles = track.infiniteClipOffsetEulerAngles;

                    // going to / from infinite mode should reset this. infinite mode
                    animationAsset.removeStartOffset = track.infiniteClipRemoveOffset;
                    animationAsset.applyFootIK       = track.infiniteClipApplyFootIK;
                    animationAsset.loop = track.infiniteClipLoop;

                    track.infiniteClipOffsetPosition    = Vector3.zero;
                    track.infiniteClipOffsetEulerAngles = Vector3.zero;
                }

                track.CalculateExtrapolationTimes();
            }

            track.infiniteClip = null;

            EditorUtility.SetDirty(track);
        }