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 }
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); } }