Exemplo n.º 1
0
 private void InitializeDopeSheet()
 {
     this.m_DopeSheet = new DopeSheetEditor(this.m_OwnerWindow);
     this.m_DopeSheet.SetTickMarkerRanges();
     this.m_DopeSheet.hSlider   = true;
     this.m_DopeSheet.shownArea = new Rect(1f, 1f, 1f, 1f);
     this.m_DopeSheet.rect      = new Rect(0f, 0f, this.contentWidth, 100f);
     this.m_DopeSheet.hTicks.SetTickModulosForFrameRate(this.m_State.frameRate);
 }
Exemplo n.º 2
0
 // Called once during initialization of m_State
 private void InitializeDopeSheet()
 {
     m_DopeSheet = new DopeSheetEditor(m_OwnerWindow);
     m_DopeSheet.SetTickMarkerRanges();
     m_DopeSheet.hSlider   = true;
     m_DopeSheet.shownArea = new Rect(1, 1, 1, 1);
     // The rect here is only for initialization and will be overriden at layout
     m_DopeSheet.rect = new Rect(0, 0, contentWidth, 100);
     m_DopeSheet.hTicks.SetTickModulosForFrameRate(m_State.frameRate);
 }
        public override void Initialize(TimeArea timeArea)
        {
            base.Initialize(timeArea);
            m_DopeSheetEditor = timeArea as DopeSheetEditor;
            m_State           = m_DopeSheetEditor.state;

            if (m_SelectionBoxes == null)
            {
                m_SelectionBoxes = new AreaManipulator[2];

                for (int i = 0; i < 2; ++i)
                {
                    m_SelectionBoxes[i] = new AreaManipulator(styles.rectangleToolSelection, MouseCursor.MoveArrow);

                    m_SelectionBoxes[i].onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                        bool curveEditorOverride = evt.shift || EditorGUI.actionKey;
                        if (!curveEditorOverride && hasSelection && manipulator.rect.Contains(evt.mousePosition))
                        {
                            OnStartMove(new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0.0f), rippleTime);
                            return(true);
                        }

                        return(false);
                    };
                    m_SelectionBoxes[i].onDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                        OnMove(new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0.0f));
                        return(true);
                    };
                    m_SelectionBoxes[i].onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                        OnEndMove();
                        return(true);
                    };
                }
            }

            if (m_SelectionScaleLeft == null)
            {
                m_SelectionScaleLeft = new AreaManipulator(styles.dopesheetScaleLeft, MouseCursor.ResizeHorizontal);

                m_SelectionScaleLeft.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    if (hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        OnStartScale(ToolCoord.Right, ToolCoord.Left, new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), false);
                        return(true);
                    }

                    return(false);
                };
                m_SelectionScaleLeft.onDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    OnScaleTime(PixelToTime(evt.mousePosition.x, frameRate));
                    return(true);
                };
                m_SelectionScaleLeft.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    OnEndScale();
                    return(true);
                };
            }

            if (m_SelectionScaleRight == null)
            {
                m_SelectionScaleRight = new AreaManipulator(styles.dopesheetScaleRight, MouseCursor.ResizeHorizontal);

                m_SelectionScaleRight.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    if (hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        OnStartScale(ToolCoord.Left, ToolCoord.Right, new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), false);
                        return(true);
                    }

                    return(false);
                };
                m_SelectionScaleRight.onDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    OnScaleTime(PixelToTime(evt.mousePosition.x, frameRate));
                    return(true);
                };
                m_SelectionScaleRight.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    OnEndScale();
                    return(true);
                };
            }

            if (m_SelectionRippleLeft == null)
            {
                m_SelectionRippleLeft = new AreaManipulator(styles.dopesheetRippleLeft, MouseCursor.ResizeHorizontal);

                m_SelectionRippleLeft.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    if (hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        OnStartScale(ToolCoord.Right, ToolCoord.Left, new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), true);
                        return(true);
                    }

                    return(false);
                };
                m_SelectionRippleLeft.onDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    OnScaleTime(PixelToTime(evt.mousePosition.x, frameRate));
                    return(true);
                };
                m_SelectionRippleLeft.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    OnEndScale();
                    return(true);
                };
            }

            if (m_SelectionRippleRight == null)
            {
                m_SelectionRippleRight = new AreaManipulator(styles.dopesheetRippleRight, MouseCursor.ResizeHorizontal);

                m_SelectionRippleRight.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    if (hasSelection && manipulator.rect.Contains(evt.mousePosition))
                    {
                        OnStartScale(ToolCoord.Left, ToolCoord.Right, new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), true);
                        return(true);
                    }

                    return(false);
                };
                m_SelectionRippleRight.onDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    OnScaleTime(PixelToTime(evt.mousePosition.x, frameRate));
                    return(true);
                };
                m_SelectionRippleRight.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => {
                    OnEndScale();
                    return(true);
                };
            }
        }
 public override void Initialize(TimeArea timeArea)
 {
     base.Initialize(timeArea);
     this.m_DopeSheetEditor = (timeArea as DopeSheetEditor);
     this.m_State           = this.m_DopeSheetEditor.state;
     if (this.m_SelectionBoxes == null)
     {
         this.m_SelectionBoxes = new AreaManipulator[2];
         for (int i = 0; i < 2; i++)
         {
             this.m_SelectionBoxes[i] = new AreaManipulator(base.styles.rectangleToolSelection, MouseCursor.MoveArrow);
             AreaManipulator expr_66 = this.m_SelectionBoxes[i];
             expr_66.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_66.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt)
             {
                 bool result;
                 if (!evt.shift && !EditorGUI.actionKey && this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
                 {
                     this.OnStartMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), base.rippleTimeClutch);
                     result = true;
                 }
                 else
                 {
                     result = false;
                 }
                 return(result);
             }));
             AreaManipulator expr_8F = this.m_SelectionBoxes[i];
             expr_8F.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_8F.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt)
             {
                 this.OnMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f));
                 return(true);
             }));
             AreaManipulator expr_B8 = this.m_SelectionBoxes[i];
             expr_B8.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_B8.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt)
             {
                 this.OnEndMove();
                 return(true);
             }));
         }
     }
     if (this.m_SelectionScaleLeft == null)
     {
         this.m_SelectionScaleLeft = new AreaManipulator(base.styles.dopesheetScaleLeft, MouseCursor.ResizeHorizontal);
         AreaManipulator expr_10F = this.m_SelectionScaleLeft;
         expr_10F.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_10F.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt)
         {
             bool result;
             if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
             {
                 this.OnStartScale(RectangleTool.ToolCoord.Right, RectangleTool.ToolCoord.Left, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), base.rippleTimeClutch);
                 result = true;
             }
             else
             {
                 result = false;
             }
             return(result);
         }));
         AreaManipulator expr_136 = this.m_SelectionScaleLeft;
         expr_136.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_136.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt)
         {
             this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate));
             return(true);
         }));
         AreaManipulator expr_15D = this.m_SelectionScaleLeft;
         expr_15D.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_15D.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt)
         {
             this.OnEndScale();
             return(true);
         }));
     }
     if (this.m_SelectionScaleRight == null)
     {
         this.m_SelectionScaleRight = new AreaManipulator(base.styles.dopesheetScaleRight, MouseCursor.ResizeHorizontal);
         AreaManipulator expr_1A8 = this.m_SelectionScaleRight;
         expr_1A8.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_1A8.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt)
         {
             bool result;
             if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
             {
                 this.OnStartScale(RectangleTool.ToolCoord.Left, RectangleTool.ToolCoord.Right, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), base.rippleTimeClutch);
                 result = true;
             }
             else
             {
                 result = false;
             }
             return(result);
         }));
         AreaManipulator expr_1CF = this.m_SelectionScaleRight;
         expr_1CF.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_1CF.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt)
         {
             this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate));
             return(true);
         }));
         AreaManipulator expr_1F6 = this.m_SelectionScaleRight;
         expr_1F6.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_1F6.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt)
         {
             this.OnEndScale();
             return(true);
         }));
     }
 }
Exemplo n.º 5
0
 public DopeSheetSelectionRect(DopeSheetEditor owner)
 {
     this.owner = owner;
 }
 public override void Initialize(TimeArea timeArea)
 {
     base.Initialize(timeArea);
     this.m_DopeSheetEditor = timeArea as DopeSheetEditor;
     this.m_State           = this.m_DopeSheetEditor.state;
     if (this.m_SelectionBoxes == null)
     {
         this.m_SelectionBoxes = new AreaManipulator[2];
         for (int i = 0; i < 2; i++)
         {
             this.m_SelectionBoxes[i] = new AreaManipulator(base.styles.rectangleToolSelection, MouseCursor.MoveArrow);
             AreaManipulator manipulator1 = this.m_SelectionBoxes[i];
             manipulator1.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(manipulator1.onStartDrag, delegate(AnimationWindowManipulator manipulator, Event evt) {
                 if ((!(evt.shift || EditorGUI.actionKey) && this.hasSelection) && manipulator.rect.Contains(evt.mousePosition))
                 {
                     this.OnStartMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), base.rippleTimeClutch);
                     return(true);
                 }
                 return(false);
             });
             AreaManipulator manipulator2 = this.m_SelectionBoxes[i];
             manipulator2.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(manipulator2.onDrag, delegate(AnimationWindowManipulator manipulator, Event evt) {
                 this.OnMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f));
                 return(true);
             });
             AreaManipulator manipulator3 = this.m_SelectionBoxes[i];
             manipulator3.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(manipulator3.onEndDrag, delegate(AnimationWindowManipulator manipulator, Event evt) {
                 this.OnEndMove();
                 return(true);
             });
         }
     }
     if (this.m_SelectionScaleLeft == null)
     {
         this.m_SelectionScaleLeft             = new AreaManipulator(base.styles.dopesheetScaleLeft, MouseCursor.ResizeHorizontal);
         this.m_SelectionScaleLeft.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionScaleLeft.onStartDrag, delegate(AnimationWindowManipulator manipulator, Event evt) {
             if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
             {
                 this.OnStartScale(RectangleTool.ToolCoord.Right, RectangleTool.ToolCoord.Left, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), base.rippleTimeClutch);
                 return(true);
             }
             return(false);
         });
         this.m_SelectionScaleLeft.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionScaleLeft.onDrag, delegate(AnimationWindowManipulator manipulator, Event evt) {
             this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate));
             return(true);
         });
         this.m_SelectionScaleLeft.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionScaleLeft.onEndDrag, delegate(AnimationWindowManipulator manipulator, Event evt) {
             this.OnEndScale();
             return(true);
         });
     }
     if (this.m_SelectionScaleRight == null)
     {
         this.m_SelectionScaleRight             = new AreaManipulator(base.styles.dopesheetScaleRight, MouseCursor.ResizeHorizontal);
         this.m_SelectionScaleRight.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionScaleRight.onStartDrag, delegate(AnimationWindowManipulator manipulator, Event evt) {
             if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))
             {
                 this.OnStartScale(RectangleTool.ToolCoord.Left, RectangleTool.ToolCoord.Right, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), base.rippleTimeClutch);
                 return(true);
             }
             return(false);
         });
         this.m_SelectionScaleRight.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionScaleRight.onDrag, delegate(AnimationWindowManipulator manipulator, Event evt) {
             this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate));
             return(true);
         });
         this.m_SelectionScaleRight.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionScaleRight.onEndDrag, delegate(AnimationWindowManipulator manipulator, Event evt) {
             this.OnEndScale();
             return(true);
         });
     }
 }