Пример #1
0
        private static void OnSceneView(SceneView sceneView)
        {
            if (m_environmentState != EnvironmentState.Initialized)
            {
                var prev = m_environmentState;
                m_environmentState = ConfigureEnvironment();
                if (prev != m_environmentState)
                {
                    Debug.LogWarning($"Environment state changed from {prev} to {m_environmentState}.");
                }
                if (m_environmentState != EnvironmentState.Initialized)
                {
                    return;
                }
            }

            if (m_requestSceneViewFocus)
            {
                sceneView.Focus();
                m_requestSceneViewFocus = false;
            }

            Event current = Event.current;

            LeftMouseClick  = !current.control && !current.shift && !current.alt && current.type == EventType.MouseDown && current.button == 0;
            KeyEscapeDown   = IsKeyEscapeDown(current);
            RightMouseClick = current.type == EventType.MouseDown && current.button == 1;

            if (RightMouseClick)
            {
                RightMouseDown = true;
            }
            if (current.type == EventType.MouseUp && current.button == 1)
            {
                RightMouseDown = false;
            }

            IsCameraControl = current.alt || RightMouseDown;

            foreach (var primitive in m_visualPrimitives)
            {
                primitive.OnSceneView(sceneView);
            }

            UpdateMouseOverPrimitives(current);

            ToolManager.HandleOnSceneViewGUI(sceneView);

            HandleWindowsGUI(sceneView);

            LeftMouseClick = false;

            if (EditorData.Instance.SecondsSinceLastGC > 5.0 * 60)
            {
                EditorData.Instance.GC();
            }
        }
Пример #2
0
        private static void OnSceneView(SceneView sceneView)
        {
            if (m_requestSceneViewFocus)
            {
                sceneView.Focus();
                m_requestSceneViewFocus = false;
            }

            Event current = Event.current;

            LeftMouseClick  = !current.control && !current.shift && !current.alt && current.type == EventType.MouseDown && current.button == 0;
            KeyEscapeDown   = IsKeyEscapeDown(current);
            RightMouseClick = current.type == EventType.MouseDown && current.button == 1;

            if (RightMouseClick)
            {
                RightMouseDown = true;
            }
            if (current.type == EventType.MouseUp && current.button == 1)
            {
                RightMouseDown = false;
            }

            IsCameraControl = current.alt || RightMouseDown;

            foreach (var primitive in m_visualPrimitives)
            {
                primitive.OnSceneView(sceneView);
            }

            UpdateMouseOverPrimitives(current);

            ToolManager.HandleOnSceneViewGUI(sceneView);

            HandleWindowsGUI(sceneView);

            LeftMouseClick = false;

            if (EditorData.Instance.SecondsSinceLastGC > 5.0 * 60)
            {
                EditorData.Instance.GC();
            }
        }