Esempio n. 1
0
        public void HandleMouseMoveEvent(Event e)
        {
            if (Mirror.IsInteractionSessionActive)
            {
                e.DisableInSceneView();
                Mirror.HandleMouseMoveEvent(e);
                return;
            }

            SelectionShape.HandleMouseMoveEvent(e);
            _selectionSnapSession.UpdateForMouseMovement();
            if (_selectionGrabSession.IsActive)
            {
                _selectionGrabSession.Update();
                ObjectSelectionTransformGizmoSystem.OnObjectSelectionUpdated();
            }
        }
Esempio n. 2
0
        public void HandleMouseDragEvent(Event e)
        {
            if (_selectionSnapSession.IsActive)
            {
                _selectionSnapSession.UpdateForMouseMovement();
            }
            else
            if (_selectionGrabSession.IsActive)
            {
                _selectionGrabSession.Update();
                ObjectSelectionTransformGizmoSystem.OnObjectSelectionUpdated();
            }
            else
            {
                SelectionShape.HandleMouseDragEvent(e);

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

            SceneView.RepaintAll();
        }
Esempio n. 3
0
        public void HandleKeyboardButtonDownEvent(Event e)
        {
            if (AllShortcutCombos.Instance.GrabSelection.IsActive() && NumberOfSelectedObjects != 0)
            {
                if (_selectionGrabSession.IsActive)
                {
                    _selectionGrabSession.End();
                }
                else
                {
                    _selectionGrabSession.Settings = SelectionGrabSettings;
                    _selectionGrabSession.Begin(new List <GameObject>(_selectedObjects.HashSet));
                }
            }
            if (_selectionGrabSession.IsActive || _selectionSnapSession.IsActive)
            {
                return;
            }

            // Note: Don't disable this event if it's CTRL or CMD because transform
            //       handle snapping will no longer work.
            if (e.keyCode != KeyCode.LeftControl && e.keyCode != KeyCode.LeftCommand &&
                e.keyCode != KeyCode.RightControl && e.keyCode != KeyCode.RightCommand)
            {
                e.DisableInSceneView();
            }

            if (Mirror.IsInteractionSessionActive)
            {
                Mirror.HandleKeyboardButtonDownEvent(e);
                return;
            }

            if (Mirror.IsActive && AllShortcutCombos.Instance.MirrorSelectedObjects.IsActive())
            {
                List <GameObject> topParentsInSelectedObjects = GameObjectExtensions.GetTopParentsFromGameObjectCollection(_selectedObjects.HashSet);
                ObjectHierarchyRootsWerePlacedInSceneMessage.SendToInterestedListeners(Mirror.MirrorGameObjectHierarchies(topParentsInSelectedObjects), ObjectHierarchyRootsWerePlacedInSceneMessage.PlacementType.MirroredSelection);
                return;
            }

            if (AllShortcutCombos.Instance.DeleteSelectedObjects.IsActive())
            {
                UndoEx.RecordForToolAction(this);
                ObjectActions.EraseAllSelectedGameObjects();
            }
            else
            if (AllShortcutCombos.Instance.SelectAllObjectsWithSamePrefabAsCurrentSelection.IsActive())
            {
                UndoEx.RecordForToolAction(this);
                ObjectSelectionActions.SelectAllObjectsWithSamePrefabAsCurrentSelection();
                _objectSelectionTransformGizmoSystem.OnObjectSelectionUpdated();
            }
            else
            if (AllShortcutCombos.Instance.ToggleGizmosOnOff.IsActive())
            {
                UndoEx.RecordForToolAction(_objectSelectionTransformGizmoSystem);
                _objectSelectionTransformGizmoSystem.AreGizmosActive = !_objectSelectionTransformGizmoSystem.AreGizmosActive;
                Octave3DWorldBuilder.ActiveInstance.Inspector.EditorWindow.Repaint();
            }
            else
            if (AllShortcutCombos.Instance.ActivateMoveGizmo.IsActive())
            {
                UndoEx.RecordForToolAction(_objectSelectionTransformGizmoSystem);
                _objectSelectionTransformGizmoSystem.ActiveGizmoType = TransformGizmoType.Move;
                Octave3DWorldBuilder.ActiveInstance.Inspector.EditorWindow.Repaint();
            }
            else
            if (AllShortcutCombos.Instance.ActivateRotationGizmo.IsActive())
            {
                UndoEx.RecordForToolAction(_objectSelectionTransformGizmoSystem);
                _objectSelectionTransformGizmoSystem.ActiveGizmoType = TransformGizmoType.Rotate;
                Octave3DWorldBuilder.ActiveInstance.Inspector.EditorWindow.Repaint();
            }
            else
            if (AllShortcutCombos.Instance.ActivateScaleGizmo.IsActive())
            {
                UndoEx.RecordForToolAction(_objectSelectionTransformGizmoSystem);
                _objectSelectionTransformGizmoSystem.ActiveGizmoType = TransformGizmoType.Scale;
                Octave3DWorldBuilder.ActiveInstance.Inspector.EditorWindow.Repaint();
            }
            else
            if (AllShortcutCombos.Instance.ProjectSelectedObjects.IsActive())
            {
                ProjectSelectionOnProjectionSurface();
            }
            else
            if (AllShortcutCombos.Instance.SnapSelection.IsActive())
            {
                _selectionSnapSession.Begin();
            }
        }