private void RespondToMessage(UndoRedoWasPerformedMessage message)
 {
     if (_indexOfMarkedEntity >= NumberOfEntities)
     {
         _indexOfMarkedEntity = NumberOfEntities - 1;
     }
 }
 private void RespondToMessage(UndoRedoWasPerformedMessage message)
 {
     _manualConstructionSession.OnExcludeCornersSettingsChanged();
     _manualConstructionSession.OnPaddingSettingsChanged();
     _manualConstructionSession.OnAutomaticRandomHeightAdjustmentSettingsChanged();
     _manualConstructionSession.OnHeightAdjustmentModeChanged();
     _manualConstructionSession.OnSubdivisionSettingsChanged();
 }
Beispiel #3
0
 private void RespondToMessage(UndoRedoWasPerformedMessage message)
 {
     if (_sourcePrefab != PrefabCategoryDatabase.Get().ActivePrefabCategory.ActivePrefab)
     {
         DestroyIfExists();
         CreateFromActivePrefabIfNotExists();
     }
 }
        private void RespondToMessage(UndoRedoWasPerformedMessage message)
        {
            if (IsUnderManualConstruction &&
                _usingTileConnections != Settings.TileConnectionSettings.UseTileConnections)
            {
                Debug.LogWarning("The \'Use tile connections\' property was changed via Undo/Redo while the path was being constructed. This is not allowed. Construction was cancelled.");
                CancelManualConstruction();
                return;
            }

            _manualConstructionSession.OnExcludeCornersSettingsChanged();
            _manualConstructionSession.OnRotateObjectsToFollowPathSettingsChanged();
            _manualConstructionSession.OnPaddingSettingsChanged();
            _manualConstructionSession.OnBorderSettingsChanged();
            _manualConstructionSession.OnHeightAdjustmentModeChanged();
            _manualConstructionSession.OnAutomaticRandomHeightAdjustmentSettingsChanged();
            _manualConstructionSession.OnAutomaticPatternHeightAdjustmentSettingsChanged();
            _manualConstructionSession.OnHeightPatternRemoved();
            _manualConstructionSession.OnNewHeightPatternWasActivated();
        }
Beispiel #5
0
        public static void SendToInterestedListeners(Event undoRedoEvent)
        {
            var message = new UndoRedoWasPerformedMessage(undoRedoEvent);

            MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message);
        }
Beispiel #6
0
        public void HandleSceneViewEvent(Event e)
        {
            if (e.IsUndoRedo())
            {
                SceneViewCamera.Instance.SetObjectVisibilityDirty();
                UndoRedoWasPerformedMessage.SendToInterestedListeners(e);

                // Last step necessary. We have to ensure that all objects have their wireframe hidden.
                // Otherwise, rendering with the 'Gizmos' API becomes corrupted (meshes are not rendered
                // anymore and some other entities like the snap grid becomes darker). Possibly a bug.
                if (ObjectPlacementSettings.Get().HideWireframeWhenPlacingObjects)
                {
                    Octave3DWorldBuilder.ActiveInstance.HideWireframeForSceneObjectsAndPlacementGuide();
                }

                return;
            }

            switch (e.type)
            {
            case EventType.Ignore:

                MouseButtonStates.Instance.ClearStates();
                break;

            case EventType.Repaint:

                HandleRepaintEvent(e);
                break;

            case EventType.MouseMove:

                MouseCursor.Instance.HandleMouseMoveEvent(e);
                HandleMouseMoveEvent(e);
                break;

            case EventType.MouseDrag:

                HandleMouseDragEvent(e);
                break;

            case EventType.MouseDown:

                // Always disable the left mouse button down event in order to avoid deselecting the Octave3D object.
                MouseButtonStates.Instance.OnMouseButtonPressed((MouseButton)e.button);
                if (!e.alt && e.type == EventType.MouseDown && e.button == (int)MouseButton.Left && MouseButtonStates.Instance.GetNumberOfPressedButtons() <= 1)
                {
                    e.DisableInSceneView();
                }

                HandleMouseButtonDownEvent(e);
                break;

            case EventType.MouseUp:

                MouseButtonStates.Instance.OnMouseButtonReleased((MouseButton)e.button);
                HandleMouseButtonUpEvent(e);
                break;

            case EventType.ScrollWheel:

                HandleMouseScrollWheelEvent(e);
                break;

            case EventType.KeyDown:

                KeyboardButtonStates.Instance.OnKeyboardButtonPressed(e.keyCode);
                if (HandleGeneralShortcutKeys(e))
                {
                    return;
                }

                // Always disable the 'Delete' key in order to avoid deleting the Octave3D object from the scene.
                if (e.type == EventType.KeyDown && e.keyCode == KeyCode.Delete)
                {
                    e.DisableInSceneView();
                }

                if (e.keyCode == KeyCode.F)
                {
                    Octave3DWorldBuilder activeInstance = Octave3DWorldBuilder.ActiveInstance;
                    if (activeInstance != null)
                    {
                        List <GameObject> selectedObjects = new List <GameObject>(activeInstance.ObjectSelection.GetAllSelectedGameObjects());
                        Selection.objects = selectedObjects.ToArray();
                        if (SceneView.lastActiveSceneView != null)
                        {
                            SceneView.lastActiveSceneView.FrameSelected();
                        }

                        activeInstance.OnCamFocused();
                    }
                    break;
                }

                HandleKeyboardButtonDownEvent(e);
                break;

            case EventType.KeyUp:

                KeyboardButtonStates.Instance.OnKeyboardButtonReleased(e.keyCode);
                HandleKeyboardButtonUpEvent(e);
                break;

            case EventType.ExecuteCommand:

                HandleExecuteCommandEvent(e);
                break;
            }
        }