Exemplo n.º 1
0
 internal void Init(PlayableDirector director, SceneCacheTrack track, IEnumerable<TimelineClip> clips) {
     m_playableDirector = director;
     m_sceneCacheTrack  = track;
     
     m_clips      = new List<TimelineClip>(clips);
     m_clipAssets = new Dictionary<TimelineClip, SceneCachePlayableAsset>();
     foreach (TimelineClip clip in m_clips) {
         SceneCachePlayableAsset sceneCachePlayableAsset = clip.asset as SceneCachePlayableAsset;
         Assert.IsNotNull(sceneCachePlayableAsset);
         m_clipAssets.Add(clip, sceneCachePlayableAsset);
     }
 }
Exemplo n.º 2
0
        private static void UpdateClipCurve(TimelineClip clip, AnimationCurve animationCurveToApply)
        {
#if UNITY_EDITOR
            bool shouldRefresh = false;

            AnimationCurve shownCurve = AnimationUtility.GetEditorCurve(clip.curves, SceneCachePlayableAsset.GetTimeCurveBinding());
            shouldRefresh = !CurveApproximately(shownCurve, animationCurveToApply);

            AnimationUtility.SetEditorCurve(clip.curves, SceneCachePlayableAsset.GetTimeCurveBinding(), animationCurveToApply);

            if (shouldRefresh)
            {
                TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
            }
#endif
        }
Exemplo n.º 3
0
//----------------------------------------------------------------------------------------------------------------------

        //[TODO-sin:2022-3-24] remove this in 0.13.x
        internal void CopyLegacyClipDataToAsset(SceneCachePlayableAsset sceneCachePlayableAsset)
        {
            if (m_copyLimitedAnimationControllerToAsset)
            {
                LimitedAnimationController assetController = sceneCachePlayableAsset.GetOverrideLimitedAnimationController();
                assetController.SetEnabled(m_overrideLimitedAnimationController.IsEnabled());
                assetController.SetFrameOffset(m_overrideLimitedAnimationController.GetFrameOffset());
                assetController.SetNumFramesToHold(m_overrideLimitedAnimationController.GetNumFramesToHold());
                m_copyLimitedAnimationControllerToAsset = false;
            }


            if (m_copyAnimationCurveToAsset)
            {
                sceneCachePlayableAsset.SetAnimationCurve(m_animationCurve);
                sceneCachePlayableAsset.SetIsSceneCacheCurveExtracted(m_initialized);
                m_copyAnimationCurveToAsset = false;
            }
        }
Exemplo n.º 4
0
        private static void UpdateClipCurveInEditor(TimelineClip clip, AnimationCurve animationCurveToApply)
        {
            bool shouldRefresh = (null == clip.curves);

            if (!shouldRefresh)
            {
                AnimationCurve shownCurve = AnimationUtility.GetEditorCurve(clip.curves, SceneCachePlayableAsset.GetTimeCurveBinding());
                shouldRefresh = !CurveApproximately(shownCurve, animationCurveToApply);
            }
            else
            {
                clip.CreateCurves("Curves: " + clip.displayName);
            }


            AnimationUtility.SetEditorCurve(clip.curves, SceneCachePlayableAsset.GetTimeCurveBinding(), animationCurveToApply);

            if (shouldRefresh)
            {
                TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
            }
        }
Exemplo n.º 5
0
 internal void SetPlayableAsset(SceneCachePlayableAsset playableAsset) {
     m_sceneCachePlayableAsset = playableAsset;
 }