public void Process(Event currentEvent)
        {
            if (currentEvent.type == EventType.mouseDown)
            {
                if (currentEvent.button == 0)
                {
                    if ((!currentEvent.control && currentEvent.shift) || BGCurveSettingsForEditor.LockView)
                    {
                        eventCanceller = new BGEditorUtility.EventCanceller();

                        if (!BGCurveSettingsForEditor.DisableRectangularSelection)
                        {
                            selectionRectangle.On();
                        }
                    }
                }
                else if (currentEvent.button == 1 && selectionRectangle.IsOn)
                {
                    //glitch with right click
                    GUIUtility.hotControl = GUIUtility.GetControlID(FocusType.Passive);
                }
            }
            else if (currentEvent.type == EventType.mouseUp)
            {
                SceneView.RepaintAll();
                selectionRectangle.Off();
                BGEditorUtility.Release(ref eventCanceller);
            }


            selectionRectangle.Process(currentEvent);
        }
        public void Process(Event currentEvent)
        {
            if (!On && currentEvent.control)
            {
                On = true;
            }

            if (!On)
            {
                return;
            }

            if (On && !currentEvent.control)
            {
                On = false;
            }

            if (currentEvent.type == EventType.MouseUp)
            {
                BGEditorUtility.Release(ref EventCanceller);
            }

            if (currentEvent.shift && !currentEvent.control)
            {
                return;
            }

            if (!BGEditorUtility.IsMouseInsideSceneView())
            {
                return;
            }

            foreach (var action in actions)
            {
                var    position = Vector3.zero;
                string message  = null;

                if (!action.Seize(currentEvent, ref position, ref message))
                {
                    continue;
                }

                if (message != null)
                {
                    Message(action, position, message);
                }
                break;
            }

            if (currentEvent.control && currentEvent.type != EventType.Repaint)
            {
                SceneView.RepaintAll();
            }
        }
Beispiel #3
0
        public void Process(Event currentEvent)
        {
            if (currentEvent.type == EventType.mouseDown)
            {
                if (currentEvent.button == 0)
                {
                    if ((!currentEvent.control && currentEvent.shift) || BGCurveSettingsForEditor.LockView)
                    {
                        var cancelEvent = Tools.viewTool != ViewTool.FPS && Tools.current != Tool.View /*&& Tools.current != Tool.None*/ && !currentEvent.isKey;
                        if (cancelEvent)
                        {
                            eventCanceller = new BGEditorUtility.EventCanceller();
                        }

                        if (currentEvent.shift && !BGCurveSettingsForEditor.DisableRectangularSelection)
                        {
                            selectionRectangle.On();
                        }
                        else if (cancelEvent)
                        {
                            BGCurveEditor.OverlayMessage.Display("The Scene view is locked.\r\n Set 'Lock View' (in the BGCurve Editor) to false to unlock.");
                        }
                    }
                }
                else if (currentEvent.button == 1 && selectionRectangle.IsOn)
                {
                    //glitch with right click
                    GUIUtility.hotControl = GUIUtility.GetControlID(FocusType.Passive);
                }
            }
            else if (currentEvent.type == EventType.mouseUp)
            {
                SceneView.RepaintAll();
                selectionRectangle.Off();
                BGEditorUtility.Release(ref eventCanceller);
            }


            selectionRectangle.Process(currentEvent);
        }
Beispiel #4
0
        public void Process(Event currentEvent)
        {
            if (!On && currentEvent.control)
            {
                On = true;
            }

            if (!On)
            {
                return;
            }

            if (On && !currentEvent.control)
            {
                On = false;
            }

            if (currentEvent.type == EventType.mouseUp)
            {
                BGEditorUtility.Release(ref EventCanceller);
            }

            if (currentEvent.shift && !currentEvent.control)
            {
                return;
            }

            if (!BGEditorUtility.IsMouseInsideSceneView())
            {
                return;
            }

            BGEditorUtility.Assign(ref style, () => new GUIStyle("Label")
            {
                padding   = new RectOffset(4, 4, 4, 4),
                border    = new RectOffset(4, 4, 4, 4),
                fontStyle = FontStyle.Bold,
                richText  = true,
                normal    = new GUIStyleState
                {
                    textColor  = Color.white,
                    background = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGBoxWithBorder123)
                }
            });


            foreach (var action in actions)
            {
                var    position = Vector3.zero;
                string message  = null;

                if (!action.Seize(currentEvent, ref position, ref message))
                {
                    continue;
                }

                if (message != null)
                {
                    Message(action, position, message);
                }
                break;
            }

            if (currentEvent.control && currentEvent.type != EventType.Repaint)
            {
                SceneView.RepaintAll();
            }
        }
        public void Process(Event currentEvent)
        {
            if (currentEvent.type == EventType.mouseUp)
            {
                BGEditorUtility.Release(ref EventCanceller);
            }

            if (currentEvent.shift && !currentEvent.control)
            {
                return;
            }

            Vector3 mousePosition = Event.current.mousePosition;

            var pixelHeight = SceneView.currentDrawingSceneView.camera.pixelHeight;
            var pixelWidth  = SceneView.currentDrawingSceneView.camera.pixelWidth;

            mousePosition.y = pixelHeight - mousePosition.y;
            if (mousePosition.x < 0 || mousePosition.y < 0 || mousePosition.x > pixelWidth || mousePosition.y > pixelHeight)
            {
                return;
            }


            BGEditorUtility.Assign(ref style, () => new GUIStyle("Label")
            {
                padding   = new RectOffset(4, 4, 4, 4),
                border    = new RectOffset(4, 4, 4, 4),
                fontStyle = FontStyle.Bold,
                richText  = true,
                normal    = new GUIStyleState
                {
                    textColor  = Color.white,
                    background = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGBoxWithBorder123)
                }
            });


            foreach (var action in actions)
            {
                var    position = Vector3.zero;
                string message  = null;

                var seized = action.Seize(currentEvent, ref position, ref message);
                if (!seized)
                {
                    continue;
                }

                if (message != null)
                {
                    Message(action, position, message);
                }
                break;
            }

            if (currentEvent.control && currentEvent.type != EventType.Repaint)
            {
                SceneView.RepaintAll();
            }
        }