예제 #1
0
        public bool OnEvent(Event evt, TimelineWindow.TimelineState state, bool isCaptureSession)
        {
            bool result;

            if (evt.get_type() == null || evt.get_type() == 16)
            {
                result = this.MouseOver(state);
            }
            else
            {
                IClipCurveEditorOwner clipCurveEditorOwner = this.GetClipCurveEditorOwner();
                if (clipCurveEditorOwner == null)
                {
                    result = false;
                }
                else if (!clipCurveEditorOwner.inlineCurvesSelected)
                {
                    result = false;
                }
                else
                {
                    ClipCurveEditor clipCurveEditor = clipCurveEditorOwner.clipCurveEditor;
                    if (clipCurveEditor == null)
                    {
                        result = false;
                    }
                    else if (evt.get_commandName() == "FrameSelected")
                    {
                        this.FrameSelected(state, clipCurveEditor);
                        result = true;
                    }
                    else
                    {
                        if (evt.get_type() == 4 && evt.get_modifiers() == null)
                        {
                            if (evt.get_character() == 'a')
                            {
                                this.FrameAll(state, clipCurveEditor);
                                result = true;
                                return(result);
                            }
                        }
                        result = false;
                    }
                }
            }
            return(result);
        }
예제 #2
0
 private void FrameSelected(TimelineWindow.TimelineState state, ClipCurveEditor clipCurveEditor)
 {
     if (!clipCurveEditor.HasSelection())
     {
         this.FrameAll(state, clipCurveEditor);
     }
     else
     {
         Vector2 selectionRange = clipCurveEditor.GetSelectionRange();
         if (selectionRange.x != selectionRange.y)
         {
             CurveDataSource dataSource = clipCurveEditor.dataSource;
             float           start      = dataSource.start + selectionRange.x / dataSource.timeScale;
             float           duration   = (selectionRange.y - selectionRange.x) / dataSource.timeScale;
             InlineCurveEditor.Frame(state, start, duration, InlineCurveEditor.s_FrameSelectedMarginFactor);
         }
     }
 }
예제 #3
0
        private bool MouseOver(TimelineWindow.TimelineState state)
        {
            bool result;

            if (InlineCurveEditor.MouseOverHeaderArea(this.m_HeaderRect, this.m_TrackRect))
            {
                result = true;
            }
            else
            {
                ClipCurveEditor clipCurveEditor = this.GetClipCurveEditorOwner().clipCurveEditor;
                if (clipCurveEditor == null)
                {
                    result = false;
                }
                else
                {
                    Rect backgroundRect = clipCurveEditor.dataSource.GetBackgroundRect(state);
                    result = InlineCurveEditor.MouseOverTrackArea(backgroundRect, this.m_TrackRect);
                }
            }
            return(result);
        }
        public void DrawCurveEditor(Rect animEditorRect, TimelineWindow.TimelineState state, Vector2 activeRange, bool loop, bool selected)
        {
            this.UpdateCurveEditorIfNeeded(state);
            ZoomableArea arg_29_0 = this.m_CurveEditor;
            float        num      = this.CalculateTopMargin(animEditorRect.get_height());

            this.m_CurveEditor.set_bottommargin(num);
            arg_29_0.set_topmargin(num);
            float num2 = state.TimeToPixel((double)this.m_DataSource.start) - animEditorRect.get_xMin();

            this.m_CurveEditor.set_rightmargin(0f);
            this.m_CurveEditor.set_leftmargin(num2);
            this.m_CurveEditor.set_rect(new Rect(0f, 0f, animEditorRect.get_width(), animEditorRect.get_height()));
            this.m_CurveEditor.SetShownHRangeInsideMargins(0f, (state.PixelToTime(animEditorRect.get_xMax()) - this.m_DataSource.start) * this.m_DataSource.timeScale);
            if (this.m_LastFrameRate != state.frameRate)
            {
                this.m_CurveEditor.get_hTicks().SetTickModulosForFrameRate(state.frameRate);
                this.m_LastFrameRate = state.frameRate;
            }
            CurveWrapper[] animationCurves = this.m_CurveEditor.get_animationCurves();
            for (int i = 0; i < animationCurves.Length; i++)
            {
                CurveWrapper curveWrapper = animationCurves[i];
                curveWrapper.get_renderer().SetWrap(0, (!loop) ? 0 : 2);
            }
            this.m_CurveEditor.BeginViewGUI();
            Color color = GUI.get_color();

            GUI.set_color(Color.get_white());
            GUI.BeginGroup(animEditorRect);
            Graphics.DrawLine(new Vector2(num2, 0f), new Vector2(num2, animEditorRect.get_height()), new Color(1f, 1f, 1f, 0.5f));
            float num3 = activeRange.x - animEditorRect.get_x();
            float num4 = activeRange.y - activeRange.x;

            if (selected)
            {
                Rect rect = new Rect(num3, 0f, num4, animEditorRect.get_height());
                ClipCurveEditor.DrawOutline(rect, 2f);
            }
            EditorGUI.BeginChangeCheck();
            Event current = Event.get_current();

            if (current.get_type() == 8 || current.get_type() == 7 || selected)
            {
                this.m_CurveEditor.CurveGUI();
            }
            this.m_CurveEditor.EndViewGUI();
            if (EditorGUI.EndChangeCheck())
            {
                this.OnCurvesUpdated();
            }
            Color colorInlineCurveOutOfRangeOverlay = DirectorStyles.Instance.customSkin.colorInlineCurveOutOfRangeOverlay;
            Rect  rect2 = new Rect(num2, 0f, num3 - num2, animEditorRect.get_height());

            EditorGUI.DrawRect(rect2, colorInlineCurveOutOfRangeOverlay);
            Rect rect3 = new Rect(num3 + num4, 0f, animEditorRect.get_width() - num3 - num4, animEditorRect.get_height());

            EditorGUI.DrawRect(rect3, colorInlineCurveOutOfRangeOverlay);
            GUI.set_color(color);
            GUI.EndGroup();
            Rect rect4 = animEditorRect;

            rect4.set_width(ClipCurveEditor.s_GridLabelWidth);
            float num5 = num2 - ClipCurveEditor.s_GridLabelWidth;

            if (num5 > 0f)
            {
                rect4.set_x(animEditorRect.get_x() + num5);
            }
            GUI.BeginGroup(rect4);
            this.m_CurveEditor.GridGUI();
            GUI.EndGroup();
        }