Esempio n. 1
0
        /// <summary>
        /// This method can be called to redo the action.
        /// </summary>
        public void Redo()
        {
            if (_newObjectSelectionMode != _oldObjectSelectionMode)
            {
                // Store data for easy access
                EditorObjectSelection   editorObjectSelection   = EditorObjectSelection.Instance;
                ObjectSelectionSettings objectSelectionSettings = editorObjectSelection.ObjectSelectionSettings;

                // Reactivate the new selection mode
                objectSelectionSettings.ObjectSelectionMode = _newObjectSelectionMode;

                // Send a message to all interested listeners
                ObjectSelectionModeChangedMessage.SendToInterestedListeners(_newObjectSelectionMode);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Executes the action.
        /// </summary>
        public void Execute()
        {
            // Store data for easy access
            EditorObjectSelection   editorObjectSelection   = EditorObjectSelection.Instance;
            ObjectSelectionSettings objectSelectionSettings = editorObjectSelection.ObjectSelectionSettings;

            // Only change the selection mode if it differs from the curent one
            _oldObjectSelectionMode = objectSelectionSettings.ObjectSelectionMode;
            if (_newObjectSelectionMode != _oldObjectSelectionMode)
            {
                // Change the selection mode
                objectSelectionSettings.ObjectSelectionMode = _newObjectSelectionMode;

                // Send a message to all interested listeners
                ObjectSelectionModeChangedMessage.SendToInterestedListeners(_newObjectSelectionMode);

                // Register the action with the Undo/Redo system
                EditorUndoRedoSystem.Instance.RegisterAction(this);
            }
        }
        /// <summary>
        /// Convenience function for sending an object mode selection changed message to
        /// all interested listeners.
        /// </summary>
        public static void SendToInterestedListeners(ObjectSelectionMode newObjectSelectionMode)
        {
            var message = new ObjectSelectionModeChangedMessage(newObjectSelectionMode);

            MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message);
        }