示例#1
0
        public void HandleMouseMoveEvent(Event e)
        {
            if (Mirror.IsInteractionSessionActive)
            {
                e.DisableInSceneView();
                Mirror.HandleMouseMoveEvent(e);
                return;
            }

            if (_objectVertexSnapSession.IsActive)
            {
                e.DisableInSceneView();
                _objectVertexSnapSession.UpdateForMouseMovement();
                return;
            }

            SelectionShape.HandleMouseMoveEvent(e);
            _selectionGridSnapSession.UpdateForMouseMovement();
            if (_selectionGrabSession.IsActive)
            {
                _selectionGrabSession.Update();
                ObjectSelectionGizmos.OnObjectSelectionUpdated();
            }

            if (_object2ObjectSnapSession.IsActive)
            {
                _object2ObjectSnapSession.UpdateOnMouseMove();
                ObjectSelectionGizmos.OnObjectSelectionUpdated();
            }
        }
示例#2
0
        public void HandleMouseDragEvent(Event e)
        {
            if (_selectionGridSnapSession.IsActive)
            {
                _selectionGridSnapSession.UpdateForMouseMovement();
            }
            else
            if (_selectionGrabSession.IsActive)
            {
                _selectionGrabSession.Update();
                ObjectSelectionGizmos.OnObjectSelectionUpdated();
            }
            else
            if (_objectVertexSnapSession.IsActive)
            {
                e.DisableInSceneView();
                _objectVertexSnapSession.UpdateForMouseMovement();
                ObjectSelectionGizmos.OnObjectSelectionUpdated();
                return;
            }
            else
            {
                SelectionShape.HandleMouseDragEvent(e);

                var mouseDragSelectionUpdateOperation = ObjectSelectionUpdateOperationFactory.Create(ObjectSelectionUpdateOperationType.MouseDrag);
                mouseDragSelectionUpdateOperation.Perform();
            }

            SceneView.RepaintAll();
        }
示例#3
0
        public void RenderHandles()
        {
            if (_selectionGrabSession.IsActive)
            {
                var labelStyle = new GUIStyle();
                labelStyle.normal.textColor = Color.white;
                Handles.BeginGUI();
                Rect labelRect = new Rect(2.0f, 0.0f, 1000, 20.0f);
                GUI.Label(labelRect, "[Selection Grab]");
                Handles.EndGUI();
            }
            else if (_object2ObjectSnapSession.IsActive)
            {
                var labelStyle = new GUIStyle();
                labelStyle.normal.textColor = Color.white;
                Rect labelRect = new Rect(2.0f, 0.0f, 1000, 20.0f);
                Handles.BeginGUI();
                GUI.Label(labelRect, "[Object2Object Snap]");
                Handles.EndGUI();
            }

            if (!_selectionGridSnapSession.IsActive && !_selectionGrabSession.IsActive && !_object2ObjectSnapSession.IsActive)
            {
                ObjectSelectionGizmos.RenderHandles(_selectedObjects.HashSet);
            }
        }
示例#4
0
        private void RenderGizmoTransformPivotPointSelectionPopup()
        {
            ObjectSelectionGizmos    selectionGizmos = ObjectSelection.Get().ObjectSelectionGizmos;
            TransformGizmoPivotPoint newPivotPoint   = (TransformGizmoPivotPoint)EditorGUILayout.EnumPopup(GetContentForGizmoTransformPivotPointSelectionPopup(), selectionGizmos.GizmoTransformPivotPoint, GUILayout.Width(_selectionGizmoSpecificPopupWidth));

            if (newPivotPoint != selectionGizmos.GizmoTransformPivotPoint)
            {
                UndoEx.RecordForToolAction(selectionGizmos);
                selectionGizmos.GizmoTransformPivotPoint = newPivotPoint;
            }
        }
示例#5
0
        private void RenderGizmoTransformSpaceSelectionPopup()
        {
            ObjectSelectionGizmos selectionGizmos   = ObjectSelection.Get().ObjectSelectionGizmos;
            TransformSpace        newTransformSpace = (TransformSpace)EditorGUILayout.EnumPopup(GetContentForGizmoTransformSpaceSelectionPopup(), selectionGizmos.GizmoTransformSpace, GUILayout.Width(_selectionGizmoSpecificPopupWidth));

            if (newTransformSpace != selectionGizmos.GizmoTransformSpace)
            {
                UndoEx.RecordForToolAction(selectionGizmos);
                selectionGizmos.GizmoTransformSpace = newTransformSpace;
            }
        }