Пример #1
0
 public void AddPossibleOverlap(ShortcutCombo combo)
 {
     if (!_possibleOverlaps.Contains(combo))
     {
         _possibleOverlaps.Add(combo);
     }
 }
Пример #2
0
        private bool IsEqual(ShortcutCombo combo)
        {
            // If the number of keys or mouse button is different, the combos are different
            if (combo._keys.Count != _keys.Count)
            {
                return(false);
            }
            if (combo._mouseButtons.Count != _mouseButtons.Count)
            {
                return(false);
            }

            // All keys in 'this' combo must exist in 'combo'
            foreach (KeyCode key in _keys)
            {
                if (!combo.ContainsKey(key))
                {
                    return(false);
                }
            }

            // All mouse buttons in 'this' combo must exist in 'combo'
            foreach (MouseButton mouseButton in _mouseButtons)
            {
                if (!combo.ContainsMouseButton(mouseButton))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #3
0
        private ShortcutCombo CreateShortcutComboForObjectSelection()
        {
            var shortcutCombo = new ShortcutCombo();

            _shortcutCombosForObjectSelection.Add(shortcutCombo);

            return(shortcutCombo);
        }
Пример #4
0
        private ShortcutCombo CreateShortcutComboForObjectErasing()
        {
            var shortcutCombo = new ShortcutCombo();

            _shortcutCombosForObjectErasing.Add(shortcutCombo);

            return(shortcutCombo);
        }
Пример #5
0
        private ShortcutCombo CreateShortcutComboForObjectPlacement()
        {
            var shortcutCombo = new ShortcutCombo();

            _shortcutCombosForObjectPlacement.Add(shortcutCombo);

            return(shortcutCombo);
        }
Пример #6
0
        private ShortcutCombo CreateShortcutComboForMirroring()
        {
            var shortcutCombo = new ShortcutCombo();

            _shortcutCombosForMirroring.Add(shortcutCombo);

            return(shortcutCombo);
        }
Пример #7
0
        private ShortcutCombo CreateGeneralShortcutCombo()
        {
            var shortcutCombo = new ShortcutCombo();

            _generalShortcutCombos.Add(shortcutCombo);

            return(shortcutCombo);
        }
Пример #8
0
        public bool Equals(ShortcutCombo combo)
        {
            if (ReferenceEquals(combo, null))
            {
                return(false);
            }
            if (ReferenceEquals(combo, this))
            {
                return(true);
            }

            return(IsEqual(combo));
        }
Пример #9
0
        public bool CanOverlapWith(ShortcutCombo shortcutCombo)
        {
            if (shortcutCombo == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, shortcutCombo) || shortcutCombo == this)
            {
                return(false);
            }

            // We can only have an overlap when the number of keys and mouse buttons is <= than the ones in 'shortcutCombo'
            if (NumberOfKeys <= shortcutCombo.NumberOfKeys && NumberOfMouseButtons <= shortcutCombo.NumberOfMouseButtons)
            {
                // We may have an overlap. Return true only if 'shortcutCombo' contains all keys and all mouse buttons which
                // reside in 'this' combo.
                if (shortcutCombo.ContainsAllKeys(_keys) && shortcutCombo.ContainsAllMouseButtons(_mouseButtons))
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #10
0
 public bool IsOverlappedBy(ShortcutCombo shortcutCombo)
 {
     return(CanOverlapWith(shortcutCombo) && shortcutCombo.IsActive(false));
 }
Пример #11
0
 public bool ContainsPossibleOverlap(ShortcutCombo combo)
 {
     return(_possibleOverlaps.Contains(combo));
 }
Пример #12
0
 public void RemovePossibleOverlap(ShortcutCombo combo)
 {
     _possibleOverlaps.Remove(combo);
 }
Пример #13
0
        private void CreateCombos()
        {
            // General
            _activateObjectPlacementGUI = CreateGeneralShortcutCombo();
            _activateObjectPlacementGUI.AddKey(KeyCode.A);
            _activateObjectPlacementGUI.NotActiveWhenMouseButtonsPressed = false;

            _activateObjectSelectionGUI = CreateGeneralShortcutCombo();
            _activateObjectSelectionGUI.AddKey(KeyCode.S);
            _activateObjectSelectionGUI.NotActiveWhenMouseButtonsPressed = false;

            _activateObjectErasingGUI = CreateGeneralShortcutCombo();
            _activateObjectErasingGUI.AddKey(KeyCode.D);
            _activateObjectErasingGUI.NotActiveWhenMouseButtonsPressed = false;

            // Mirroring
            _mirrorSelectedObjects = CreateShortcutComboForMirroring();
            _mirrorSelectedObjects.AddKey(KeyCode.M);

            _snapMirrorToCenterOfSnapSurface = CreateShortcutComboForMirroring();
            _snapMirrorToCenterOfSnapSurface.AddKey(KeyCode.Space);

            _disableMirrorSnapping = CreateShortcutComboForMirroring();
            _disableMirrorSnapping.AddKey(KeyCode.LeftControl);

            _resetMirrorRotationToIdentity = CreateShortcutComboForMirroring();
            _resetMirrorRotationToIdentity.AddKey(KeyCode.I);

            _mouseRotateMirrorAroundX = CreateShortcutComboForMirroring();
            _mouseRotateMirrorAroundX.AddKey(KeyCode.X);
            _mouseRotateMirrorAroundX.AddKey(KeyCode.LeftShift);

            _mouseRotateMirrorAroundY = CreateShortcutComboForMirroring();
            _mouseRotateMirrorAroundY.AddKey(KeyCode.Y);
            _mouseRotateMirrorAroundY.AddKey(KeyCode.LeftShift);

            _mouseRotateMirrorAroundZ = CreateShortcutComboForMirroring();
            _mouseRotateMirrorAroundZ.AddKey(KeyCode.Z);
            _mouseRotateMirrorAroundZ.AddKey(KeyCode.LeftShift);

            _mouseRotateMirrorAroundHoverSurfaceNormal = CreateShortcutComboForMirroring();
            _mouseRotateMirrorAroundHoverSurfaceNormal.AddKey(KeyCode.C);
            _mouseRotateMirrorAroundHoverSurfaceNormal.AddKey(KeyCode.LeftShift);

            _keyboardRotateMirrorAroundX = CreateShortcutComboForMirroring();
            _keyboardRotateMirrorAroundX.AddKey(KeyCode.X);

            _keyboardRotateMirrorAroundY = CreateShortcutComboForMirroring();
            _keyboardRotateMirrorAroundY.AddKey(KeyCode.Y);

            _keyboardRotateMirrorAroundZ = CreateShortcutComboForMirroring();
            _keyboardRotateMirrorAroundZ.AddKey(KeyCode.Z);

            _keyboardRotateMirrorAroundHoverSurfaceNormal = CreateShortcutComboForMirroring();
            _keyboardRotateMirrorAroundHoverSurfaceNormal.AddKey(KeyCode.C);

            _offsetMirrorFromHoverSurface = CreateShortcutComboForMirroring();
            _offsetMirrorFromHoverSurface.AddKey(KeyCode.Q);

            _alignMirrorWithHoverSurface = CreateShortcutComboForMirroring();
            _alignMirrorWithHoverSurface.AddKey(KeyCode.B);

            // Object placement
            _activatePrefabFromPickedObject = CreateShortcutComboForObjectPlacement();
            _activatePrefabFromPickedObject.AddKey(KeyCode.R);

            _activateObjectVertexSnapSession_Placement = CreateShortcutComboForObjectPlacement();
            _activateObjectVertexSnapSession_Placement.AddKey(KeyCode.V);
            _activateObjectVertexSnapSession_Placement.NotActiveWhenRightMouseButtonPressed = false;

            _placeGuideBehindSurfacePlane = CreateShortcutComboForObjectPlacement();
            _placeGuideBehindSurfacePlane.AddKey(KeyCode.N);

            _activateDecorPaintPlacement = CreateShortcutComboForObjectPlacement();
            _activateDecorPaintPlacement.AddKey(KeyCode.Alpha1);

            _activatePointAndClickPlacement = CreateShortcutComboForObjectPlacement();
            _activatePointAndClickPlacement.AddKey(KeyCode.Alpha2);

            _activatePathPlacement = CreateShortcutComboForObjectPlacement();
            _activatePathPlacement.AddKey(KeyCode.Alpha3);

            _activateBlockPlacement = CreateShortcutComboForObjectPlacement();
            _activateBlockPlacement.AddKey(KeyCode.Alpha4);

            _offsetGuideFromPlacementSurface = CreateShortcutComboForObjectPlacement();
            _offsetGuideFromPlacementSurface.AddKey(KeyCode.Q);

            _lockObjectPlacement = CreateShortcutComboForObjectPlacement();
            _lockObjectPlacement.AddKey(KeyCode.L);

            _alignPlacementGuideToNextAxis = CreateShortcutComboForObjectPlacement();
            _alignPlacementGuideToNextAxis.AddKey(KeyCode.B);

            _setPlacementGuideRotationToIdentity = CreateShortcutComboForObjectPlacement();
            _setPlacementGuideRotationToIdentity.AddKey(KeyCode.I);

            _setPlacementGuideScaleToOriginal = CreateShortcutComboForObjectPlacement();
            _setPlacementGuideScaleToOriginal.AddKey(KeyCode.O);

            _cycleThroughPrefabsInActiveCategoryUsingMouseScrollWheel = CreateShortcutComboForObjectPlacement();
            _cycleThroughPrefabsInActiveCategoryUsingMouseScrollWheel.AddKey(KeyCode.LeftShift);

            _cycleThroughPrefabCategoriesUsingMouseScrollWheel = CreateShortcutComboForObjectPlacement();
            _cycleThroughPrefabCategoriesUsingMouseScrollWheel.AddKey(KeyCode.LeftShift);
            _cycleThroughPrefabCategoriesUsingMouseScrollWheel.AddKey(KeyCode.LeftAlt);

            _cancelManualPathConstruction = CreateShortcutComboForObjectPlacement();
            _cancelManualPathConstruction.AddKey(KeyCode.Escape);

            _placePathOnClick = CreateShortcutComboForObjectPlacement();
            _placePathOnClick.AddKey(KeyCode.LeftShift);
            _placePathOnClick.AddMouseButton(MouseButton.Left);

            _manualRaisePath = CreateShortcutComboForObjectPlacement();
            _manualRaisePath.AddKey(KeyCode.G);

            _manualLowerPath = CreateShortcutComboForObjectPlacement();
            _manualLowerPath.AddKey(KeyCode.H);

            _manualRemoveLast2SegmentsInPath = CreateShortcutComboForObjectPlacement();
            _manualRemoveLast2SegmentsInPath.AddKey(KeyCode.R);

            _nextPathExtensionPlane = CreateShortcutComboForObjectPlacement();
            _nextPathExtensionPlane.AddKey(KeyCode.E);

            _beginManualPathConstruction = CreateShortcutComboForObjectPlacement();
            _beginManualPathConstruction.AddMouseButton(MouseButton.Left);

            _manualAttach2NewSegmentsToPath = CreateShortcutComboForObjectPlacement();
            _manualAttach2NewSegmentsToPath.AddMouseButton(MouseButton.Left);

            _beginManualBlockConstruction = CreateShortcutComboForObjectPlacement();
            _beginManualBlockConstruction.AddMouseButton(MouseButton.Left);

            _cancelManualBlockConstruction = CreateShortcutComboForObjectPlacement();
            _cancelManualBlockConstruction.AddKey(KeyCode.Escape);

            _enable1To1RatioBlockAdjustment = CreateShortcutComboForObjectPlacement();
            _enable1To1RatioBlockAdjustment.AddKey(KeyCode.LeftShift);

            _placeBlockOnClick = CreateShortcutComboForObjectPlacement();
            _placeBlockOnClick.AddMouseButton(MouseButton.Left);

            _manualRaiseBlock = CreateShortcutComboForObjectPlacement();
            _manualRaiseBlock.AddKey(KeyCode.G);

            _manualLowerBlock = CreateShortcutComboForObjectPlacement();
            _manualLowerBlock.AddKey(KeyCode.H);

            _nextBlockExtensionPlane = CreateShortcutComboForObjectPlacement();
            _nextBlockExtensionPlane.AddKey(KeyCode.E);

            _cycleThroughProjectedBoxFaceGuidePivotPoints = CreateShortcutComboForObjectPlacement();
            _cycleThroughProjectedBoxFaceGuidePivotPoints.AddKey(KeyCode.J);

            _enableScrollWheelSizeAdjustmentForDecorPaintBrush = CreateShortcutComboForObjectPlacement();
            _enableScrollWheelSizeAdjustmentForDecorPaintBrush.AddKey(KeyCode.LeftControl);

            _scrollWheelTilePaintBrushSize = CreateShortcutComboForObjectPlacement();
            _scrollWheelTilePaintBrushSize.AddKey(KeyCode.LeftControl);

            _keyboardRotatePlacementGuideAroundX = CreateShortcutComboForObjectPlacement();
            _keyboardRotatePlacementGuideAroundX.AddKey(KeyCode.X);

            _keyboardRotatePlacementGuideAroundY = CreateShortcutComboForObjectPlacement();
            _keyboardRotatePlacementGuideAroundY.AddKey(KeyCode.Y);

            _keyboardRotatePlacementGuideAroundZ = CreateShortcutComboForObjectPlacement();
            _keyboardRotatePlacementGuideAroundZ.AddKey(KeyCode.Z);

            _keyboardRotatePlacementGuideAroundPlacementSurfaceNormal = CreateShortcutComboForObjectPlacement();
            _keyboardRotatePlacementGuideAroundPlacementSurfaceNormal.AddKey(KeyCode.C);

            _mouseRotatePlacementGuideAroundX = CreateShortcutComboForObjectPlacement();
            _mouseRotatePlacementGuideAroundX.AddKey(KeyCode.X);
            _mouseRotatePlacementGuideAroundX.AddKey(KeyCode.LeftShift);

            _mouseRotatePlacementGuideAroundY = CreateShortcutComboForObjectPlacement();
            _mouseRotatePlacementGuideAroundY.AddKey(KeyCode.Y);
            _mouseRotatePlacementGuideAroundY.AddKey(KeyCode.LeftShift);

            _mouseRotatePlacementGuideAroundZ = CreateShortcutComboForObjectPlacement();
            _mouseRotatePlacementGuideAroundZ.AddKey(KeyCode.Z);
            _mouseRotatePlacementGuideAroundZ.AddKey(KeyCode.LeftShift);

            _mouseRotatePlacementGuideAroundPlacementSurfaceNormal = CreateShortcutComboForObjectPlacement();
            _mouseRotatePlacementGuideAroundPlacementSurfaceNormal.AddKey(KeyCode.C);
            _mouseRotatePlacementGuideAroundPlacementSurfaceNormal.AddKey(KeyCode.LeftShift);

            _mousePlacementGuideUniformScale = CreateShortcutComboForObjectPlacement();
            _mousePlacementGuideUniformScale.AddKey(KeyCode.LeftControl);
            _mousePlacementGuideUniformScale.AddKey(KeyCode.LeftShift);

            // Object snapping
            _toggleEnableObjectSurfaceGrid = CreateShortcutComboForObjectSnapping();
            _toggleEnableObjectSurfaceGrid.AddKey(KeyCode.W);
            _toggleEnableObjectSurfaceGrid.NotActiveWhenMouseButtonsPressed = true;

            _enableScrollWheelDesiredCellSizeAdjustmentForObjectColliderSnapSurfaceGrid = CreateShortcutComboForObjectSnapping();
            _enableScrollWheelDesiredCellSizeAdjustmentForObjectColliderSnapSurfaceGrid.AddKey(KeyCode.LeftControl);
            _enableScrollWheelDesiredCellSizeAdjustmentForObjectColliderSnapSurfaceGrid.AddKey(KeyCode.Space);

            _snapCenterToCenter = CreateShortcutComboForObjectSnapping();
            _snapCenterToCenter.AddKey(KeyCode.Space);

            _keepSnappedHierarchyInSnapSurfaceArea = CreateShortcutComboForObjectSnapping();
            _keepSnappedHierarchyInSnapSurfaceArea.AddKey(KeyCode.LeftControl);

            _snapXZGridToCursorPickPointOnLeftClick_Placement = CreateShortcutComboForObjectSnapping();
            _snapXZGridToCursorPickPointOnLeftClick_Placement.AddKey(KeyCode.T);

            _adjustXZGridCellSizeToGuideSize = CreateShortcutComboForObjectSnapping();
            _adjustXZGridCellSizeToGuideSize.AddKey(KeyCode.K);

            _stepXZGridUp = CreateShortcutComboForObjectSnapping();
            _stepXZGridUp.AddKey(KeyCode.Alpha6);

            _stepXZGridDown = CreateShortcutComboForObjectSnapping();
            _stepXZGridDown.AddKey(KeyCode.Alpha5);

            _togglePlacementObject2ObjectSnap = CreateShortcutComboForObjectSnapping();
            _togglePlacementObject2ObjectSnap.AddKey(KeyCode.U);

            // Object erasing
            _enableScrollWheelSizeAdjustmentForMassEraseShape = CreateShortcutComboForObjectErasing();
            _enableScrollWheelSizeAdjustmentForMassEraseShape.AddKey(KeyCode.LeftControl);

            _eraseIndividualObjects = CreateShortcutComboForObjectErasing();
            _eraseIndividualObjects.AddKey(KeyCode.Space);

            // Object selection
            _activateObjectVertexSnapSession_Selection = CreateShortcutComboForObjectSelection();
            _activateObjectVertexSnapSession_Selection.AddKey(KeyCode.V);

            _replacePrefabsForSelectedObjects_Preview = CreateShortcutComboForObjectSelection();
            _replacePrefabsForSelectedObjects_Preview.AddKey(KeyCode.LeftShift);

            _replacePrefabsForSelectedObjects_Scene = CreateShortcutComboForObjectSelection();
            _replacePrefabsForSelectedObjects_Scene.AddKey(KeyCode.Space);

            _activateMoveGizmo = CreateShortcutComboForObjectSelection();
            _activateMoveGizmo.AddKey(KeyCode.W);
            _activateMoveGizmo.NotActiveWhenMouseButtonsPressed = false;

            _activateRotationGizmo = CreateShortcutComboForObjectSelection();
            _activateRotationGizmo.AddKey(KeyCode.E);
            _activateRotationGizmo.NotActiveWhenMouseButtonsPressed = false;

            _activateScaleGizmo = CreateShortcutComboForObjectSelection();
            _activateScaleGizmo.AddKey(KeyCode.R);
            _activateScaleGizmo.NotActiveWhenMouseButtonsPressed = false;

            _activateObjectSelectionExtrudeGizmo = CreateShortcutComboForObjectSelection();
            _activateObjectSelectionExtrudeGizmo.AddKey(KeyCode.Q);
            _activateObjectSelectionExtrudeGizmo.NotActiveWhenMouseButtonsPressed = false;

            _enableScrollWheelSizeAdjustmentForSelectionShape = CreateShortcutComboForObjectSelection();
            _enableScrollWheelSizeAdjustmentForSelectionShape.AddKey(KeyCode.LeftControl);

            _enableAppendObjectsToSelection = CreateShortcutComboForObjectSelection();
            _enableAppendObjectsToSelection.AddKey(KeyCode.LeftControl);

            _enableDeselectObjectWithSelectionShape = CreateShortcutComboForObjectSelection();
            _enableDeselectObjectWithSelectionShape.AddKey(KeyCode.LeftShift);

            _deleteSelectedObjects = CreateShortcutComboForObjectSelection();
            _deleteSelectedObjects.AddKey(KeyCode.Delete);

            _selectAllObjectsWithSamePrefabAsCurrentSelection = CreateShortcutComboForObjectSelection();
            _selectAllObjectsWithSamePrefabAsCurrentSelection.AddKey(KeyCode.G);

            _projectSelectedObjects = CreateShortcutComboForObjectSelection();
            _projectSelectedObjects.AddKey(KeyCode.P);

            _selectionGridSnap = CreateShortcutComboForObjectSelection();
            _selectionGridSnap.AddKey(KeyCode.B);

            _grabSelection = CreateShortcutComboForObjectSelection();
            _grabSelection.AddKey(KeyCode.C);

            _grabRotateSelection = CreateShortcutComboForObjectSelection();
            _grabRotateSelection.AddKey(KeyCode.LeftShift);

            _grabScaleSelection = CreateShortcutComboForObjectSelection();
            _grabScaleSelection.AddKey(KeyCode.LeftControl);

            _setRotationToIdentity = CreateShortcutComboForObjectSelection();
            _setRotationToIdentity.AddKey(KeyCode.I);

            _selectionRotateWorldX = CreateShortcutComboForObjectSelection();
            _selectionRotateWorldX.AddKey(KeyCode.X);

            _selectionRotateWorldY = CreateShortcutComboForObjectSelection();
            _selectionRotateWorldY.AddKey(KeyCode.Y);

            _selectionRotateWorldZ = CreateShortcutComboForObjectSelection();
            _selectionRotateWorldZ.AddKey(KeyCode.Z);

            _toggleSelectionObject2ObjectSnap = CreateShortcutComboForObjectSelection();
            _toggleSelectionObject2ObjectSnap.AddKey(KeyCode.U);

            _endSelectionObject2ObjectSnap = CreateShortcutComboForObjectSelection();
            _endSelectionObject2ObjectSnap.AddMouseButton(MouseButton.Left);

            _snapXZGridToCursorPickPointOnLeftClick_Selection = CreateShortcutComboForObjectSelection();
            _snapXZGridToCursorPickPointOnLeftClick_Selection.AddKey(KeyCode.T);
        }