// Given a track, return the animation clip
        internal static AnimationClip FindRecordingAnimationClipAtTime(this TrackAsset trackAsset, double time)
        {
            if (trackAsset == null)
            {
                return(null);
            }

            AnimationTrack animTrack = trackAsset as AnimationTrack;

            if (animTrack != null && !animTrack.inClipMode)
            {
                return(animTrack.infiniteClip);
            }

            TimelineClip displayBackground;

            trackAsset.FindRecordingClipAtTime(time, out displayBackground);
            if (displayBackground != null)
            {
                if (displayBackground.recordable)
                {
                    AnimationPlayableAsset asset = displayBackground.asset as AnimationPlayableAsset;
                    if (asset != null)
                    {
                        return(asset.clip);
                    }
                }
                else if (animTrack == null)
                {
                    if (displayBackground.curves == null)
                    {
                        displayBackground.CreateCurves(AnimationTrackRecorder.GetUniqueRecordedClipName(displayBackground.parentTrack, TimelineClip.kDefaultCurvesName));
                    }

                    return(displayBackground.curves);
                }
            }
            else if (trackAsset.HasAnyAnimatableParameters())
            {
                if (trackAsset.curves == null)
                {
                    trackAsset.CreateCurves(AnimationTrackRecorder.GetUniqueRecordedClipName(trackAsset.timelineAsset, TrackAsset.kDefaultCurvesName));
                }

                return(trackAsset.curves);
            }

            return(null);
        }
示例#2
0
 public override void OnCreate(TrackAsset track, TrackAsset copiedFrom)
 {
     track.CreateCurves("FakeCurves");
     track.curves.SetCurve(string.Empty, typeof(GameObject), "m_FakeCurve", AnimationCurve.Linear(0, 1, 1, 1));
     base.OnCreate(track, copiedFrom);
 }