예제 #1
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
        }
예제 #2
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);
            }
        }