Пример #1
0
        void UpdateCurveEditorIfNeeded(WindowState state)
        {
            if ((Event.current.type != EventType.Layout) || (m_DataSource == null) || (m_BindingHierarchy == null))
            {
                return;
            }

            // check if the curves have changed externally
            var curveChange = m_DataSource.UpdateExternalChanges(ref m_LastClipVersion);

            if (curveChange == CurveChangeType.None)
            {
                return;
            }

            if (curveChange == CurveChangeType.CurveAddedOrRemoved)
            {
                m_BindingHierarchy.RefreshTree();
            }
            else // curve modified
            {
                m_BindingHierarchy.RefreshCurves();
            }

            m_CurveEditor.InvalidateSelectionBounds();

            m_CurveEditor.state = new CurveEditorState()
            {
                timeFormat = state.timeFormat.ToTimeAreaFormat()
            };
            m_CurveEditor.invSnap = (float)state.referenceSequence.frameRate;
        }
Пример #2
0
        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;
        }