コード例 #1
0
        protected override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (evt.eventTypeId == GeometryChangedEvent.TypeId())
            {
                UpdateSeparators();
            }
            else if (evt.eventTypeId == DetachFromPanelEvent.TypeId())
            {
                graphView = null;
            }
            else if (evt.eventTypeId == AttachToPanelEvent.TypeId())
            {
                graphView = GetFirstAncestorOfType <GraphView>();

                if (graphView != null)
                {
                    // Restore selections on children.
                    foreach (var child in Children().OfType <GraphElement>())
                    {
                        graphView.RestorePersitentSelectionForElement(child);
                    }
                }
            }
        }
コード例 #2
0
        protected override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (evt.eventTypeId == DetachFromPanelEvent.TypeId())
            {
                DetachFromPanelEvent dtpe = (DetachFromPanelEvent)evt;

                if (dtpe.destinationPanel == null)
                {
                    Undo.ClearUndo(m_GraphViewUndoRedoSelection);
                    Undo.undoRedoPerformed -= UndoRedoPerformed;
                    ScriptableObject.DestroyImmediate(m_GraphViewUndoRedoSelection);
                    m_GraphViewUndoRedoSelection = null;

                    if (!EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
                    {
                        ClearSavedSelection();
                    }
                }
            }
            else if (evt.eventTypeId == AttachToPanelEvent.TypeId())
            {
                AttachToPanelEvent atpe = (AttachToPanelEvent)evt;

                if (atpe.originPanel == null)
                {
                    Undo.undoRedoPerformed                += UndoRedoPerformed;
                    m_GraphViewUndoRedoSelection           = ScriptableObject.CreateInstance <GraphViewUndoRedoSelection>();
                    m_GraphViewUndoRedoSelection.hideFlags = HideFlags.HideAndDontSave;
                }
            }
        }
コード例 #3
0
        protected override void ExecuteDefaultAction(EventBase evt)
        {
            if (evt.eventTypeId == GeometryChangedEvent.TypeId())
            {
                if (m_Attacher != null)
                {
                    PerformTipLayout();
                }
            }
            else if (evt.eventTypeId == DetachFromPanelEvent.TypeId())
            {
                if (m_Attacher != null)
                {
                    m_Attacher.Detach();
                    m_Attacher = null;
                }

                HideText();
            }
            else if (evt.eventTypeId == MouseEnterEvent.TypeId())
            {
                //we make sure we sit on top of whatever siblings we have
                BringToFront();
                ShowText();
            }
            else if (evt.eventTypeId == MouseLeaveEvent.TypeId())
            {
                HideText();
            }


            base.ExecuteDefaultAction(evt);
        }
コード例 #4
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            if (evt.GetEventTypeId() == PostLayoutEvent.TypeId())
            {
                if (m_Attacher != null)
                {
                    PerformTipLayout();
                }
            }
            else if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId())
            {
                if (m_Attacher != null)
                {
                    m_Attacher.Detach();
                    m_Attacher = null;
                }
            }
            else if (evt.GetEventTypeId() == MouseEnterEvent.TypeId())
            {
                ShowText();
            }
            else if (evt.GetEventTypeId() == MouseLeaveEvent.TypeId())
            {
                HideText();
            }


            base.ExecuteDefaultAction(evt);
        }
コード例 #5
0
            protected override void ExecuteDefaultAction(EventBase evt)
            {
                base.ExecuteDefaultAction(evt);

                if (evt?.eventTypeId == DetachFromPanelEvent.TypeId())
                {
                    OnDetach();
                }
            }
コード例 #6
0
            protected internal override void ExecuteDefaultAction(EventBase evt)
            {
                base.ExecuteDefaultAction(evt);

                if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId())
                {
                    OnDetach();
                }
            }
コード例 #7
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (evt.GetEventTypeId() == AttachToPanelEvent.TypeId())
            {
                AddWatch();
            }
            else if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId())
            {
                RemoveWatch();
            }
        }
コード例 #8
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if ((evt as MouseDownEvent)?.button == (int)MouseButton.LeftMouse || (evt as KeyDownEvent)?.character == '\n')
            {
                ShowGradientPicker();
            }
            else if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId())
            {
                OnDetach();
            }
            else if (evt.GetEventTypeId() == AttachToPanelEvent.TypeId())
            {
                OnAttach();
            }
        }
コード例 #9
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if ((evt as MouseDownEvent)?.button == (int)MouseButton.LeftMouse || (evt as KeyDownEvent)?.character == '\n')
            {
                ShowCurveEditor();
            }
            else if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId())
            {
                OnDetach();
            }
            if (evt.GetEventTypeId() == GeometryChangedEvent.TypeId())
            {
                m_TextureDirty = true;
            }
        }
コード例 #10
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (evt.GetEventTypeId() == GeometryChangedEvent.TypeId())
            {
                UpdateSeparators();
            }
            else if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId())
            {
                graphView = null;
            }
            else if (evt.GetEventTypeId() == AttachToPanelEvent.TypeId())
            {
                graphView = GetFirstAncestorOfType <GraphView>();
            }
        }
コード例 #11
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (evt.GetEventTypeId() == MouseDownEvent.TypeId())
            {
                OnClick();
            }
            else if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId())
            {
                OnDetach();
            }
            else if (evt.GetEventTypeId() == AttachToPanelEvent.TypeId())
            {
                OnAttach();
            }
        }
コード例 #12
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            // no call to base.ExecuteDefaultAction(evt):
            // - we dont want mouse click to directly give focus to IMGUIContainer:
            //   they should be handled by IMGUI and if an IMGUI control grabs the
            //   keyboard, the IMGUIContainer will gain focus via FocusController.SyncIMGUIFocus.
            // - same thing for tabs: IMGUI should handle them.
            // - we dont want to set the PseudoState.Focus flag on IMGUIContainer.
            //   They are focusable, but only for the purpose of focusing their children.

            // Here, we set flags that will be acted upon in DoOnGUI(), since we need to change IMGUI state.

            if (evt.GetEventTypeId() == BlurEvent.TypeId())
            {
                BlurEvent     be = evt as BlurEvent;
                VisualElement relatedTargetElement = be.relatedTarget as VisualElement;
                // To mimic IMGUI behavior, we only want to clear GUIUtility.keyboardControl
                // when there is something else actually taking focus (canGrabFocus == true)
                // or when the clicked element is the top level IMGUIContainer (relatedTargetElement.parent == panel.visualTree).
                if (relatedTargetElement != null && (be.relatedTarget.canGrabFocus || relatedTargetElement.parent == panel.visualTree))
                {
                    lostFocus = true;
                }
            }
            else if (evt.GetEventTypeId() == FocusEvent.TypeId())
            {
                FocusEvent fe = evt as FocusEvent;
                receivedFocus        = true;
                focusChangeDirection = fe.direction;
            }
            else if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId())
            {
                if (elementPanel != null)
                {
                    elementPanel.IMGUIContainersCount--;
                }
            }
            else if (evt.GetEventTypeId() == AttachToPanelEvent.TypeId())
            {
                if (elementPanel != null)
                {
                    elementPanel.IMGUIContainersCount++;
                }
            }
        }
コード例 #13
0
        protected override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (evt == null)
            {
                return;
            }

            var          showCurveEditor = false;
            KeyDownEvent kde             = (evt as KeyDownEvent);

            if (kde != null)
            {
                if ((kde.keyCode == KeyCode.Space) ||
                    (kde.keyCode == KeyCode.KeypadEnter) ||
                    (kde.keyCode == KeyCode.Return))
                {
                    showCurveEditor = true;
                }
            }
            else if ((evt as MouseDownEvent)?.button == (int)MouseButton.LeftMouse)
            {
                var mde = (MouseDownEvent)evt;
                if (visualInput.ContainsPoint(visualInput.WorldToLocal(mde.mousePosition)))
                {
                    showCurveEditor = true;
                }
            }

            if (showCurveEditor)
            {
                ShowCurveEditor();
            }
            else if (evt.eventTypeId == DetachFromPanelEvent.TypeId())
            {
                OnDetach();
            }
            if (evt.eventTypeId == GeometryChangedEvent.TypeId())
            {
                m_TextureDirty = true;
            }
        }
コード例 #14
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            // no call to base.ExecuteDefaultAction(evt):
            // - we dont want mouse click to directly give focus to IMGUIContainer:
            //   they should be handled by IMGUI and if an IMGUI control grabs the
            //   keyboard, the IMGUIContainer will gain focus via FocusController.SyncIMGUIFocus.
            // - same thing for tabs: IMGUI should handle them.
            // - we dont want to set the PseudoState.Focus flag on IMGUIContainer.
            //   They are focusable, but only for the purpose of focusing their children.

            // Here, we set flags that will be acted upon in DoOnGUI(), since we need to change IMGUI state.
            if (evt.GetEventTypeId() == BlurEvent.TypeId())
            {
                // A lost focus event is ... a lost focus event.
                // The specific handling of the IMGUI will be done in the DoOnGUI() above...
                lostFocus = true;
            }
            else if (evt.GetEventTypeId() == FocusEvent.TypeId())
            {
                FocusEvent fe = evt as FocusEvent;
                receivedFocus        = true;
                focusChangeDirection = fe.direction;
            }
            else if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId())
            {
                if (elementPanel != null)
                {
                    elementPanel.IMGUIContainersCount--;
                }
            }
            else if (evt.GetEventTypeId() == AttachToPanelEvent.TypeId())
            {
                if (elementPanel != null)
                {
                    elementPanel.IMGUIContainersCount++;
                }
            }
        }