Пример #1
0
        public CurveEditor()
        {
            if (UnityEditor.EditorGUIUtility.isProSkin)
            {
                Background = new Color(0.15f, 0.15f, 0.15f, 1.0f);
            }
            else
            {
                Background = new Color(0.55f, 0.55f, 0.55f, 1.0f);
            }

            this.Selection = new UI.SelectableCollection <CurveKey>();
            _CurveView     = new TimeLineCurveView(this);
            _TimeLine      = new TimeLine(_CurveView)
            {
                SelectionEnable = false
            };
            _TimeLine.TimeBar.ShowTimePosition = false;
            _TimeLine.TimeBar.TimeStyle        = false;
            _Grid = new TimeLineGrid(_TimeLine.TimeBar)
            {
                Row = _CurveView.Row, Column = _CurveView.Column, RowSpan = _CurveView.RowSpan, ColumnSpan = _CurveView.ColumnSpan
            };
            _Grid.Margin = new Thickness(0, 0, 0, _TimeLine.View.ScrollbarThickness);
            _TimeLine.Controls.Add(_Grid);
            _Grid.BringToBack();

            this.Selection.SelectionChanged += Selection_SelectionChanged;
            this.Controls.Add(_TimeLine);
        }
Пример #2
0
        public CurveTrack(TimeLineCurveView view, AnimationCurve curve)
        {
            if (view == null)
            {
                throw new System.ArgumentNullException("Invalid TimeLineCurveView");
            }
            if (curve == null)
            {
                throw new System.ArgumentNullException("Invalid AnimationCurve");
            }

            this.View  = view;
            this.Curve = curve;
            this.Color = Color.green;

            this._Samples       = new List <Vector2>(2000);
            this._Parts         = new List <CurvePart>(5);
            this.IsInScrollView = true;
            RebuildKeys();
        }