private void UpdateCurveEditorIfNeeded(TimelineWindow.TimelineState state) { if (Event.get_current().get_type() == 8 && this.m_DataSource != null && this.m_BindingHierarchy != null && !(this.m_DataSource.animationClip == null)) { AnimationClipCurveInfo curveInfo = AnimationClipCurveCache.Instance.GetCurveInfo(this.m_DataSource.animationClip); int version = curveInfo.version; if (version != this.m_LastClipVersion) { if (this.m_LastCurveCount != curveInfo.curves.Length) { this.m_BindingHierarchy.RefreshTree(); this.m_LastCurveCount = curveInfo.curves.Length; } else { this.m_BindingHierarchy.RefreshCurves(); } if (this.m_LastClipVersion == -1) { this.FrameClip(); } this.m_LastClipVersion = version; } if (state.timeInFrames) { this.m_CurveEditor.state = new ClipCurveEditor.FrameFormatCurveEditorState(); } else { this.m_CurveEditor.state = new ClipCurveEditor.UnformattedCurveEditorState(); } this.m_CurveEditor.invSnap = state.frameRate; } }
void UpdateCurveEditorIfNeeded(WindowState state) { if ((Event.current.type != EventType.Layout) || (m_DataSource == null) || (m_BindingHierarchy == null) || (m_DataSource.animationClip == null)) { return; } AnimationClipCurveInfo curveInfo = AnimationClipCurveCache.Instance.GetCurveInfo(m_DataSource.animationClip); int version = curveInfo.version; if (version != m_LastClipVersion) { // tree has changed if (m_LastCurveCount != curveInfo.curves.Length) { m_BindingHierarchy.RefreshTree(); m_LastCurveCount = curveInfo.curves.Length; } else { // update just the curves m_BindingHierarchy.RefreshCurves(); } // auto frame the clip only at first update if (m_LastClipVersion == -1) { FrameClip(); } m_LastClipVersion = version; } if (state.timeInFrames) { m_CurveEditor.state = new FrameFormatCurveEditorState(); } else { m_CurveEditor.state = new UnformattedCurveEditorState(); } m_CurveEditor.invSnap = state.referenceSequence.frameRate; }