diff --git a/AssetEditor.sln b/AssetEditor.sln index aab7a3425..0957bed5d 100644 --- a/AssetEditor.sln +++ b/AssetEditor.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.5.33516.290 +# Visual Studio Version 18 +VisualStudioVersion = 18.0.11111.16 d18.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Testing", "Testing", "{18424B6A-CB8A-4CE1-935C-72459F31521B}" EndProject @@ -90,6 +90,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Editors.DatabaseEditor", "E EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utility.DatabaseSchemaGenerator", "Editors\DatabaseEditor\Utility.DatabaseSchemaGenerator\Utility.DatabaseSchemaGenerator.csproj", "{0298ED36-AE77-4CC3-9A46-40D700A3C225}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Audio", "Audio", "{4D35FFE2-8490-4694-8981-654016F2BD3D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -232,7 +234,7 @@ Global {CAEB33BF-48DF-4388-BE6B-7D7ABBB9414B} = {07AC615B-A8FC-4E1A-BDD5-BC11452429A0} {EAFBC3D8-A146-4BA3-8024-DE4E20D3C884} = {07AC615B-A8FC-4E1A-BDD5-BC11452429A0} {8E55B123-C8E5-4D65-AAAA-C4DC4713CB8E} = {07AC615B-A8FC-4E1A-BDD5-BC11452429A0} - {410AC3F4-021C-4993-BCCA-1810D153075D} = {07AC615B-A8FC-4E1A-BDD5-BC11452429A0} + {410AC3F4-021C-4993-BCCA-1810D153075D} = {4D35FFE2-8490-4694-8981-654016F2BD3D} {4FA1E72D-8764-4E6E-8C3A-B6BFE0821B5C} = {07AC615B-A8FC-4E1A-BDD5-BC11452429A0} {F513A090-CC3F-4DB4-8332-50EB3FDA5A37} = {07AC615B-A8FC-4E1A-BDD5-BC11452429A0} {0B14A236-AAE0-4E9B-A41E-4AF9DD976BA7} = {18424B6A-CB8A-4CE1-935C-72459F31521B} @@ -257,6 +259,7 @@ Global {5A4DFCA4-6884-49D2-BA24-A9C8676A0C77} = {07AC615B-A8FC-4E1A-BDD5-BC11452429A0} {BEE61E8C-B25D-4982-9C42-6131AED41B48} = {5A4DFCA4-6884-49D2-BA24-A9C8676A0C77} {0298ED36-AE77-4CC3-9A46-40D700A3C225} = {5A4DFCA4-6884-49D2-BA24-A9C8676A0C77} + {4D35FFE2-8490-4694-8981-654016F2BD3D} = {07AC615B-A8FC-4E1A-BDD5-BC11452429A0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {AB5968F3-98ED-4AFF-98EA-0DBEDCACADF2} diff --git a/AssetEditor/AssetEditor.csproj b/AssetEditor/AssetEditor.csproj index 0042bb0d1..8c81e80bb 100644 --- a/AssetEditor/AssetEditor.csproj +++ b/AssetEditor/AssetEditor.csproj @@ -28,6 +28,14 @@ + + + Content\%(RecursiveDir)%(Filename)%(Extension) + PreserveNewest + Always + + + embedded AssetEdCommunity @@ -43,22 +51,19 @@ - - + Make sure any documentation comments which are included in code get checked for syntax during the build, but do + not report warnings for missing comments. + CS1573: Parameter 'parameter' has no matching param tag in the XML comment for 'parameter' (but other parameters do) + CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' + CS1712: Type parameter 'type_parameter' has no matching typeparam tag in the XML comment on 'type_or_member' (but other type parameters do) + --> False $(NoWarn),1573,1591,1712 - \ No newline at end of file diff --git a/AssetEditor/ViewModels/SettingsViewModel.cs b/AssetEditor/ViewModels/SettingsViewModel.cs index f29543ab6..aa7c8ef94 100644 --- a/AssetEditor/ViewModels/SettingsViewModel.cs +++ b/AssetEditor/ViewModels/SettingsViewModel.cs @@ -37,12 +37,12 @@ public SettingsViewModel(ApplicationSettingsService settingsService) RenderEngineBackgroundColours = new ObservableCollection((BackgroundColour[])Enum.GetValues(typeof(BackgroundColour))); CurrentRenderEngineBackgroundColour = _settingsService.CurrentSettings.RenderEngineBackgroundColour; StartMaximised = _settingsService.CurrentSettings.StartMaximised; - Games = new ObservableCollection(GameInformationDatabase.Games.OrderBy(g => g.DisplayName).Select(g => g.Type)); + Games = new ObservableCollection(GameInformationDatabase.Games.Values.OrderBy(game => game.DisplayName).Select(game => game.Type)); CurrentGame = _settingsService.CurrentSettings.CurrentGame; LoadCaPacksByDefault = _settingsService.CurrentSettings.LoadCaPacksByDefault; ShowCAWemFiles = _settingsService.CurrentSettings.ShowCAWemFiles; OnlyLoadLod0ForReferenceMeshes = _settingsService.CurrentSettings.OnlyLoadLod0ForReferenceMeshes; - foreach (var game in GameInformationDatabase.Games.OrderBy(g => g.DisplayName)) + foreach (var game in GameInformationDatabase.Games.Values.OrderBy(game => game.DisplayName)) { GameDirectores.Add( new GamePathItem() @@ -56,7 +56,8 @@ public SettingsViewModel(ApplicationSettingsService settingsService) } - [RelayCommand] private void Save() + [RelayCommand] + private void Save() { _settingsService.CurrentSettings.Theme = CurrentTheme; _settingsService.CurrentSettings.RenderEngineBackgroundColour = CurrentRenderEngineBackgroundColour; @@ -73,7 +74,8 @@ [RelayCommand] private void Save() MessageBox.Show("Please restart the tool after updating settings!"); } - [RelayCommand] private void Browse() + [RelayCommand] + private void Browse() { var dialog = new OpenFileDialog(); dialog.Filter = "Executable files (*.exe)|*.exe"; diff --git a/Audio b/Audio new file mode 100644 index 000000000..e69de29bb diff --git a/Editors/Audio/AudioEditor/AudioEditorService.cs b/Editors/Audio/AudioEditor/AudioEditorService.cs deleted file mode 100644 index 7a0f5c19c..000000000 --- a/Editors/Audio/AudioEditor/AudioEditorService.cs +++ /dev/null @@ -1,431 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; -using Editors.Audio.AudioEditor.AudioFilesExplorer; -using Editors.Audio.AudioEditor.AudioProjectData; -using Editors.Audio.AudioEditor.AudioProjectEditor; -using Editors.Audio.AudioEditor.AudioProjectExplorer; -using Editors.Audio.AudioEditor.AudioProjectViewer; -using Editors.Audio.AudioEditor.AudioSettings; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.AudioProjectCompiler; -using Editors.Audio.GameSettings.Warhammer3; -using Serilog; -using Shared.Core.ErrorHandling; -using Shared.Core.PackFiles; -using Shared.Core.PackFiles.Models; -using Shared.Core.Services; -using static Editors.Audio.GameSettings.Warhammer3.DialogueEvents; -using static Editors.Audio.GameSettings.Warhammer3.StateGroups; -using TreeNode = Editors.Audio.AudioEditor.AudioProjectExplorer.TreeNode; - -namespace Editors.Audio.AudioEditor -{ - public class AudioEditorService : IAudioEditorService - { - readonly ILogger _logger = Logging.Create(); - - private readonly IPackFileService _packFileService; - private readonly IFileSaveService _fileSaveService; - private readonly IStandardDialogs _standardDialogs; - private readonly IntegrityChecker _integrityChecker; - private readonly CompilerDataProcessor _compilerDataProcessor; - private readonly SoundBankGenerator _soundBankGenerator; - private readonly WemGenerator _wemGenerator; - private readonly DatGenerator _datGenerator; - - public AudioEditorService( - IPackFileService packFileService, - IFileSaveService fileSaveService, - IStandardDialogs standardDialogs, - IntegrityChecker integrityChecker, - CompilerDataProcessor compilerDataProcessor, - SoundBankGenerator soundBankGenerator, - WemGenerator wemGenerator, - DatGenerator datGenerator) - { - _packFileService = packFileService; - _fileSaveService = fileSaveService; - _standardDialogs = standardDialogs; - _integrityChecker = integrityChecker; - _compilerDataProcessor = compilerDataProcessor; - _soundBankGenerator = soundBankGenerator; - _wemGenerator = wemGenerator; - _datGenerator = datGenerator; - } - - public AudioProject AudioProject { get; set; } - public string AudioProjectFileName { get; set; } - public string AudioProjectDirectory { get; set; } - public AudioEditorViewModel AudioEditorViewModel { get; set; } - public AudioProjectExplorerViewModel AudioProjectExplorerViewModel { get; set; } - public AudioFilesExplorerViewModel AudioFilesExplorerViewModel { get; set; } - public AudioProjectEditorViewModel AudioProjectEditorViewModel { get; set; } - public AudioProjectViewerViewModel AudioProjectViewerViewModel { get; set; } - public AudioSettingsViewModel AudioSettingsViewModel { get; set; } - public Dictionary> ModdedStatesByStateGroupLookup { get; set; } = []; - public Dictionary> DialogueEventsWithStateGroupsWithIntegrityError { get; set; } = []; - public Dictionary DialogueEventSoundBankFiltering { get; set; } = []; // TODO: Check if unused? Also check for other unused functions. - - public void SaveAudioProject() - { - var audioProject = GetAudioProjectWithoutUnusedObjects(); - - var options = new JsonSerializerOptions - { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - WriteIndented = true - }; - var audioProjectJson = JsonSerializer.Serialize(audioProject, options); - var audioProjectFileName = $"{AudioProjectFileName}.aproj"; - var audioProjectFilePath = $"{AudioProjectDirectory}\\{audioProjectFileName}"; - var packFile = PackFile.CreateFromASCII(audioProjectFileName, audioProjectJson); - _fileSaveService.Save(audioProjectFilePath, packFile.DataSource.ReadData(), true); - - _logger.Here().Information($"Saved Audio Project file: {AudioProjectDirectory}\\{AudioProjectFileName}.aproj"); - } - - public void LoadAudioProject(AudioEditorViewModel audioEditorViewModel) - { - var result = _standardDialogs.DisplayBrowseDialog([".aproj"]); - if (result.Result) - { - var filePath = _packFileService.GetFullPath(result.File); - var fileName = Path.GetFileName(filePath); - var fileType = Path.GetExtension(filePath); - var file = _packFileService.FindFile(filePath); - var bytes = file.DataSource.ReadData(); - var audioProjectJson = Encoding.UTF8.GetString(bytes); - - audioEditorViewModel.AudioProjectExplorerViewModel.AudioProjectExplorerLabel = $"Audio Project Explorer - {DataGridHelpers.AddExtraUnderscoresToString(fileName)}"; - - // Reset data - audioEditorViewModel.ResetAudioEditorData(); - ResetAudioProject(); - - // Set the AudioProject - var savedProject = JsonSerializer.Deserialize(audioProjectJson); - AudioProjectFileName = fileName.Replace(fileType, string.Empty); - AudioProjectDirectory = filePath.Replace($"\\{fileName}", string.Empty); - - // Initialise a full Audio Project and merge the saved Audio Project with it - InitialiseAudioProject(AudioProjectFileName, AudioProjectDirectory, savedProject.Language); - MergeSavedAudioProjectIntoAudioProjectWithUnusedItems(savedProject); - - // Initialise data after AudioProject is set so it uses the correct instance - audioEditorViewModel.InitialiseAudioEditorData(); - - // Get the Modded States and prepare them for being added to the DataGrid ComboBoxes - BuildModdedStatesByStateGroupLookup(AudioProject.StateGroups, ModdedStatesByStateGroupLookup); - - _integrityChecker.CheckAudioProjectDialogueEventIntegrity(this); - - _logger.Here().Information($"Loaded Audio Project: {fileName}"); - } - } - - public void InitialiseAudioProject(string fileName, string directory, string language) - { - AudioEditorViewModel.AudioProjectExplorerViewModel.AudioProjectExplorerLabel = $"Audio Project Explorer - {DataGridHelpers.AddExtraUnderscoresToString(fileName)}"; - - AudioProjectFileName = fileName; - AudioProjectDirectory = directory; - AudioProject.Language = language; - - InitialiseSoundBanks(); - - InitialiseModdedStatesGroups(); - - SortSoundBanksAlphabetically(); - - AudioEditorViewModel.AudioProjectExplorerViewModel.CreateAudioProjectTree(); - } - - public void CompileAudioProject() - { - var audioProject = GetAudioProjectWithoutUnusedObjects(); - - SaveAudioProject(); - - if (audioProject.SoundBanks == null) - return; - - var audioProjectFileName = AudioProjectFileName.Replace(" ", "_"); - _compilerDataProcessor.SetSoundBankData(audioProject, audioProjectFileName); - - // We set the data from the bottom up, so Sounds, then Actions, then Events to ensure that IDs are generated before they're referenced. - // For example IDs set in Sounds / Sound Containers are used in Actions, and IDs set in Actions are used in Events. - _compilerDataProcessor.SetInitialSourceData(audioProject); - - if (audioProject.SoundBanks.Any(soundBank => soundBank.ActionEvents != null)) - { - _compilerDataProcessor.CreateStopActionEvents(audioProject); - _compilerDataProcessor.SetActionData(audioProject); - _compilerDataProcessor.SetActionEventData(audioProject); - } - - if (audioProject.SoundBanks.Any(soundBank => soundBank.DialogueEvents != null)) - { - _compilerDataProcessor.SetStatesData(audioProject); - _compilerDataProcessor.SetDialogueEventData(audioProject); - } - - _wemGenerator.GenerateWems(audioProject); - - _compilerDataProcessor.SetRemainingSourceData(audioProject); - - _wemGenerator.SaveWemsToPack(audioProject); - - _soundBankGenerator.GenerateSoundBanks(audioProject); - - _datGenerator.GenerateDatFiles(audioProject, audioProjectFileName); - - SaveCompiledAudioProjectToPack(audioProject); - } - - private void InitialiseSoundBanks() - { - var soundBanks = Enum.GetValues() - .Select(soundBankSubtype => new SoundBank - { - Name = SoundBanks.GetSoundBankSubTypeString(soundBankSubtype), - SoundBankType = SoundBanks.GetSoundBankSubType(soundBankSubtype) - }) - .ToList(); - - AudioProject.SoundBanks = []; - - foreach (var soundBankSubtype in Enum.GetValues()) - { - var soundBank = new SoundBank - { - Name = SoundBanks.GetSoundBankSubTypeString(soundBankSubtype), - SoundBankType = SoundBanks.GetSoundBankSubType(soundBankSubtype) - }; - - if (soundBank.SoundBankType == SoundBanks.Wh3SoundBankType.ActionEventSoundBank) - soundBank.ActionEvents = []; - else - { - soundBank.DialogueEvents = []; - - var filteredDialogueEvents = DialogueEventData - .Where(dialogueEvent => dialogueEvent.SoundBank == SoundBanks.GetSoundBankSubtype(soundBank.Name)); - - foreach (var dialogueData in filteredDialogueEvents) - { - var dialogueEvent = new DialogueEvent - { - Name = dialogueData.Name, - StatePaths = [] - }; - soundBank.DialogueEvents.Add(dialogueEvent); - } - } - - AudioProject.SoundBanks.Add(soundBank); - } - } - - private void InitialiseModdedStatesGroups() - { - AudioProject.StateGroups = []; - - foreach (var moddedStateGroup in ModdedStateGroups) - { - var stateGroup = new StateGroup { Name = moddedStateGroup, States = [] }; - AudioProject.StateGroups.Add(stateGroup); - } - } - - public void SortSoundBanksAlphabetically() - { - var sortedSoundBanks = AudioProject.SoundBanks.OrderBy(soundBank => soundBank.Name).ToList(); - - AudioProject.SoundBanks.Clear(); - - foreach (var soundBank in sortedSoundBanks) - AudioProject.SoundBanks.Add(soundBank); - } - - public void BuildModdedStatesByStateGroupLookup(List moddedStateGroups, Dictionary> moddedStatesByStateGroupLookup) - { - if (moddedStatesByStateGroupLookup == null) - moddedStatesByStateGroupLookup = new Dictionary>(); - else - moddedStatesByStateGroupLookup.Clear(); - - foreach (var stateGroup in moddedStateGroups) - { - if (stateGroup.States != null && stateGroup.States.Count > 0) - { - foreach (var state in stateGroup.States) - { - if (!moddedStatesByStateGroupLookup.ContainsKey(stateGroup.Name)) - moddedStatesByStateGroupLookup[stateGroup.Name] = new List(); - - moddedStatesByStateGroupLookup[stateGroup.Name].Add(state.Name); - } - } - } - } - - private AudioProject GetAudioProjectWithoutUnusedObjects() - { - var usedSoundBanksList = AudioProject.SoundBanks - .Where(soundBank => soundBank != null) - .Select(soundBank => - { - var dialogueEvents = (soundBank.DialogueEvents ?? Enumerable.Empty()) - .Where(dialogueEvent => dialogueEvent.StatePaths != null && dialogueEvent.StatePaths.Count != 0) - .ToList(); - - var actionEvents = (soundBank.ActionEvents ?? Enumerable.Empty()) - .Where(actionEvent => actionEvent.Sound != null || actionEvent.RandomSequenceContainer != null) - .ToList(); - - return new SoundBank - { - Name = soundBank.Name, - SoundBankType = soundBank.SoundBankType, - DialogueEvents = dialogueEvents.Count != 0 - ? new List(dialogueEvents) - : null, - ActionEvents = actionEvents.Count != 0 - ? new List(actionEvents) - : null - }; - }) - .Where(soundBank => soundBank.DialogueEvents != null && soundBank.DialogueEvents.Any() || soundBank.ActionEvents != null && soundBank.ActionEvents.Any()) - .ToList(); - - var soundBanksResult = usedSoundBanksList.Count != 0 - ? new List(usedSoundBanksList) - : null; - - var usedStateGroupsList = (AudioProject.StateGroups ?? new List()) - .Where(stateGroup => stateGroup.States != null && stateGroup.States.Count != 0) - .ToList(); - - var stateGroupsResult = usedStateGroupsList.Count != 0 - ? new List(usedStateGroupsList) - : null; - - return new AudioProject - { - Language = AudioProject.Language, - SoundBanks = soundBanksResult, - StateGroups = stateGroupsResult - }; - } - - private void MergeSavedAudioProjectIntoAudioProjectWithUnusedItems(AudioProject savedProject) - { - if (savedProject == null) - return; - - if (!string.IsNullOrEmpty(savedProject.Language)) - AudioProject.Language = savedProject.Language; - - if (savedProject.SoundBanks != null) - { - foreach (var savedSoundBank in savedProject.SoundBanks) - { - var soundBank = AudioProject.SoundBanks.FirstOrDefault(soundBank => soundBank.Name == savedSoundBank.Name); - if (soundBank != null) - { - if (savedSoundBank.DialogueEvents != null) - { - foreach (var savedDialogueEvent in savedSoundBank.DialogueEvents) - { - var dialogueEvent = soundBank.DialogueEvents.FirstOrDefault(dialogueEvent => dialogueEvent.Name == savedDialogueEvent.Name); - if (dialogueEvent != null) - dialogueEvent.StatePaths = savedDialogueEvent.StatePaths; - else - soundBank.DialogueEvents.Add(savedDialogueEvent); - } - } - - if (savedSoundBank.ActionEvents != null) - { - foreach (var savedActionEvent in savedSoundBank.ActionEvents) - { - var actionEvent = soundBank.ActionEvents.FirstOrDefault(actionEvent => actionEvent.Name == savedActionEvent.Name); - if (actionEvent != null) - { - if (actionEvent.Sound != null) - savedActionEvent.Sound = savedActionEvent.Sound; - else - actionEvent.RandomSequenceContainer = savedActionEvent.RandomSequenceContainer; - } - else - soundBank.ActionEvents.Add(savedActionEvent); - } - } - } - else - AudioProject.SoundBanks.Add(savedSoundBank); - } - } - - if (savedProject.StateGroups != null) - { - foreach (var savedStateGroup in savedProject.StateGroups) - { - var stateGroup = AudioProject.StateGroups.FirstOrDefault(stateGroup => stateGroup.Name == savedStateGroup.Name); - if (stateGroup != null) - { - if (savedStateGroup.States != null && savedStateGroup.States.Count != 0) - stateGroup.States = savedStateGroup.States; - } - else - AudioProject.StateGroups.Add(savedStateGroup); - } - } - } - - private void SaveCompiledAudioProjectToPack(AudioProject audioProject) - { - var options = new JsonSerializerOptions - { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - WriteIndented = true - }; - var audioProjectJson = JsonSerializer.Serialize(audioProject, options); - var audioProjectFileName = $"{AudioProjectFileName}_compiled.json"; - var audioProjectFilePath = $"{AudioProjectDirectory}\\{audioProjectFileName}"; - var packFile = PackFile.CreateFromASCII(audioProjectFileName, audioProjectJson); - _fileSaveService.Save(audioProjectFilePath, packFile.DataSource.ReadData(), true); - } - - public void ResetAudioProject() - { - AudioProject = new AudioProject(); - } - - public TreeNode GetSelectedExplorerNode() - { - return AudioProjectExplorerViewModel._selectedAudioProjectTreeNode; - } - - public ObservableCollection> GetEditorDataGrid() - { - return AudioProjectEditorViewModel.AudioProjectEditorDataGrid; - } - - public ObservableCollection> GetViewerDataGrid() - { - return AudioProjectViewerViewModel.AudioProjectViewerDataGrid; - } - - public ObservableCollection> GetSelectedViewerRows() - { - return AudioProjectViewerViewModel.SelectedDataGridRows; - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioEditorView.xaml.cs b/Editors/Audio/AudioEditor/AudioEditorView.xaml.cs deleted file mode 100644 index fae94b14b..000000000 --- a/Editors/Audio/AudioEditor/AudioEditorView.xaml.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Windows.Controls; -using System.Windows.Input; - -namespace Editors.Audio.AudioEditor -{ - public partial class AudioEditorView : UserControl - { - public AudioEditorViewModel ViewModel => DataContext as AudioEditorViewModel; - - public AudioEditorView() - { - InitializeComponent(); - PreviewKeyDown += AudioProjectViewerView_PreviewKeyDown; - - } - - private void AudioProjectViewerView_PreviewKeyDown(object sender, KeyEventArgs e) - { - if (Keyboard.Modifiers == ModifierKeys.Control) - { - if (e.Key == Key.C) - { - ViewModel?.AudioProjectViewerViewModel.CopyRows(); - e.Handled = true; - } - else if (e.Key == Key.V) - { - ViewModel?.AudioProjectViewerViewModel.PasteRows(); - e.Handled = true; - } - } - - if (e.Key == Key.Delete) - { - ViewModel?.AudioProjectViewerViewModel.RemoveAudioProjectViewerDataGridRow(); - e.Handled = true; - } - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioEditorViewModel.cs b/Editors/Audio/AudioEditor/AudioEditorViewModel.cs deleted file mode 100644 index 903048d06..000000000 --- a/Editors/Audio/AudioEditor/AudioEditorViewModel.cs +++ /dev/null @@ -1,113 +0,0 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; -using Editors.Audio.AudioEditor.AudioFilesExplorer; -using Editors.Audio.AudioEditor.AudioProjectEditor; -using Editors.Audio.AudioEditor.AudioProjectExplorer; -using Editors.Audio.AudioEditor.AudioProjectViewer; -using Editors.Audio.AudioEditor.AudioSettings; -using Editors.Audio.AudioEditor.NewAudioProject; -using Shared.Core.PackFiles; -using Shared.Core.Services; -using Shared.Core.ToolCreation; -using static Editors.Audio.GameSettings.Warhammer3.DialogueEvents; - -namespace Editors.Audio.AudioEditor -{ - public partial class AudioEditorViewModel : ObservableObject, IEditorInterface - { - public AudioProjectExplorerViewModel AudioProjectExplorerViewModel { get; } - public AudioFilesExplorerViewModel AudioFilesExplorerViewModel { get; } - public AudioProjectEditorViewModel AudioProjectEditorViewModel { get; } - public AudioProjectViewerViewModel AudioProjectViewerViewModel { get; } - public AudioSettingsViewModel AudioSettingsViewModel { get; } - - private readonly IPackFileService _packFileService; - private readonly IStandardDialogs _standardDialogs; - private readonly IAudioEditorService _audioEditorService; - private readonly IntegrityChecker _integrityChecker; - - public string DisplayName { get; set; } = "Audio Editor"; - - public AudioEditorViewModel( - AudioProjectExplorerViewModel audioProjectExplorerViewModel, - AudioFilesExplorerViewModel audioFilesExplorerViewModel, - AudioProjectEditorViewModel audioProjectEditorViewModel, - AudioProjectViewerViewModel audioProjectViewerViewModel, - AudioSettingsViewModel audioSettingsViewModel, - IPackFileService packFileService, - IStandardDialogs standardDialogs, - IAudioEditorService audioEditorService, - IntegrityChecker integrityChecker) - { - _packFileService = packFileService; - _standardDialogs = standardDialogs; - _audioEditorService = audioEditorService; - _integrityChecker = integrityChecker; - - AudioProjectExplorerViewModel = audioProjectExplorerViewModel; - AudioFilesExplorerViewModel = audioFilesExplorerViewModel; - AudioProjectEditorViewModel = audioProjectEditorViewModel; - AudioProjectViewerViewModel = audioProjectViewerViewModel; - AudioSettingsViewModel = audioSettingsViewModel; - - InitialiseAudioEditorData(); - - InitialiseAudioEditorService(); - - _integrityChecker.CheckDialogueEventIntegrity(DialogueEventData); - } - - [RelayCommand] public void NewAudioProject() - { - NewAudioProjectWindow.Show(_packFileService, _audioEditorService, _standardDialogs); - } - - [RelayCommand] public void SaveAudioProject() - { - _audioEditorService.SaveAudioProject(); - } - - [RelayCommand] public void LoadAudioProject() - { - _audioEditorService.LoadAudioProject(this); - } - - [RelayCommand] public void CompileAudioProject() - { - _audioEditorService.CompileAudioProject(); - } - - public void InitialiseAudioEditorData() - { - AudioProjectEditorViewModel.AudioProjectEditorDataGrid = []; - AudioProjectViewerViewModel.AudioProjectViewerDataGrid = []; - AudioProjectViewerViewModel.SelectedDataGridRows = []; - AudioProjectViewerViewModel.CopiedDataGridRows = []; - AudioProjectExplorerViewModel.DialogueEventPresets = []; - } - private void InitialiseAudioEditorService() - { - _audioEditorService.AudioEditorViewModel = this; - _audioEditorService.AudioProjectExplorerViewModel = AudioProjectExplorerViewModel; - _audioEditorService.AudioFilesExplorerViewModel = AudioFilesExplorerViewModel; - _audioEditorService.AudioProjectEditorViewModel = AudioProjectEditorViewModel; - _audioEditorService.AudioProjectViewerViewModel = AudioProjectViewerViewModel; - _audioEditorService.AudioSettingsViewModel = AudioSettingsViewModel; - } - public void ResetAudioEditorData() - { - AudioProjectEditorViewModel.AudioProjectEditorDataGrid = null; - AudioProjectViewerViewModel.AudioProjectViewerDataGrid = null; - AudioProjectViewerViewModel.SelectedDataGridRows = null; - AudioProjectViewerViewModel.CopiedDataGridRows = null; - AudioProjectExplorerViewModel._selectedAudioProjectTreeNode = null; - AudioProjectExplorerViewModel.AudioProjectTree.Clear(); - } - - public void Close() - { - ResetAudioEditorData(); - _audioEditorService.ResetAudioProject(); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioFilesExplorer/AudioFilesExplorerView.xaml.cs b/Editors/Audio/AudioEditor/AudioFilesExplorer/AudioFilesExplorerView.xaml.cs deleted file mode 100644 index c772317a2..000000000 --- a/Editors/Audio/AudioEditor/AudioFilesExplorer/AudioFilesExplorerView.xaml.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Windows; -using System.Windows.Controls; - -namespace Editors.Audio.AudioEditor.AudioFilesExplorer -{ - public partial class AudioFilesExplorerView : UserControl - { - public AudioFilesExplorerView() - { - InitializeComponent(); - } - - private void ClearButtonClick(object sender, RoutedEventArgs e) - { - FilterTextBoxItem.Focus(); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioFilesExplorer/AudioFilesExplorerViewModel.cs b/Editors/Audio/AudioEditor/AudioFilesExplorer/AudioFilesExplorerViewModel.cs deleted file mode 100644 index 59e336ebc..000000000 --- a/Editors/Audio/AudioEditor/AudioFilesExplorer/AudioFilesExplorerViewModel.cs +++ /dev/null @@ -1,308 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.Linq; -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; -using Editors.Audio.AudioEditor.AudioSettings; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.AudioEditor.Events; -using Editors.Audio.Utility; -using Shared.Core.Events; -using Shared.Core.Misc; -using Shared.Core.PackFiles; -using Shared.Core.PackFiles.Models; -using Shared.Core.ToolCreation; - -namespace Editors.Audio.AudioEditor.AudioFilesExplorer -{ - public partial class AudioFilesExplorerViewModel : ObservableObject, IEditorInterface - { - private readonly IEventHub _eventHub; - private readonly IPackFileService _packFileService; - private readonly IAudioEditorService _audioEditorService; - private readonly SoundPlayer _soundPlayer; - - public string DisplayName { get; set; } = "Audio Files Explorer"; - - [ObservableProperty] private string _audioFilesExplorerLabel; - [ObservableProperty] private bool _isAddAudioFilesButtonEnabled = false; - [ObservableProperty] private bool _isPlayAudioButtonEnabled = false; - [ObservableProperty] private string _searchQuery; - [ObservableProperty] private ObservableCollection _audioFilesTree; - private ObservableCollection _unfilteredTree; - - public ObservableCollection SelectedTreeNodes { get; set; } = new ObservableCollection(); - - public AudioFilesExplorerViewModel(IEventHub eventHub, IPackFileService packFileService, IAudioEditorService audioEditorService, SoundPlayer soundPlayer) - { - _eventHub = eventHub; - _packFileService = packFileService; - _audioEditorService = audioEditorService; - _soundPlayer = soundPlayer; - - SelectedTreeNodes.CollectionChanged += OnSelectedTreeNodesChanged; - - AudioFilesExplorerLabel = $"{DisplayName}"; - - Initialise(); - - _eventHub.Register(this, OnSelectedNodeChanged); - } - - private void Initialise() - { - var editablePack = _packFileService.GetEditablePack(); - - if (editablePack == null) - return; - - AudioFilesExplorerLabel = $"{DisplayName} - {DataGridHelpers.AddExtraUnderscoresToString(editablePack.Name)}"; - - CreateAudioFilesTree(editablePack); - } - - public void OnSelectedNodeChanged(NodeSelectedEvent nodeSelectedEvent) - { - ResetButtonEnablement(); - SetButtonEnablement(); - } - - private void OnSelectedTreeNodesChanged(object sender, NotifyCollectionChangedEventArgs e) - { - if (e.Action == NotifyCollectionChangedAction.Add) - { - foreach (TreeNode addedNode in e.NewItems) - { - if (addedNode.NodeType != NodeType.WavFile) - SelectedTreeNodes.Remove(addedNode); - } - } - - SetButtonEnablement(); - } - - partial void OnSearchQueryChanged(string value) - { - if (string.IsNullOrWhiteSpace(SearchQuery)) - ResetTree(); - else - AudioFilesTree = FilterFileTree(SearchQuery); - } - - private void CreateAudioFilesTree(PackFileContainer editablePack) - { - var wavFilePaths = editablePack.FileList - .Where(x => x.Key.EndsWith(".wav", StringComparison.OrdinalIgnoreCase)) - .Select(x => x.Key.Split('\\')) - .ToList(); - - var uniqueDirectoryPaths = wavFilePaths - .Select(parts => string.Join("\\", parts.Take(parts.Length - 1))) - .Where(path => !string.IsNullOrWhiteSpace(path)) // remove the empty (pack) directory - .ToHashSet(); - - var nodeDictionary = new Dictionary(); - var rootNodes = new ObservableCollection(); - - foreach (var directoryPath in uniqueDirectoryPaths) - AddDirectoryToTree(rootNodes, directoryPath, nodeDictionary); - - foreach (var filePathParts in wavFilePaths) - AddFileToTree(filePathParts, nodeDictionary, rootNodes); - - AudioFilesTree = rootNodes; - _unfilteredTree = new ObservableCollection(AudioFilesTree); - } - - private static void AddDirectoryToTree(ObservableCollection rootNodes, string directoryPath, Dictionary nodeDictionary) - { - var currentPath = string.Empty; - TreeNode currentNode = null; - - foreach (var directory in directoryPath.Split('\\')) - { - if (string.IsNullOrEmpty(currentPath)) - currentPath = directory; - else - currentPath = $"{currentPath}\\{directory}"; - - if (!nodeDictionary.TryGetValue(currentPath, out var directoryNode)) - { - directoryNode = new TreeNode - { - Name = directory, - NodeType = NodeType.Directory, - FilePath = currentPath, - Children = new ObservableCollection() - }; - - if (currentNode == null) - rootNodes.Add(directoryNode); - else - currentNode.Children.Add(directoryNode); - - nodeDictionary[currentPath] = directoryNode; - } - - currentNode = directoryNode; - } - } - - private static void AddFileToTree(string[] filePathParts, Dictionary nodeDictionary, ObservableCollection rootNodes) - { - if (filePathParts.Length == 1) - { - var fileNode = new TreeNode - { - Name = filePathParts[0], - NodeType = NodeType.WavFile, - FilePath = filePathParts[0] - }; - rootNodes.Add(fileNode); - nodeDictionary[filePathParts[0]] = fileNode; - return; - } - - var directoryPath = string.Join("\\", filePathParts.Take(filePathParts.Length - 1)); - if (nodeDictionary.TryGetValue(directoryPath, out var directoryNode)) - { - var fileNode = new TreeNode - { - Name = filePathParts[^1], - NodeType = NodeType.WavFile, - FilePath = string.Join("\\", filePathParts) - }; - directoryNode.Children.Add(fileNode); - nodeDictionary[fileNode.FilePath] = fileNode; - } - } - - private void ResetTree() - { - AudioFilesTree = new ObservableCollection(_unfilteredTree); - } - - private ObservableCollection FilterFileTree(string query) - { - var filteredTree = new ObservableCollection(); - - foreach (var treeNode in _unfilteredTree) - { - var filteredNode = FilterTreeNode(treeNode, query); - if (filteredNode != null) - filteredTree.Add(filteredNode); - } - - return filteredTree; - } - - private static TreeNode FilterTreeNode(TreeNode node, string query) - { - var matchesQuery = node.Name.Contains(query, StringComparison.OrdinalIgnoreCase); - var filteredChildren = node.Children - .Select(child => FilterTreeNode(child, query)) - .Where(child => child != null) - .ToList(); - - if (matchesQuery || filteredChildren.Count != 0) - { - var filteredNode = new TreeNode - { - Name = node.Name, - NodeType = node.NodeType, - Parent = node.Parent, - Children = new ObservableCollection(filteredChildren), - IsNodeExpanded = true - }; - return filteredNode; - } - - return null; - } - - [RelayCommand] public void CollapseOrExpandAudioFilesTree() - { - if (AudioFilesTree == null || AudioFilesTree.Count == 0) - return; - - var isExpanded = AudioFilesTree.Any(node => node.IsNodeExpanded); - - foreach (var rootNode in AudioFilesTree) - ToggleNodeExpansion(rootNode, !isExpanded); - } - - private static void ToggleNodeExpansion(TreeNode node, bool shouldExpand) - { - node.IsNodeExpanded = shouldExpand; - - foreach (var child in node.Children) - ToggleNodeExpansion(child, shouldExpand); - } - - [RelayCommand] public void AddAudioFilesToAudioProjectEditor() - { - _audioEditorService.AudioSettingsViewModel.AudioFiles.Clear(); - - foreach (var wavFile in SelectedTreeNodes) - { - _audioEditorService.AudioEditorViewModel.AudioSettingsViewModel.AudioFiles.Add(new AudioFile - { - FileName = wavFile.Name, - FilePath = wavFile.FilePath - }); - } - - _audioEditorService.AudioSettingsViewModel.SetAudioSettingsEnablementAndVisibility(); - _audioEditorService.AudioSettingsViewModel.ResetShowSettingsFromAudioProjectViewer(); - _audioEditorService.AudioProjectEditorViewModel.SetAddRowButtonEnablement(); - } - - [RelayCommand] public void PlayWavFile() - { - if (!IsPlayAudioButtonEnabled) - return; - - var wavFileNode = SelectedTreeNodes[0]; - var wavFile = _packFileService.FindFile(wavFileNode.FilePath); - var wavFileName = $"{wavFileNode.Name}"; - - _soundPlayer.ExportFileToAEFolder(wavFileName, wavFile.DataSource.ReadData()); - - var audioFolderName = $"{DirectoryHelper.Temp}\\Audio"; - var wavFilePath = $"{audioFolderName}\\{wavFileName}"; - - _soundPlayer.PlayWav(wavFilePath); - } - - [RelayCommand] public void ClearText() - { - SearchQuery = ""; - } - - public void SetButtonEnablement() - { - IsPlayAudioButtonEnabled = SelectedTreeNodes.Count == 1; - - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode == null) - return; - - if (SelectedTreeNodes.Count > 0) - { - if (selectedNode.NodeType == AudioProjectExplorer.NodeType.ActionEventSoundBank || selectedNode.NodeType == AudioProjectExplorer.NodeType.DialogueEvent) - IsAddAudioFilesButtonEnabled = true; - } - else - IsAddAudioFilesButtonEnabled = false; - } - - public void ResetButtonEnablement() - { - IsAddAudioFilesButtonEnabled = false; - } - - public void Close() {} - } -} diff --git a/Editors/Audio/AudioEditor/AudioFilesExplorer/MultiSelectTreeView.cs b/Editors/Audio/AudioEditor/AudioFilesExplorer/MultiSelectTreeView.cs deleted file mode 100644 index 2c582ca7b..000000000 --- a/Editors/Audio/AudioEditor/AudioFilesExplorer/MultiSelectTreeView.cs +++ /dev/null @@ -1,187 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Linq; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Media; - -namespace Editors.Audio.AudioEditor.AudioFilesExplorer -{ - public class MultiSelectTreeView : TreeView - { - public static readonly DependencyProperty SelectedItemsProperty = DependencyProperty.Register("SelectedItems", typeof(IList), typeof(MultiSelectTreeView), new PropertyMetadata(new ArrayList(), OnSelectedItemsChanged)); - public static readonly DependencyProperty IsMultiSelectedProperty = DependencyProperty.RegisterAttached("IsMultiSelected", typeof(bool), typeof(MultiSelectTreeView), new PropertyMetadata(false)); - - private TreeNode _anchorItem; - - public IList SelectedItems - { - get { return (IList)GetValue(SelectedItemsProperty); } - set { SetValue(SelectedItemsProperty, value); } - } - - public MultiSelectTreeView() - { - if (SelectedItems is INotifyCollectionChanged collection) - collection.CollectionChanged += OnSelectedItemsCollectionChanged; - - PreviewMouseDown += MultiSelectTreeView_PreviewMouseDown; - } - - private static void OnSelectedItemsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (d is MultiSelectTreeView treeView) - treeView.UpdateSelectionStates(); - } - - private void OnSelectedItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) - { - UpdateSelectionStates(); - } - - public static bool GetIsMultiSelected(DependencyObject obj) - { - return (bool)obj.GetValue(IsMultiSelectedProperty); - } - - public static void SetIsMultiSelected(DependencyObject obj, bool value) - { - obj.SetValue(IsMultiSelectedProperty, value); - } - - private void MultiSelectTreeView_PreviewMouseDown(object sender, MouseButtonEventArgs e) - { - if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) - { - var clickedItem = GetTreeViewItemUnderMouse(e); - if (clickedItem?.DataContext is TreeNode clickedNode) - { - if (SelectedItems.Contains(clickedNode)) - { - SelectedItems.Remove(clickedNode); - - if (_anchorItem == clickedNode) - { - _anchorItem = null; - clickedItem.IsSelected = false; - } - } - else - { - SelectedItems.Add(clickedNode); - _anchorItem ??= clickedNode; - } - - UpdateSelectionStates(); - e.Handled = true; - } - } - } - - protected override void OnSelectedItemChanged(RoutedPropertyChangedEventArgs e) - { - base.OnSelectedItemChanged(e); - - if (e.NewValue is TreeNode currentSelectedItem) - { - SelectedItems ??= new ArrayList(); - - if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) - { - if (_anchorItem == null) - { - _anchorItem = currentSelectedItem; - SelectedItems.Clear(); - SelectedItems.Add(_anchorItem); - } - else - SelectRangeFromAnchor(_anchorItem, currentSelectedItem); - } - else if (!Keyboard.IsKeyDown(Key.LeftCtrl) && !Keyboard.IsKeyDown(Key.RightCtrl)) - { - SelectedItems.Clear(); - SelectedItems.Add(currentSelectedItem); - _anchorItem = currentSelectedItem; - } - - UpdateSelectionStates(); - } - } - - private void SelectRangeFromAnchor(TreeNode anchor, TreeNode target) - { - var items = GetTreeViewItems(this).Where(item => item.DataContext is TreeNode).ToList(); - var anchorIndex = items.FindIndex(item => item.DataContext == anchor); - var targetIndex = items.FindIndex(item => item.DataContext == target); - - if (anchorIndex == -1 || targetIndex == -1) - return; - - var startIndex = Math.Min(anchorIndex, targetIndex); - var endIndex = Math.Max(anchorIndex, targetIndex); - - for (var i = 0; i < items.Count; i++) - { - var node = (TreeNode)items[i].DataContext; - - if (i < startIndex || i > endIndex) - SelectedItems.Remove(node); - else if (!SelectedItems.Contains(node)) - SelectedItems.Add(node); - } - } - - private void UpdateSelectionStates() - { - foreach (var item in GetTreeViewItems(this)) - { - if (item.DataContext is TreeNode node) - { - var isSelected = SelectedItems.Contains(node); - SetIsMultiSelected(item, isSelected); - - if (isSelected) - { - item.Background = (Brush)Application.Current.Resources["TreeViewItem.Selected.Background"]; - item.BorderBrush = (Brush)Application.Current.Resources["TreeViewItem.Selected.Border"]; - item.Foreground = (Brush)Application.Current.Resources["ABrush.Foreground.Deeper"]; - } - else - { - item.ClearValue(BackgroundProperty); - item.ClearValue(BorderBrushProperty); - item.ClearValue(ForegroundProperty); - } - } - } - } - - private TreeViewItem GetTreeViewItemUnderMouse(MouseButtonEventArgs e) - { - var clickedPoint = e.GetPosition(this); - var hitTestResult = VisualTreeHelper.HitTest(this, clickedPoint); - var current = hitTestResult?.VisualHit; - while (current != null && current is not TreeViewItem) - current = VisualTreeHelper.GetParent(current); - return current as TreeViewItem; - } - - private static IEnumerable GetTreeViewItems(ItemsControl parent) - { - for (var i = 0; i < parent.Items.Count; i++) - { - var item = (TreeViewItem)parent.ItemContainerGenerator.ContainerFromIndex(i); - if (item != null) - { - yield return item; - - foreach (var childItem in GetTreeViewItems(item)) - yield return childItem; - } - } - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioFilesExplorer/TreeNode.cs b/Editors/Audio/AudioEditor/AudioFilesExplorer/TreeNode.cs deleted file mode 100644 index 8451b8ea5..000000000 --- a/Editors/Audio/AudioEditor/AudioFilesExplorer/TreeNode.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections.ObjectModel; -using CommunityToolkit.Mvvm.ComponentModel; - -namespace Editors.Audio.AudioEditor.AudioFilesExplorer -{ - public enum NodeType - { - Directory, - WavFile - } - - public partial class TreeNode : ObservableObject - { - public string Name { get; set; } - public NodeType NodeType { get; set; } - public TreeNode Parent { get; set; } - public string FilePath { get; set; } - - [ObservableProperty] bool _isNodeExpanded = false; - [ObservableProperty] ObservableCollection _children = []; - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectData/ActionEventDataService.cs b/Editors/Audio/AudioEditor/AudioProjectData/ActionEventDataService.cs deleted file mode 100644 index 893b270b7..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectData/ActionEventDataService.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Linq; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.Storage; - -namespace Editors.Audio.AudioEditor.AudioProjectData -{ - public class ActionEventDataService : IAudioProjectDataService - { - private readonly IAudioEditorService _audioEditorService; - private readonly IAudioRepository _audioRepository; - - public ActionEventDataService(IAudioEditorService audioEditorService, IAudioRepository audioRepository) - { - _audioEditorService = audioEditorService; - _audioRepository = audioRepository; - } - - public void AddToAudioProject() - { - var audioProjectEditorRow = DataGridHelpers.GetAudioProjectEditorDataGridRow(_audioEditorService); - var actionEvent = AudioProjectHelpers.CreateActionEventFromDataGridRow(_audioEditorService.AudioSettingsViewModel, audioProjectEditorRow); - var soundBank = AudioProjectHelpers.GetSoundBankFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - AudioProjectHelpers.InsertActionEventAlphabetically(soundBank, actionEvent); - } - - public void RemoveFromAudioProject() - { - var soundBank = AudioProjectHelpers.GetSoundBankFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - var dataGridRowsCopy = _audioEditorService.GetSelectedViewerRows().ToList(); // Create a copy to prevent an error where dataGridRows is modified while being iterated over - foreach (var dataGridRow in dataGridRowsCopy) - { - var actionEvent = AudioProjectHelpers.GetActionEventFromDataGridRow(dataGridRow, soundBank); - soundBank.ActionEvents.Remove(actionEvent); - _audioEditorService.GetViewerDataGrid().Remove(dataGridRow); - } - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectData/AudioProject.cs b/Editors/Audio/AudioEditor/AudioProjectData/AudioProject.cs deleted file mode 100644 index 073ef7fec..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectData/AudioProject.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System.Collections.Generic; -using Shared.GameFormats.Wwise.Enums; -using static Editors.Audio.AudioEditor.AudioSettings.AudioSettings; -using static Editors.Audio.GameSettings.Warhammer3.SoundBanks; - -namespace Editors.Audio.AudioEditor.AudioProjectData -{ - public class AudioProject - { - public string Language { get; set; } - public List SoundBanks { get; set; } - public List StateGroups { get; set; } - } - - public abstract class AudioProjectItem - { - public string Name { get; set; } - public uint ID { get; set; } - } - - public abstract class AudioProjectHircItem : AudioProjectItem - { - public abstract AkBkHircType HircType { get; set; } - } - - public partial class SoundBank : AudioProjectItem - { - public Wh3SoundBankType SoundBankType { get; set; } - public Wh3SoundBankSubtype SoundBankSubtype { get; set; } - public List ActionEvents { get; set; } - public List DialogueEvents { get; set; } - public string Language { get; set; } - public string SoundBankFileName { get; set; } - public string SoundBankFilePath { get; set; } - } - - public class ActionEvent : AudioProjectHircItem - { - public override AkBkHircType HircType { get; set; } = AkBkHircType.Event; - - // Technically we should make each action contain the SoundContainer / Sound but making multiple actions for an event isn't supported as the user probably doesn't need to. - public List Actions { get; set; } - public RandomSequenceContainer RandomSequenceContainer { get; set; } - public Sound Sound { get; set; } - } - - public class Action : AudioProjectHircItem - { - public override AkBkHircType HircType { get; set; } = AkBkHircType.Action; - public AkActionType ActionType { get; set; } = AkActionType.Play; - public uint IDExt { get; set; } - } - - public class DialogueEvent : AudioProjectHircItem - { - public override AkBkHircType HircType { get; set; } = AkBkHircType.Dialogue_Event; - public List StatePaths { get; set; } - } - - public class StateGroup : AudioProjectItem - { - public List States { get; set; } - } - - public class State : AudioProjectItem { } - - public class StatePath - { - public List Nodes { get; set; } = []; - public RandomSequenceContainer RandomSequenceContainer { get; set; } - public Sound Sound { get; set; } - } - - public class StatePathNode - { - public StateGroup StateGroup { get; set; } - public State State { get; set; } - } - - public class RandomSequenceContainer : AudioProjectHircItem - { - public override AkBkHircType HircType { get; set; } = AkBkHircType.RandomSequenceContainer; - public uint OverrideBusID { get; set; } - public uint DirectParentID { get; set; } - public RanSeqContainerSettings AudioSettings { get; set; } - public List Sounds { get; set; } - public string Language { get; set; } - } - - public class Sound : AudioProjectHircItem - { - public override AkBkHircType HircType { get; set; } = AkBkHircType.Sound; - public uint OverrideBusID { get; set; } - public uint DirectParentID { get; set; } - public uint SourceID { get; set; } - public string WavFileName { get; set; } - public string WavFilePath { get; set; } - public string WemFileName { get; set; } - public string WemFilePath { get; set; } - public string WemDiskFilePath { get; set; } - public long InMemoryMediaSize { get; set; } - public string Language { get; set; } - public SoundSettings AudioSettings { get; set; } - } - - public interface IAudioSettings { } - - public class RanSeqContainerSettings : IAudioSettings - { - public PlaylistType PlaylistType { get; set; } - public bool EnableRepetitionInterval { get; set; } - public uint RepetitionInterval { get; set; } - public EndBehaviour EndBehaviour { get; set; } - public bool AlwaysResetPlaylist { get; set; } - public PlaylistMode PlaylistMode { get; set; } - public LoopingType LoopingType { get; set; } - public uint NumberOfLoops { get; set; } - public TransitionType TransitionType { get; set; } - public decimal TransitionDuration { get; set; } - } - - public class SoundSettings : IAudioSettings - { - public LoopingType LoopingType { get; set; } - public uint NumberOfLoops { get; set; } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectData/AudioProjectDataServiceFactory.cs b/Editors/Audio/AudioEditor/AudioProjectData/AudioProjectDataServiceFactory.cs deleted file mode 100644 index 30863ebad..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectData/AudioProjectDataServiceFactory.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Editors.Audio.AudioEditor.AudioProjectExplorer; -using Editors.Audio.Storage; - -namespace Editors.Audio.AudioEditor.AudioProjectData -{ - public class AudioProjectDataServiceFactory - { - private readonly IAudioEditorService _audioEditorService; - private readonly IAudioRepository _audioRepository; - - public AudioProjectDataServiceFactory(IAudioEditorService audioEditorService, IAudioRepository audioRepositry) - { - _audioEditorService = audioEditorService; - _audioRepository = audioRepositry; - } - - public IAudioProjectDataService GetService(NodeType nodeType) - { - return nodeType switch - { - NodeType.ActionEventSoundBank => new ActionEventDataService(_audioEditorService, _audioRepository), - NodeType.DialogueEvent => new DialogueEventDataService(_audioEditorService, _audioRepository), - NodeType.StateGroup => new StateGroupDataService(_audioEditorService, _audioRepository), - _ => throw new System.NotImplementedException($"No service defined for node type {nodeType}") - }; - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectData/AudioProjectHelpers.cs b/Editors/Audio/AudioEditor/AudioProjectData/AudioProjectHelpers.cs deleted file mode 100644 index 30c0c9665..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectData/AudioProjectHelpers.cs +++ /dev/null @@ -1,346 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Editors.Audio.AudioEditor.AudioSettings; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.GameSettings.Warhammer3; -using Editors.Audio.Storage; -using static Editors.Audio.AudioEditor.AudioSettings.AudioSettings; - -namespace Editors.Audio.AudioEditor.AudioProjectData -{ - public class AudioProjectHelpers - { - public static SoundBank GetSoundBankFromName(IAudioEditorService audioEditorService, string soundBankName) - { - return audioEditorService.AudioProject.SoundBanks - .FirstOrDefault(soundBank => soundBank.Name == soundBankName); - } - - public static DialogueEvent GetDialogueEventFromName(IAudioEditorService audioEditorService, string dialogueEventName) - { - return audioEditorService.AudioProject.SoundBanks - .Where(soundBank => soundBank.SoundBankType == SoundBanks.Wh3SoundBankType.DialogueEventSoundBank) - .SelectMany(soundBank => soundBank.DialogueEvents) - .FirstOrDefault(dialogueEvent => dialogueEvent.Name == dialogueEventName); - } - - public static StateGroup GetStateGroupFromName(IAudioEditorService audioEditorService, string stateGroupName) - { - return audioEditorService.AudioProject.StateGroups - .FirstOrDefault(stateGroup => stateGroup.Name == stateGroupName); - } - - public static ActionEvent GetActionEventFromDataGridRow(Dictionary dataGridRow, SoundBank actionEventSoundBank) - { - var eventName = GetActionEventName(dataGridRow); - - foreach (var actionEvent in actionEventSoundBank.ActionEvents) - { - if (actionEvent.Name == eventName) - return actionEvent; - } - - return null; - } - - public static string GetActionEventName(Dictionary dataGridRow) - { - if (dataGridRow.TryGetValue(DataGridConfiguration.EventNameColumn, out var eventName)) - return eventName.ToString(); - else - return string.Empty; - } - - public static ActionEvent CreateActionEventFromDataGridRow(AudioSettingsViewModel audioSettingsViewModel, Dictionary dataGridRow) - { - var actionEvent = new ActionEvent(); - - actionEvent.Name = GetActionEventName(dataGridRow); - - var audioFiles = audioSettingsViewModel.AudioFiles; - if (audioFiles.Count == 1) - actionEvent.Sound = CreateSound(audioSettingsViewModel, audioFiles[0], isInContainer: false); - else - { - actionEvent.RandomSequenceContainer = new RandomSequenceContainer - { - Sounds = [], - AudioSettings = BuildRanSeqContainerSettings(audioSettingsViewModel) - }; - - foreach (var audioFile in audioFiles) - { - var sound = CreateSound(audioSettingsViewModel, audioFile); - actionEvent.RandomSequenceContainer.Sounds.Add(sound); - } - } - - return actionEvent; - } - - public static StatePath GetStatePathFromDataGridRow(IAudioRepository audioRepository, Dictionary dataGridRow, DialogueEvent selectedDialogueEvent) - { - var dataGridRowStatePathNodes = GetStatePathNodes(audioRepository, dataGridRow, selectedDialogueEvent); - - foreach (var statePath in selectedDialogueEvent.StatePaths) - { - if (statePath.Nodes.SequenceEqual(dataGridRowStatePathNodes, new StatePathNodeComparer())) - return statePath; - } - - return null; - } - - public static List GetStatePathNodes(IAudioRepository audioRepository, Dictionary dataGridRow, DialogueEvent selectedDialogueEvent) - { - var statePath = new StatePath(); - foreach (var kvp in dataGridRow) - { - var columnName = DataGridHelpers.RemoveExtraUnderscoresFromString(kvp.Key); - var columnValue = kvp.Value; - statePath.Nodes.Add(new StatePathNode - { - StateGroup = new StateGroup { Name = audioRepository.GetStateGroupFromStateGroupWithQualifier(selectedDialogueEvent.Name, columnName) }, - State = new State { Name = columnValue } - }); - } - - return statePath.Nodes; - } - - public static StatePath CreateStatePathFromDataGridRow(IAudioRepository audioRepository, AudioSettingsViewModel audioSettingsViewModel, Dictionary dataGridRow, DialogueEvent selectedDialogueEvent) - { - var statePath = new StatePath(); - foreach (var kvp in dataGridRow) - { - var columnName = DataGridHelpers.RemoveExtraUnderscoresFromString(kvp.Key); - var columnValue = kvp.Value; - statePath.Nodes.Add(new StatePathNode - { - StateGroup = new StateGroup { Name = audioRepository.GetStateGroupFromStateGroupWithQualifier(selectedDialogueEvent.Name, columnName) }, - State = new State { Name = columnValue } - }); - - var audioFiles = audioSettingsViewModel.AudioFiles; - if (audioFiles.Count == 1) - statePath.Sound = CreateSound(audioSettingsViewModel, audioFiles[0], isInContainer: false); - else - { - statePath.RandomSequenceContainer = new RandomSequenceContainer - { - Sounds = [], - AudioSettings = BuildRanSeqContainerSettings(audioSettingsViewModel) - }; - - foreach (var audioFile in audioFiles) - { - var sound = CreateSound(audioSettingsViewModel, audioFile); - statePath.RandomSequenceContainer.Sounds.Add(sound); - } - } - } - - return statePath; - } - - public class StatePathNodeComparer : IEqualityComparer - { - public bool Equals(StatePathNode x, StatePathNode y) - { - if (x == null && y == null) - return true; - if (x == null || y == null) - return false; - - return string.Equals(x.StateGroup?.Name, y.StateGroup?.Name, StringComparison.Ordinal) && - string.Equals(x.State?.Name, y.State?.Name, StringComparison.Ordinal); - } - - public int GetHashCode(StatePathNode obj) - { - return HashCode.Combine(obj.StateGroup?.Name, obj.State?.Name); - } - } - - private static Sound CreateSound(AudioSettingsViewModel audioSettingsViewModel, AudioFile audioFile, bool isInContainer = true) - { - var sound = new Sound() - { - WavFileName = audioFile.FileName, - WavFilePath = audioFile.FilePath, - }; - - if (!isInContainer) - sound.AudioSettings = BuildSoundSettings(audioSettingsViewModel); - - return sound; - } - - public static State GetStateFromDataGridRow(Dictionary dataGridRow, StateGroup moddedStateGroup) - { - var dataGridRowState = CreateStateFromDataGridRow(dataGridRow); - - foreach (var state in moddedStateGroup.States) - { - if (state.Name == dataGridRowState.Name) - return state; - } - - return null; - } - - public static State CreateStateFromDataGridRow(Dictionary dataGridRow) - { - var state = new State(); - state.Name = dataGridRow.First().Value.ToString(); - return state; - } - - public static IAudioSettings GetAudioSettingsFromAudioProjectViewerActionEvent(IAudioEditorService audioEditorService) - { - var selectedNode = audioEditorService.GetSelectedExplorerNode(); - var selectedAudioProjectViewerDataGridRow = audioEditorService.GetSelectedViewerRows()[0]; - var soundBank = GetSoundBankFromName(audioEditorService, selectedNode.Name); - var actionEvent = GetActionEventFromDataGridRow(selectedAudioProjectViewerDataGridRow, soundBank); - - if (actionEvent.RandomSequenceContainer != null) - return actionEvent.RandomSequenceContainer.AudioSettings; - else - return actionEvent.Sound.AudioSettings; - } - - public static IAudioSettings GetAudioSettingsFromAudioProjectViewerStatePath(AudioEditorViewModel audioEditorViewModel, IAudioEditorService audioEditorService, IAudioRepository audioRepository) - { - var audioProjectItem = audioEditorViewModel.AudioProjectExplorerViewModel._selectedAudioProjectTreeNode; - var selectedAudioProjectViewerDataGridRow = audioEditorService.GetSelectedViewerRows()[0]; - var dialogueEvent = GetDialogueEventFromName(audioEditorService, audioProjectItem.Name); - var statePath = GetStatePathFromDataGridRow(audioRepository, selectedAudioProjectViewerDataGridRow, dialogueEvent); - - if (statePath.RandomSequenceContainer != null) - return statePath.RandomSequenceContainer.AudioSettings; - else - return statePath.Sound.AudioSettings; - } - - public static void InsertStatePathAlphabetically(DialogueEvent selectedDialogueEvent, StatePath statePath) - { - var newStateName = statePath.Nodes.First().State.Name; - var decisionTree = selectedDialogueEvent.StatePaths; - var insertIndex = 0; - - for (var i = 0; i < decisionTree.Count; i++) - { - var existingStateName = decisionTree[i].Nodes.First().State.Name; - var comparison = string.Compare(newStateName, existingStateName, StringComparison.Ordinal); - if (comparison < 0) - { - insertIndex = i; - break; - } - else if (comparison == 0) - insertIndex = i + 1; - else - insertIndex = i + 1; - } - - decisionTree.Insert(insertIndex, statePath); - } - - public static void InsertActionEventAlphabetically(SoundBank selectedSoundBank, ActionEvent newEvent) - { - var events = selectedSoundBank.ActionEvents; - var newEventName = newEvent.Name; - var insertIndex = 0; - - for (var i = 0; i < events.Count; i++) - { - var existingEventName = events[i].Name; - var comparison = string.Compare(newEventName, existingEventName, StringComparison.Ordinal); - if (comparison < 0) - { - insertIndex = i; - break; - } - else if (comparison == 0) - insertIndex = i + 1; - else - insertIndex = i + 1; - } - - events.Insert(insertIndex, newEvent); - } - - public static void InsertStateAlphabetically(StateGroup moddedStateGroup, State newState) - { - var states = moddedStateGroup.States; - var newStateName = newState.Name; - var insertIndex = 0; - - for (var i = 0; i < states.Count; i++) - { - var existingStateName = states[i].Name; - var comparison = string.Compare(newStateName, existingStateName, StringComparison.Ordinal); - - if (comparison < 0) - { - insertIndex = i; - break; - } - else if (comparison == 0) - insertIndex = i + 1; - else - insertIndex = i + 1; - } - - states.Insert(insertIndex, newState); - } - - public static RanSeqContainerSettings BuildRanSeqContainerSettings(AudioSettingsViewModel audioSettingsViewModel) - { - var audioSettings = new RanSeqContainerSettings(); - - if (audioSettingsViewModel.AudioFiles.Count > 1) - { - audioSettings.PlaylistType = audioSettingsViewModel.PlaylistType; - - if (audioSettingsViewModel.PlaylistType == PlaylistType.Sequence) - audioSettings.EndBehaviour = audioSettingsViewModel.EndBehaviour; - else - { - audioSettings.EnableRepetitionInterval = audioSettingsViewModel.EnableRepetitionInterval; - - if (audioSettingsViewModel.EnableRepetitionInterval) - audioSettings.RepetitionInterval = audioSettingsViewModel.RepetitionInterval; - } - - audioSettings.AlwaysResetPlaylist = audioSettingsViewModel.AlwaysResetPlaylist; - - audioSettings.PlaylistMode = audioSettingsViewModel.PlaylistMode; - audioSettings.LoopingType = audioSettingsViewModel.LoopingType; - - if (audioSettingsViewModel.LoopingType == LoopingType.FiniteLooping) - audioSettings.NumberOfLoops = audioSettingsViewModel.NumberOfLoops; - - if (audioSettingsViewModel.TransitionType != TransitionType.Disabled) - { - audioSettings.TransitionType = audioSettingsViewModel.TransitionType; - audioSettings.TransitionDuration = audioSettingsViewModel.TransitionDuration; - } - } - - return audioSettings; - } - - public static SoundSettings BuildSoundSettings(AudioSettingsViewModel audioSettingsViewModel) - { - var audioSettings = new SoundSettings(); - - audioSettings.LoopingType = audioSettingsViewModel.LoopingType; - if (audioSettingsViewModel.LoopingType == LoopingType.FiniteLooping) - audioSettings.NumberOfLoops = audioSettingsViewModel.NumberOfLoops; - - return audioSettings; - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectData/DialogueEventDataService.cs b/Editors/Audio/AudioEditor/AudioProjectData/DialogueEventDataService.cs deleted file mode 100644 index 1c06253c4..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectData/DialogueEventDataService.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Linq; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.Storage; - -namespace Editors.Audio.AudioEditor.AudioProjectData -{ - public class DialogueEventDataService : IAudioProjectDataService - { - private readonly IAudioEditorService _audioEditorService; - private readonly IAudioRepository _audioRepository; - - public DialogueEventDataService(IAudioEditorService audioEditorService, IAudioRepository audioRepository) - { - _audioEditorService = audioEditorService; - _audioRepository = audioRepository; - } - - public void AddToAudioProject() - { - var audioProjectEditorRow = DataGridHelpers.GetAudioProjectEditorDataGridRow(_audioEditorService); - var dialogueEvent = AudioProjectHelpers.GetDialogueEventFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - var statePath = AudioProjectHelpers.CreateStatePathFromDataGridRow(_audioRepository, _audioEditorService.AudioSettingsViewModel, audioProjectEditorRow, dialogueEvent); - AudioProjectHelpers.InsertStatePathAlphabetically(dialogueEvent, statePath); - } - - public void RemoveFromAudioProject() - { - var dialogueEvent = AudioProjectHelpers.GetDialogueEventFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - var dataGridRowsCopy = _audioEditorService.GetSelectedViewerRows().ToList(); // Create a copy to prevent an error where dataGridRows is modified while being iterated over - foreach (var dataGridRow in dataGridRowsCopy) - { - var statePath = AudioProjectHelpers.GetStatePathFromDataGridRow(_audioRepository, dataGridRow, dialogueEvent); - if (statePath != null) - { - dialogueEvent.StatePaths.Remove(statePath); - _audioEditorService.GetViewerDataGrid().Remove(dataGridRow); - } - } - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectData/IAudioProjectDataService.cs b/Editors/Audio/AudioEditor/AudioProjectData/IAudioProjectDataService.cs deleted file mode 100644 index 4b11fa338..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectData/IAudioProjectDataService.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Editors.Audio.AudioEditor.AudioProjectData -{ - public interface IAudioProjectDataService - { - public void AddToAudioProject(); - public void RemoveFromAudioProject(); - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectData/StateGroupDataService.cs b/Editors/Audio/AudioEditor/AudioProjectData/StateGroupDataService.cs deleted file mode 100644 index 07a920ec8..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectData/StateGroupDataService.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Linq; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.Storage; - -namespace Editors.Audio.AudioEditor.AudioProjectData -{ - public class StateGroupDataService : IAudioProjectDataService - { - private readonly IAudioEditorService _audioEditorService; - private readonly IAudioRepository _audioRepository; - - public StateGroupDataService(IAudioEditorService audioEditorService, IAudioRepository audioRepository) - { - _audioEditorService = audioEditorService; - _audioRepository = audioRepository; - } - - public void AddToAudioProject() - { - var audioProjectEditorRow = DataGridHelpers.GetAudioProjectEditorDataGridRow(_audioEditorService); - var state = AudioProjectHelpers.CreateStateFromDataGridRow(audioProjectEditorRow); - var stateGroup = AudioProjectHelpers.GetStateGroupFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - AudioProjectHelpers.InsertStateAlphabetically(stateGroup, state); - } - - public void RemoveFromAudioProject() - { - var stateGroup = AudioProjectHelpers.GetStateGroupFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - var dataGridRowsCopy = _audioEditorService.GetSelectedViewerRows().ToList(); // Create a copy to prevent an error where dataGridRows is modified while being iterated over - foreach (var dataGridRow in dataGridRowsCopy) - { - var state = AudioProjectHelpers.GetStateFromDataGridRow(dataGridRow, stateGroup); - stateGroup.States.Remove(state); - _audioEditorService.GetViewerDataGrid().Remove(dataGridRow); - } - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectEditor/AudioProjectEditorView.xaml.cs b/Editors/Audio/AudioEditor/AudioProjectEditor/AudioProjectEditorView.xaml.cs deleted file mode 100644 index a6585f243..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectEditor/AudioProjectEditorView.xaml.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Editors.Audio.AudioEditor.AudioProjectEditor -{ - public partial class AudioProjectEditorView : UserControl - { - public AudioProjectEditorView() - { - InitializeComponent(); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectEditor/AudioProjectEditorViewModel.cs b/Editors/Audio/AudioEditor/AudioProjectEditor/AudioProjectEditorViewModel.cs deleted file mode 100644 index 17553343d..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectEditor/AudioProjectEditorViewModel.cs +++ /dev/null @@ -1,291 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; -using Editors.Audio.AudioEditor.AudioProjectData; -using Editors.Audio.AudioEditor.AudioProjectEditor.DataGrid; -using Editors.Audio.AudioEditor.AudioProjectExplorer; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.AudioEditor.Events; -using Serilog; -using Shared.Core.ErrorHandling; -using Shared.Core.Events; -using Shared.Core.PackFiles; -using Shared.Core.Services; -using Shared.Core.ToolCreation; - -namespace Editors.Audio.AudioEditor.AudioProjectEditor -{ - public partial class AudioProjectEditorViewModel : ObservableObject, IEditorInterface - { - private readonly IEventHub _eventHub; - private readonly IAudioEditorService _audioEditorService; - private readonly IPackFileService _packFileService; - private readonly IStandardDialogs _standardDialogs; - private readonly AudioProjectEditorDataGridServiceFactory _audioProjectEditorDataGridServiceFactory; - private readonly AudioProjectDataServiceFactory _audioProjectDataServiceFactory; - - private readonly ILogger _logger = Logging.Create(); - - public string DisplayName { get; set; } = "Audio Project Editor"; - - [ObservableProperty] private string _audioProjectEditorLabel; - [ObservableProperty] private string _audioProjectEditorDataGridTag = "AudioProjectEditorDataGrid"; - [ObservableProperty] private ObservableCollection> _audioProjectEditorDataGrid; - [ObservableProperty] private bool _isAddRowButtonEnabled = false; - [ObservableProperty] private bool _showModdedStatesOnly; - [ObservableProperty] private bool _isShowModdedStatesCheckBoxEnabled = false; - [ObservableProperty] private bool _isShowModdedStatesCheckBoxVisible = false; - - public AudioProjectEditorViewModel ( - IEventHub eventHub, - IAudioEditorService audioEditorService, - IPackFileService packFileService, - IStandardDialogs standardDialogs, - AudioProjectEditorDataGridServiceFactory audioProjectEditorDataGridServiceFactory, - AudioProjectDataServiceFactory audioProjectDataServiceFactory) - { - _eventHub = eventHub; - _audioEditorService = audioEditorService; - _packFileService = packFileService; - _standardDialogs = standardDialogs; - _audioProjectEditorDataGridServiceFactory = audioProjectEditorDataGridServiceFactory; - _audioProjectDataServiceFactory = audioProjectDataServiceFactory; - - AudioProjectEditorLabel = $"{DisplayName}"; - - _eventHub.Register(this, OnSelectedNodeChanged); - _eventHub.Register(this, OnItemEdited); - } - - public void OnSelectedNodeChanged(NodeSelectedEvent nodeSelectedEvent) - { - ResetAudioProjectEditorLabel(); - ResetButtonEnablement(); - ResetDataGrid(); - - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType == NodeType.ActionEventSoundBank) - { - SetAudioProjectEditorLabel(selectedNode.Name); - LoadDataGrid(selectedNode.NodeType); - } - else if (selectedNode.NodeType == NodeType.DialogueEvent) - { - SetAudioProjectEditorLabel(DataGridHelpers.AddExtraUnderscoresToString(selectedNode.Name)); - LoadDataGrid(selectedNode.NodeType); - - // Rebuild in case any have been added since the Audio Project was initialised - _audioEditorService.BuildModdedStatesByStateGroupLookup(_audioEditorService.AudioProject.StateGroups, _audioEditorService.ModdedStatesByStateGroupLookup); - - if (_audioEditorService.ModdedStatesByStateGroupLookup.Count > 0) - IsShowModdedStatesCheckBoxEnabled = true; - } - else if (selectedNode.NodeType == NodeType.StateGroup) - { - SetAudioProjectEditorLabel(DataGridHelpers.AddExtraUnderscoresToString(selectedNode.Name)); - LoadDataGrid(selectedNode.NodeType); - } - else - return; - - _logger.Here().Information($"Loaded {selectedNode.NodeType}: {selectedNode.Name}"); - - SetAddRowButtonEnablement(); - SetShowModdedStatesOnlyButtonEnablementAndVisibility(); - } - - private void LoadDataGrid(NodeType selectedNodeType) - { - var dataGridService = _audioProjectEditorDataGridServiceFactory.GetService(selectedNodeType); - dataGridService.LoadDataGrid(); - } - - public void OnItemEdited(ItemEditedEvent itemEditedEvent) - { - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType != NodeType.ActionEventSoundBank && selectedNode.NodeType != NodeType.DialogueEvent && selectedNode.NodeType != NodeType.StateGroup) - return; - - // Clear data grid to ensure there's only one row in the editor - DataGridHelpers.ClearDataGrid(AudioProjectEditorDataGrid); - - var dataGridService = _audioProjectEditorDataGridServiceFactory.GetService(selectedNode.NodeType); - dataGridService.SetDataGridData(); - } - - partial void OnShowModdedStatesOnlyChanged(bool value) - { - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType == NodeType.DialogueEvent) - { - DataGridHelpers.ClearDataGrid(AudioProjectEditorDataGrid); - LoadDataGrid(selectedNode.NodeType); - } - } - - [RelayCommand] public void AddRowFromAudioProjectEditorDataGridToFullDataGrid() - { - if (AudioProjectEditorDataGrid.Count == 0) - return; - - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType != NodeType.ActionEventSoundBank && selectedNode.NodeType != NodeType.DialogueEvent && selectedNode.NodeType != NodeType.StateGroup) - return; - - var dataService = _audioProjectDataServiceFactory.GetService(selectedNode.NodeType); - dataService.AddToAudioProject(); - - _eventHub.Publish(new ItemAddedEvent()); // Publish after the data is added to the AudioProject so it can be loaded when the data grid loading functions are called - - // Clear data grid to ensure there's only one row in the editor - DataGridHelpers.ClearDataGrid(AudioProjectEditorDataGrid); - - // Reset the data grid row - var dataGridService = _audioProjectEditorDataGridServiceFactory.GetService(selectedNode.NodeType); - dataGridService.InitialiseDataGridData(); - - SetAddRowButtonEnablement(); // Handle this last because the row needs to be cleared before being checked - - _logger.Here().Information($"Added {selectedNode.NodeType} item in: {selectedNode.Name}"); - } - - public void SetAddRowButtonEnablement() - { - ResetAddRowButtonEnablement(); - - if (_audioEditorService.GetEditorDataGrid().Count == 0) - return; - - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType != NodeType.StateGroup) - { - if (_audioEditorService.AudioSettingsViewModel.AudioFiles.Count == 0) - return; - } - - var rowExistsCheckResult = CheckIfAudioProjectViewerRowExists(); - if (rowExistsCheckResult) - { - IsAddRowButtonEnabled = false; - return; - } - - var emptyCellsCheckResult = CheckIfAnyEmptyCells(); - if (emptyCellsCheckResult) - { - IsAddRowButtonEnabled = false; - return; - } - else - { - IsAddRowButtonEnabled = true; - return; - } - } - - public void SetShowModdedStatesOnlyButtonEnablementAndVisibility() - { - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType == NodeType.DialogueEvent) - { - IsShowModdedStatesCheckBoxVisible = true; - - if (_audioEditorService.ModdedStatesByStateGroupLookup.Count > 0) - IsShowModdedStatesCheckBoxEnabled = true; - else if (_audioEditorService.ModdedStatesByStateGroupLookup.Count == 0) - IsShowModdedStatesCheckBoxEnabled = false; - } - else - IsShowModdedStatesCheckBoxVisible = false; - } - - private bool CheckIfAudioProjectViewerRowExists() - { - var audioProjectEditorData = DataGridHelpers.GetAudioProjectEditorDataGridRow( _audioEditorService) - .ToList(); - - var rowExists = _audioEditorService.GetViewerDataGrid() - .Any(dictionary => audioProjectEditorData.SequenceEqual(dictionary)); - - return rowExists; - } - - private bool CheckIfAnyEmptyCells() - { - var dataGridRow = _audioEditorService.GetEditorDataGrid()[0]; - var emptyColumns = dataGridRow - .Where(kvp => kvp.Value is string value && string.IsNullOrEmpty(value)) - .ToList(); - - if (emptyColumns.Count > 0) - return true; - else - return false; - } - - public void SelectMovieFile() - { - var result = _standardDialogs.DisplayBrowseDialog([".ca_vp8"]); - if (result.Result) - { - var movieFilePath = _packFileService.GetFullPath(result.File); - - var editorRow = _audioEditorService.GetEditorDataGrid()[0]; - - var rowData = new Dictionary - { - { DataGridConfiguration.EventNameColumn, ConvertMovieFilePath(movieFilePath) } - }; - - DataGridHelpers.ClearDataGrid(AudioProjectEditorDataGrid); - AudioProjectEditorDataGrid.Add(rowData); - } - } - - public static string ConvertMovieFilePath(string filePath) - { - filePath = filePath.Replace("movies\\", string.Empty); - filePath = filePath.Replace(Path.GetExtension(filePath), string.Empty); - filePath = filePath.Replace("\\", "_"); - return "Movie_" + filePath; - } - - public void SetAudioProjectEditorLabel(string label) - { - AudioProjectEditorLabel = $"Audio Project Editor {label}"; - } - - public void ResetAudioProjectEditorLabel() - { - AudioProjectEditorLabel = $"Audio Project Editor"; - } - - public void ResetButtonEnablement() - { - ResetAddRowButtonEnablement(); - ResetShowModdedStatesCheckBoxEnablement(); - } - - public void ResetAddRowButtonEnablement() - { - IsAddRowButtonEnabled = false; - } - - public void ResetShowModdedStatesCheckBoxEnablement() - { - IsShowModdedStatesCheckBoxEnabled = false; - } - - public void ResetDataGrid() - { - DataGridHelpers.ClearDataGrid(AudioProjectEditorDataGrid); - DataGridHelpers.ClearDataGridColumns(DataGridHelpers.GetDataGridByTag(AudioProjectEditorDataGridTag)); - } - - public void Close() {} - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/ActionEventDataGridService.cs b/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/ActionEventDataGridService.cs deleted file mode 100644 index fa7bc9670..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/ActionEventDataGridService.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System.Collections.Generic; -using Editors.Audio.AudioEditor.AudioProjectData; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.GameSettings.Warhammer3; - -namespace Editors.Audio.AudioEditor.AudioProjectEditor.DataGrid -{ - public class ActionEventDataGridService : IAudioProjectEditorDataGridService - { - private readonly IAudioEditorService _audioEditorService; - - public ActionEventDataGridService(IAudioEditorService audioEditorService) - { - _audioEditorService = audioEditorService; - } - - public void LoadDataGrid() - { - ConfigureDataGrid(); - InitialiseDataGridData(); - } - - public void ConfigureDataGrid() - { - var dataGrid = DataGridConfiguration.InitialiseDataGrid(_audioEditorService.AudioProjectEditorViewModel.AudioProjectEditorDataGridTag); - - var columnsCount = 1; - var columnWidth = 1.0 / columnsCount; - - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.Name == SoundBanks.MoviesDisplayString) - { - var fileSelectColumn = DataGridConfiguration.CreateColumn(_audioEditorService.AudioEditorViewModel, DataGridConfiguration.BrowseMovieColumn, 85, DataGridColumnType.FileSelectButton, useAbsoluteWidth: true); - dataGrid.Columns.Add(fileSelectColumn); - - var eventColumn = DataGridConfiguration.CreateColumn(_audioEditorService.AudioEditorViewModel, DataGridConfiguration.EventNameColumn, columnWidth, DataGridColumnType.ReadOnlyTextBlock); - dataGrid.Columns.Add(eventColumn); - } - else - { - var eventColumn = DataGridConfiguration.CreateColumn(_audioEditorService.AudioEditorViewModel, DataGridConfiguration.EventNameColumn, columnWidth, DataGridColumnType.EditableEventTextBox); - dataGrid.Columns.Add(eventColumn); - } - } - - public void InitialiseDataGridData() - { - var eventName = string.Empty; - - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.Name != SoundBanks.MoviesDisplayString) - eventName = "Play_"; - - var rowData = new Dictionary - { - { DataGridConfiguration.EventNameColumn, eventName } - }; - _audioEditorService.GetEditorDataGrid().Add(rowData); - } - - public void SetDataGridData() - { - var selectedRow = _audioEditorService.GetSelectedViewerRows()[0]; - var eventValue = selectedRow[DataGridConfiguration.EventNameColumn]; - - var rowData = new Dictionary - { - { DataGridConfiguration.EventNameColumn, eventValue } - }; - - _audioEditorService.GetEditorDataGrid().Add(rowData); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/AudioProjectEditorDataGridServiceFactory.cs b/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/AudioProjectEditorDataGridServiceFactory.cs deleted file mode 100644 index 9c24dcb12..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/AudioProjectEditorDataGridServiceFactory.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Editors.Audio.AudioEditor.AudioProjectExplorer; -using Editors.Audio.Storage; - -namespace Editors.Audio.AudioEditor.AudioProjectEditor.DataGrid -{ - public class AudioProjectEditorDataGridServiceFactory - { - private readonly IAudioEditorService _audioEditorService; - private readonly IAudioRepository _audioRepository; - - public AudioProjectEditorDataGridServiceFactory(IAudioEditorService audioEditorService, IAudioRepository audioRepository) - { - _audioEditorService = audioEditorService; - _audioRepository = audioRepository; - } - - public IAudioProjectEditorDataGridService GetService(NodeType nodeType) - { - return nodeType switch - { - NodeType.ActionEventSoundBank => new ActionEventDataGridService(_audioEditorService), - NodeType.DialogueEvent => new DialogueEventDataGridService(_audioEditorService, _audioRepository), - NodeType.StateGroup => new StateGroupDataGridService(_audioEditorService), - _ => throw new System.NotImplementedException($"No service defined for node type {nodeType}") - }; - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/DialogueEventDataGridService.cs b/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/DialogueEventDataGridService.cs deleted file mode 100644 index 779733ba0..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/DialogueEventDataGridService.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Editors.Audio.AudioEditor.AudioProjectData; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.Storage; - -namespace Editors.Audio.AudioEditor.AudioProjectEditor.DataGrid -{ - public class DialogueEventDataGridService : IAudioProjectEditorDataGridService - { - private readonly IAudioEditorService _audioEditorService; - private readonly IAudioRepository _audioRepository; - - public DialogueEventDataGridService(IAudioEditorService audioEditorService, IAudioRepository audioRepository) - { - _audioEditorService = audioEditorService; - _audioRepository = audioRepository; - } - - public void LoadDataGrid() - { - ConfigureDataGrid(); - InitialiseDataGridData(); - } - - public void ConfigureDataGrid() - { - var dataGrid = DataGridConfiguration.InitialiseDataGrid(_audioEditorService.AudioProjectEditorViewModel.AudioProjectEditorDataGridTag); - - var dialogueEvent = AudioProjectHelpers.GetDialogueEventFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - - var stateGroupsCount = _audioRepository.StateGroupsLookupByDialogueEvent[dialogueEvent.Name].Count; - var columnWidth = 1.0 / (1 + stateGroupsCount); - - var stateGroupsWithQualifiers = _audioRepository.QualifiedStateGroupLookupByStateGroupByDialogueEvent[dialogueEvent.Name]; - foreach (var stateGroupWithQualifier in stateGroupsWithQualifiers) - { - var columnHeader = DataGridHelpers.AddExtraUnderscoresToString(stateGroupWithQualifier.Key); - var states = DataGridHelpers.GetStatesForStateGroupColumn(_audioEditorService.AudioEditorViewModel, _audioRepository, _audioEditorService, stateGroupWithQualifier.Value); - var stateGroupColumn = DataGridConfiguration.CreateColumn(_audioEditorService.AudioEditorViewModel, columnHeader, columnWidth, DataGridColumnType.StateGroupEditableComboBox, states); - dataGrid.Columns.Add(stateGroupColumn); - } - } - - public void InitialiseDataGridData() - { - var rowData = new Dictionary(); - - var stateGroupsWithAnyState = _audioRepository.StatesLookupByStateGroup - .Where(stateGroupColumn => stateGroupColumn.Value.Contains("Any")) - .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - - var dialogueEvent = AudioProjectHelpers.GetDialogueEventFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - - var stateGroupsWithQualifiers = _audioRepository.QualifiedStateGroupLookupByStateGroupByDialogueEvent[dialogueEvent.Name]; - foreach (var stateGroupWithQualifier in stateGroupsWithQualifiers) - { - var columnName = DataGridHelpers.AddExtraUnderscoresToString(stateGroupWithQualifier.Key); - var stateGroup = _audioRepository.GetStateGroupFromStateGroupWithQualifier(dialogueEvent.Name, DataGridHelpers.RemoveExtraUnderscoresFromString(columnName)); - - if (stateGroupsWithAnyState.ContainsKey(stateGroup)) - rowData[columnName] = "Any"; // Set the cell value to Any as the default value - } - - _audioEditorService.GetEditorDataGrid().Add(rowData); - } - - public void SetDataGridData() - { - _audioEditorService.GetEditorDataGrid().Add(_audioEditorService.GetSelectedViewerRows()[0]); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/IAudioProjectEditorDataGridService.cs b/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/IAudioProjectEditorDataGridService.cs deleted file mode 100644 index d1241150a..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/IAudioProjectEditorDataGridService.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Editors.Audio.AudioEditor.AudioProjectEditor.DataGrid -{ - public interface IAudioProjectEditorDataGridService - { - public void LoadDataGrid(); - public void ConfigureDataGrid(); - public void InitialiseDataGridData(); - public void SetDataGridData(); - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/StateGroupDataGridService.cs b/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/StateGroupDataGridService.cs deleted file mode 100644 index cf5b38f57..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectEditor/DataGrid/StateGroupDataGridService.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; -using Editors.Audio.AudioEditor.AudioProjectData; -using Editors.Audio.AudioEditor.DataGrids; - -namespace Editors.Audio.AudioEditor.AudioProjectEditor.DataGrid -{ - public class StateGroupDataGridService : IAudioProjectEditorDataGridService - { - private readonly IAudioEditorService _audioEditorService; - - public StateGroupDataGridService(IAudioEditorService audioEditorService) - { - _audioEditorService = audioEditorService; - } - - public void LoadDataGrid() - { - ConfigureDataGrid(); - InitialiseDataGridData(); - } - - public void ConfigureDataGrid() - { - var stateGroup = AudioProjectHelpers.GetStateGroupFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - var dataGrid = DataGridConfiguration.InitialiseDataGrid(_audioEditorService.AudioProjectEditorViewModel.AudioProjectEditorDataGridTag); - var stateGroupColumn = DataGridConfiguration.CreateColumn(_audioEditorService.AudioEditorViewModel, DataGridHelpers.AddExtraUnderscoresToString(stateGroup.Name), 1.0, DataGridColumnType.EditableTextBox); - dataGrid.Columns.Add(stateGroupColumn); - } - - public void InitialiseDataGridData() - { - var dataGridRow = new Dictionary { }; - var stateGroup = AudioProjectHelpers.GetStateGroupFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - dataGridRow[DataGridHelpers.AddExtraUnderscoresToString(stateGroup.Name)] = string.Empty; - _audioEditorService.GetEditorDataGrid().Add(dataGridRow); - } - - public void SetDataGridData() - { - _audioEditorService.GetEditorDataGrid().Add(_audioEditorService.GetSelectedViewerRows()[0]); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectExplorer/AudioProjectExplorerView.xaml.cs b/Editors/Audio/AudioEditor/AudioProjectExplorer/AudioProjectExplorerView.xaml.cs deleted file mode 100644 index e077e3e72..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectExplorer/AudioProjectExplorerView.xaml.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Windows; -using System.Windows.Controls; -using static Editors.Audio.GameSettings.Warhammer3.DialogueEvents; - -namespace Editors.Audio.AudioEditor.AudioProjectExplorer -{ - public partial class AudioProjectExplorerView : UserControl - { - public AudioProjectExplorerViewModel ViewModel => DataContext as AudioProjectExplorerViewModel; - - public AudioProjectExplorerView() - { - InitializeComponent(); - } - - private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (e.NewValue is TreeNode selectedNode) - ViewModel.OnSelectedNodeChanged(selectedNode); - } - - private void WatermarkComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (DialogueEventFilterComboBox?.SelectedItem is DialogueEventPreset selectedPreset && selectedPreset == DialogueEventPreset.ShowAll) - ViewModel.ResetDialogueEventFilterComboBoxSelectedItem(DialogueEventFilterComboBox); - } - - private void ClearButtonClick(object sender, RoutedEventArgs e) - { - FilterTextBoxItem.Focus(); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectExplorer/AudioProjectExplorerViewModel.cs b/Editors/Audio/AudioEditor/AudioProjectExplorer/AudioProjectExplorerViewModel.cs deleted file mode 100644 index d97534ade..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectExplorer/AudioProjectExplorerViewModel.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.Collections.ObjectModel; -using System.Linq; -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; -using Editors.Audio.AudioEditor.Events; -using Serilog; -using Shared.Core.ErrorHandling; -using Shared.Core.Events; -using Shared.Core.ToolCreation; -using Xceed.Wpf.Toolkit; -using static Editors.Audio.GameSettings.Warhammer3.DialogueEvents; - -namespace Editors.Audio.AudioEditor.AudioProjectExplorer -{ - public partial class AudioProjectExplorerViewModel : ObservableObject, IEditorInterface - { - private readonly IEventHub _eventHub; - private readonly IAudioEditorService _audioEditorService; - - private readonly ILogger _logger = Logging.Create(); - - public string DisplayName { get; set; } = "Audio Project Explorer"; - - [ObservableProperty] private string _audioProjectExplorerLabel; - [ObservableProperty] private bool _showEditedAudioProjectItemsOnly; - [ObservableProperty] private bool _isDialogueEventPresetFilterEnabled = false; - [ObservableProperty] private DialogueEventPreset? _selectedDialogueEventPreset; - [ObservableProperty] private ObservableCollection _dialogueEventPresets; - [ObservableProperty] private string _searchQuery; - [ObservableProperty] public ObservableCollection _audioProjectTree = []; - private ObservableCollection _unfilteredTree; - public TreeNode _selectedAudioProjectTreeNode; - - public AudioProjectExplorerViewModel(IEventHub eventHub, IAudioEditorService audioEditorService) - { - _eventHub = eventHub; - _audioEditorService = audioEditorService; - - AudioProjectExplorerLabel = $"{DisplayName}"; - } - - public void OnSelectedNodeChanged(TreeNode value) - { - _selectedAudioProjectTreeNode = value; - - _eventHub.Publish(new NodeSelectedEvent()); - - ResetButtonEnablement(); - - if (_audioEditorService.GetSelectedExplorerNode().NodeType == NodeType.DialogueEventSoundBank) - { - DialogueEventFilter.HandleDialogueEventsPresetFilter(this, _audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - - _logger.Here().Information($"Loaded Dialogue Event SoundBank: {_audioEditorService.GetSelectedExplorerNode().Name}"); - } - } - - partial void OnSelectedDialogueEventPresetChanged(DialogueEventPreset? value) - { - DialogueEventFilter.ApplyDialogueEventPresetFiltering(_audioEditorService.AudioEditorViewModel, _audioEditorService); - } - - partial void OnSearchQueryChanged(string value) - { - if (_unfilteredTree == null) - return; - - if (string.IsNullOrWhiteSpace(SearchQuery)) - ResetTree(); - else - AudioProjectTree = FilterFileTree(SearchQuery); - } - - private void ResetTree() - { - AudioProjectTree = new ObservableCollection(_unfilteredTree); - } - - private ObservableCollection FilterFileTree(string query) - { - var filteredTree = new ObservableCollection(); - - foreach (var treeNode in _unfilteredTree) - { - var filteredNode = FilterTreeNode(treeNode, query); - if (filteredNode != null) - filteredTree.Add(filteredNode); - } - - return filteredTree; - } - - private static TreeNode FilterTreeNode(TreeNode node, string query) - { - var matchesQuery = node.Name.Contains(query, StringComparison.OrdinalIgnoreCase); - var filteredChildren = node.Children - .Select(child => FilterTreeNode(child, query)) - .Where(child => child != null) - .ToList(); - - if (matchesQuery || filteredChildren.Count != 0) - { - var filteredNode = new TreeNode - { - Name = node.Name, - NodeType = node.NodeType, - Parent = node.Parent, - Children = new ObservableCollection(filteredChildren), - IsNodeExpanded = true - }; - return filteredNode; - } - - return null; - } - - partial void OnShowEditedAudioProjectItemsOnlyChanged(bool value) - { - TreeBuilder.FilterEditedAudioProjectItems(_audioEditorService, this, AudioProjectTree, ShowEditedAudioProjectItemsOnly); - } - - public void CreateAudioProjectTree() - { - TreeBuilder.CreateAudioProjectTree(_audioEditorService, AudioProjectTree, ShowEditedAudioProjectItemsOnly); - _unfilteredTree = new ObservableCollection(AudioProjectTree); - } - - [RelayCommand] public void CollapseOrExpandAudioProjectTree() - { - CollapseAndExpandNodes(); - } - - public void CollapseAndExpandNodes() - { - foreach (var node in AudioProjectTree) - { - node.IsNodeExpanded = !node.IsNodeExpanded; - CollapseAndExpandNodesInner(node); - } - } - - public static void CollapseAndExpandNodesInner(TreeNode parentNode) - { - foreach (var node in parentNode.Children) - { - node.IsNodeExpanded = !node.IsNodeExpanded; - CollapseAndExpandNodesInner(node); - } - } - - [RelayCommand] public void ClearText() - { - SearchQuery = ""; - } - - public void ResetDialogueEventFilterComboBoxSelectedItem(WatermarkComboBox watermarkComboBox) - { - watermarkComboBox.SelectedItem = null; - SelectedDialogueEventPreset = null; - } - - public void ResetButtonEnablement() - { - IsDialogueEventPresetFilterEnabled = false; - } - - public void Close() { } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectExplorer/DialogueEventFilter.cs b/Editors/Audio/AudioEditor/AudioProjectExplorer/DialogueEventFilter.cs deleted file mode 100644 index 5b07e9703..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectExplorer/DialogueEventFilter.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System.Collections.ObjectModel; -using System.Linq; -using Editors.Audio.AudioEditor.AudioProjectData; -using Editors.Audio.GameSettings.Warhammer3; -using static Editors.Audio.GameSettings.Warhammer3.DialogueEvents; - -namespace Editors.Audio.AudioEditor.AudioProjectExplorer -{ - public class DialogueEventFilter - { - public static void ApplyDialogueEventPresetFiltering(AudioEditorViewModel audioEditorViewModel, IAudioEditorService audioEditorService) - { - var audioProjectTreeNode = audioEditorViewModel.AudioProjectExplorerViewModel._selectedAudioProjectTreeNode; - if (audioProjectTreeNode.NodeType == NodeType.DialogueEventSoundBank) - { - var soundBank = AudioProjectHelpers.GetSoundBankFromName(audioEditorService, audioEditorService.GetSelectedExplorerNode().Name); - - var presetFilter = audioEditorViewModel.AudioProjectExplorerViewModel.SelectedDialogueEventPreset; - - if (presetFilter != null) - { - audioProjectTreeNode.PresetFilter = presetFilter; - - if (presetFilter != DialogueEventPreset.ShowAll) - audioProjectTreeNode.PresetFilterDisplayText = $" (Filtered by {GetDialogueEventPresetDisplayString(presetFilter)} preset)"; - else - audioProjectTreeNode.PresetFilterDisplayText = null; - } - - TreeBuilder.AddFilteredDialogueEventsToSoundBankTreeViewItems(audioEditorService, audioEditorViewModel.AudioProjectExplorerViewModel, soundBank.Name, presetFilter); - } - } - - public static void HandleDialogueEventsPresetFilter(AudioProjectExplorerViewModel audioProjectExplorerViewModel, IAudioEditorService audioEditorService, string soundBankName) - { - SetDialogueEventPresets(audioProjectExplorerViewModel, soundBankName); - - SetSelectedDialogueEventPreset(audioProjectExplorerViewModel, audioEditorService); - - audioProjectExplorerViewModel.IsDialogueEventPresetFilterEnabled = true; - } - - private static void SetDialogueEventPresets(AudioProjectExplorerViewModel audioProjectExplorerViewModel, string soundBankName) - { - var soundBankSubtype = SoundBanks.GetSoundBankSubtype(soundBankName); - - var dialogueEventPresets = new ObservableCollection(DialogueEventData - .Where(dialogueEvent => dialogueEvent.SoundBank == soundBankSubtype) - .SelectMany(dialogueEvent => dialogueEvent.DialogueEventPreset) - .Distinct()); - - audioProjectExplorerViewModel.DialogueEventPresets = dialogueEventPresets; - } - - private static void SetSelectedDialogueEventPreset(AudioProjectExplorerViewModel audioProjectExplorerViewModel, IAudioEditorService audioEditorService) - { - var soundBank = TreeNode.GetAudioProjectTreeNodeFromName(audioProjectExplorerViewModel.AudioProjectTree, audioEditorService.GetSelectedExplorerNode().Name); - if (soundBank.PresetFilter != DialogueEventPreset.ShowAll && soundBank.PresetFilter != null) - audioProjectExplorerViewModel.SelectedDialogueEventPreset = soundBank.PresetFilter; - else - audioProjectExplorerViewModel.SelectedDialogueEventPreset = null; - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectExplorer/TreeBuilder.cs b/Editors/Audio/AudioEditor/AudioProjectExplorer/TreeBuilder.cs deleted file mode 100644 index d42d07707..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectExplorer/TreeBuilder.cs +++ /dev/null @@ -1,298 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using Editors.Audio.AudioEditor.AudioProjectData; -using static Editors.Audio.GameSettings.Warhammer3.DialogueEvents; -using static Editors.Audio.GameSettings.Warhammer3.SoundBanks; - -namespace Editors.Audio.AudioEditor.AudioProjectExplorer -{ - public class TreeBuilder - { - public static void CreateAudioProjectTree(IAudioEditorService audioEditorService, ObservableCollection audioProjectTree, bool showEditedAudioProjectItemsOnly) - { - audioProjectTree.Clear(); - AddActionEvents(audioEditorService, audioProjectTree, showEditedAudioProjectItemsOnly); - AddDialogueEvents(audioEditorService, audioProjectTree, showEditedAudioProjectItemsOnly); - AddStateGroups(audioEditorService, audioProjectTree, showEditedAudioProjectItemsOnly); - } - - private static void AddActionEvents(IAudioEditorService audioEditorService, ObservableCollection audioProjectTree, bool showEditedAudioProjectItemsOnly) - { - var soundBanksNode = new TreeNode - { - Name = "Action Events", - NodeType = NodeType.ActionEvents, - Children = new ObservableCollection() - }; - audioProjectTree.Add(soundBanksNode); - - AddActionEventSoundBankNodes(audioEditorService, soundBanksNode, showEditedAudioProjectItemsOnly); - } - - private static void AddDialogueEvents(IAudioEditorService audioEditorService, ObservableCollection audioProjectTree, bool showEditedAudioProjectItemsOnly) - { - var dialogueEventsNode = new TreeNode - { - Name = "Dialogue Events", - NodeType = NodeType.DialogueEvents, - Children = new ObservableCollection() - }; - audioProjectTree.Add(dialogueEventsNode); - - AddDialogueEventSoundBankNodes(audioEditorService, dialogueEventsNode, showEditedAudioProjectItemsOnly); - } - - private static void AddStateGroups(IAudioEditorService audioEditorService, ObservableCollection audioProjectTree, bool showEditedAudioProjectItemsOnly) - { - var stateGroupsNode = new TreeNode - { - Name = "State Groups", - NodeType = NodeType.StateGroups, - Children = new ObservableCollection() - }; - audioProjectTree.Add(stateGroupsNode); - - AddStateGroupNodes(audioEditorService, stateGroupsNode, showEditedAudioProjectItemsOnly); - } - - private static void AddActionEventSoundBankNodes(IAudioEditorService audioEditorService, TreeNode soundBanksNode, bool showEditedAudioProjectItemsOnly) - { - var actionEventSoundBanks = GetSoundBanks(audioEditorService, showEditedAudioProjectItemsOnly, Wh3SoundBankType.ActionEventSoundBank); - if (actionEventSoundBanks.Count > 0) - { - foreach (var soundBank in actionEventSoundBanks) - { - var soundBankNode = new TreeNode - { - Name = soundBank.Name, - NodeType = NodeType.ActionEventSoundBank, - Parent = soundBanksNode - }; - soundBanksNode.Children.Add(soundBankNode); - } - } - } - - private static void AddDialogueEventSoundBankNodes(IAudioEditorService audioEditorService, TreeNode soundBanksNode, bool showEditedAudioProjectItemsOnly) - { - var dialogueEventSoundBanks = GetSoundBanks(audioEditorService, showEditedAudioProjectItemsOnly, Wh3SoundBankType.DialogueEventSoundBank); - if (dialogueEventSoundBanks.Count > 0) - { - foreach (var soundBank in dialogueEventSoundBanks) - { - var soundBankNode = new TreeNode - { - Name = soundBank.Name, - NodeType = NodeType.DialogueEventSoundBank, - Parent = soundBanksNode, - Children = new ObservableCollection() - }; - - AddDialogueEventNodes(showEditedAudioProjectItemsOnly, soundBank, soundBankNode); - - soundBanksNode.Children.Add(soundBankNode); - } - } - } - - private static void AddDialogueEventNodes(bool showEditedAudioProjectItemsOnly, SoundBank soundBank, TreeNode soundBankNode) - { - var dialogueEvents = showEditedAudioProjectItemsOnly - ? soundBank.DialogueEvents.Where(dialogueEvent => dialogueEvent.StatePaths.Count > 0) - : soundBank.DialogueEvents; - - foreach (var dialogueEvent in dialogueEvents) - { - var dialogueEventNode = new TreeNode - { - Name = dialogueEvent.Name, - NodeType = NodeType.DialogueEvent, - Parent = soundBankNode - }; - soundBankNode.Children.Add(dialogueEventNode); - } - } - - private static void AddStateGroupNodes(IAudioEditorService audioEditorService, TreeNode stateGroupsNode, bool showEditedAudioProjectItemsOnly) - { - var stateGroups = GetStates(audioEditorService, showEditedAudioProjectItemsOnly); - if (stateGroups.Count > 0) - { - foreach (var stateGroup in stateGroups) - { - var stateGroupNode = new TreeNode - { - Name = stateGroup.Name, - NodeType = NodeType.StateGroup, - Parent = stateGroupsNode - }; - stateGroupsNode.Children.Add(stateGroupNode); - } - } - } - - public static void AddFilteredDialogueEventsToSoundBankTreeViewItems(IAudioEditorService audioEditorService, AudioProjectExplorerViewModel audioProjectExplorerViewModel, string soundBankName, DialogueEventPreset? dialogueEventPreset) - { - var filteredDialogueEventNames = DialogueEventData - .Where(dialogueEvent => GetSoundBankSubTypeString(dialogueEvent.SoundBank) == audioEditorService.GetSelectedExplorerNode().Name - && (!dialogueEventPreset.HasValue || dialogueEvent.DialogueEventPreset.Contains(dialogueEventPreset.Value))) - .Select(dialogueEvent => dialogueEvent.Name) - .ToHashSet(); - - var soundBank = TreeNode.GetAudioProjectTreeNodeFromName(audioProjectExplorerViewModel.AudioProjectTree, soundBankName); - - foreach (var dialogueEvent in soundBank.Children) - { - if (filteredDialogueEventNames.Contains(dialogueEvent.Name)) - dialogueEvent.IsVisible = true; - else - dialogueEvent.IsVisible = false; - } - } - - public static void FilterEditedAudioProjectItems(IAudioEditorService audioEditorService, AudioProjectExplorerViewModel audioProjectExplorerViewModel, ObservableCollection audioProjectTree, bool showEditedAudioProjectItemsOnly) - { - FilterEditedAudioProjectItemsInner(audioEditorService, audioProjectExplorerViewModel, audioProjectTree, showEditedAudioProjectItemsOnly); - - if (!showEditedAudioProjectItemsOnly) - { - var dialogueEventsNode = TreeNode.GetAudioProjectTreeNodeFromName(audioProjectTree, "Dialogue Events"); - - if (dialogueEventsNode == null) - return; - - var dialogueEventSoundBanks = dialogueEventsNode.Children; - - foreach (var soundBank in dialogueEventSoundBanks) - { - if (soundBank.PresetFilter != null && soundBank.PresetFilter != DialogueEventPreset.ShowAll) - { - var filteredDialogueEventNames = DialogueEventData - .Where(dialogueEvent => GetSoundBankSubTypeString(dialogueEvent.SoundBank) == soundBank.Name - && (!soundBank.PresetFilter.HasValue || dialogueEvent.DialogueEventPreset.Contains(soundBank.PresetFilter.Value))) - .Select(dialogueEvent => dialogueEvent.Name) - .ToHashSet(); - - foreach (var dialogueEvent in soundBank.Children) - { - if (filteredDialogueEventNames.Contains(dialogueEvent.Name)) - dialogueEvent.IsVisible = true; - else - dialogueEvent.IsVisible = false; - } - } - } - } - } - - public static void FilterEditedAudioProjectItemsInner(IAudioEditorService audioEditorService, AudioProjectExplorerViewModel audioProjectExplorerViewModel, ObservableCollection node, bool showEditedAudioProjectItemsOnly) - { - foreach (var childNode in node) - { - if (childNode.Children.Any()) - { - FilterEditedAudioProjectItemsInner(audioEditorService, audioProjectExplorerViewModel, childNode.Children, showEditedAudioProjectItemsOnly); - - if (!childNode.Children.Any(c => c.IsVisible)) - { - childNode.IsVisible = false; - continue; - } - } - - if (!showEditedAudioProjectItemsOnly) - { - childNode.IsVisible = true; - continue; - } - - switch (childNode.NodeType) - { - case NodeType.ActionEvents: - case NodeType.DialogueEvents: - case NodeType.StateGroups: - childNode.IsVisible = childNode.Children.Any(); - break; - - case NodeType.ActionEventSoundBank: - childNode.IsVisible = audioEditorService.AudioProject.SoundBanks.Any(soundBank => soundBank.Name == childNode.Name && soundBank.ActionEvents.Count > 0); - break; - - case NodeType.DialogueEventSoundBank: - childNode.IsVisible = audioEditorService.AudioProject.SoundBanks.Any(soundBank => soundBank.Name == childNode.Name && soundBank.DialogueEvents.Any(dialogueEvent => dialogueEvent.StatePaths.Count > 0)); - break; - - case NodeType.StateGroup: - childNode.IsVisible = audioEditorService.AudioProject.StateGroups.Any(stateGroup => stateGroup.Name == childNode.Name && stateGroup.States.Count > 0); - break; - - default: - childNode.IsVisible = true; - break; - } - } - - if (!node.Any(n => n.IsVisible)) - { - foreach (var parentNode in node) - { - parentNode.IsVisible = false; - } - } - } - - private static List GetSoundBanks(IAudioEditorService audioEditorService, bool showEditedAudioProjectItemsOnly, Wh3SoundBankType gameSoundBankType) - { - if (showEditedAudioProjectItemsOnly) - { - if (gameSoundBankType == Wh3SoundBankType.ActionEventSoundBank) - { - return audioEditorService.AudioProject.SoundBanks - .Where(soundBank => soundBank.SoundBankType == Wh3SoundBankType.ActionEventSoundBank - && soundBank.ActionEvents.Count > 0) - .ToList(); - } - else - { - return audioEditorService.AudioProject.SoundBanks - .Where(soundBank => soundBank.SoundBankType == Wh3SoundBankType.DialogueEventSoundBank - && soundBank.DialogueEvents.Any(dialogueEvent => dialogueEvent.StatePaths.Count > 0)) - .ToList(); - } - } - else - { - if (gameSoundBankType == Wh3SoundBankType.ActionEventSoundBank) - { - return audioEditorService.AudioProject.SoundBanks - .Where(soundBank => soundBank.SoundBankType == Wh3SoundBankType.ActionEventSoundBank) - .ToList(); - } - else - { - return audioEditorService.AudioProject.SoundBanks - .Where(soundBank => soundBank.SoundBankType == Wh3SoundBankType.DialogueEventSoundBank) - .ToList(); - } - } - - } - - private static List GetStates(IAudioEditorService audioEditorService, bool showEditedAudioProjectItemsOnly) - { - if (showEditedAudioProjectItemsOnly) - { - return audioEditorService.AudioProject.StateGroups - .Where(state => state.States.Count > 0) - .ToList(); - } - else - { - return audioEditorService.AudioProject.StateGroups - .ToList(); - } - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectExplorer/TreeNode.cs b/Editors/Audio/AudioEditor/AudioProjectExplorer/TreeNode.cs deleted file mode 100644 index 32bcb3765..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectExplorer/TreeNode.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Collections.ObjectModel; -using CommunityToolkit.Mvvm.ComponentModel; -using static Editors.Audio.GameSettings.Warhammer3.DialogueEvents; - -namespace Editors.Audio.AudioEditor.AudioProjectExplorer -{ - public enum NodeType - { - ActionEvents, - ActionEventSoundBank, - DialogueEvents, - DialogueEventSoundBank, - DialogueEvent, - StateGroups, - StateGroup - } - - public partial class TreeNode : ObservableObject - { - public string Name { get; set; } - [ObservableProperty] public NodeType _nodeType; - [ObservableProperty] public TreeNode _parent; - [ObservableProperty] public ObservableCollection _children = []; - [ObservableProperty] bool _isNodeExpanded = false; - [ObservableProperty] bool _isVisible = true; - [ObservableProperty] public string _presetFilterDisplayText; - [ObservableProperty] public DialogueEventPreset? _presetFilter = DialogueEventPreset.ShowAll; - - public static TreeNode GetAudioProjectTreeNodeFromName(ObservableCollection audioProjectTree, string nodeName) - { - foreach (var node in audioProjectTree) - { - if (node.Name == nodeName) - return node; - - var childNode = GetAudioProjectTreeNodeFromName(node.Children, nodeName); - if (childNode != null) - return childNode; - } - - return null; - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectViewer/AudioProjectViewerView.xaml.cs b/Editors/Audio/AudioEditor/AudioProjectViewer/AudioProjectViewerView.xaml.cs deleted file mode 100644 index ac37886c6..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectViewer/AudioProjectViewerView.xaml.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.ComponentModel; -using System.Windows; -using System.Windows.Controls; -using Editors.Audio.AudioEditor.DataGrids; - -namespace Editors.Audio.AudioEditor.AudioProjectViewer -{ - public partial class AudioProjectViewerView : UserControl - { - public AudioProjectViewerViewModel ViewModel => DataContext as AudioProjectViewerViewModel; - - public AudioProjectViewerView() - { - InitializeComponent(); - Loaded += AudioProjectViewerView_Loaded; - } - - private void AudioProjectViewerView_Loaded(object sender, RoutedEventArgs e) - { - if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) - return; - - var dataGridTag = ViewModel?.AudioProjectViewerDataGridTag; - var dataGrid = DataGridHelpers.GetDataGridByTag(dataGridTag); - dataGrid.SelectionChanged += AudioEditorDataGrid_SelectionChanged; - } - - // Detects when a row in the DataGrid is selected - private void AudioEditorDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - var dataGrid = sender as System.Windows.Controls.DataGrid; - var selectedItems = dataGrid.SelectedItems; - if (ViewModel != null && selectedItems != null) - ViewModel.OnDataGridSelectionChanged(selectedItems); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectViewer/AudioProjectViewerViewModel.cs b/Editors/Audio/AudioEditor/AudioProjectViewer/AudioProjectViewerViewModel.cs deleted file mode 100644 index c16ff798a..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectViewer/AudioProjectViewerViewModel.cs +++ /dev/null @@ -1,300 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; -using Editors.Audio.AudioEditor.AudioProjectData; -using Editors.Audio.AudioEditor.AudioProjectExplorer; -using Editors.Audio.AudioEditor.AudioProjectViewer.DataGrid; -using Editors.Audio.AudioEditor.AudioSettings; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.AudioEditor.Events; -using Editors.Audio.Storage; -using Serilog; -using Shared.Core.ErrorHandling; -using Shared.Core.Events; -using Shared.Core.ToolCreation; - -namespace Editors.Audio.AudioEditor.AudioProjectViewer -{ - public partial class AudioProjectViewerViewModel : ObservableObject, IEditorInterface - { - private readonly IEventHub _eventHub; - private readonly IAudioRepository _audioRepository; - private readonly IAudioEditorService _audioEditorService; - private readonly AudioProjectViewerDataGridServiceFactory _audioProjectViewerDataGridServiceFactory; - private readonly AudioProjectDataServiceFactory _audioProjectDataServiceFactory; - - private readonly ILogger _logger = Logging.Create(); - - public string DisplayName { get; set; } = "Audio Project Viewer"; - - [ObservableProperty] private string _audioProjectViewerLabel; - [ObservableProperty] private string _audioProjectViewerDataGridTag = "AudioProjectViewerDataGrid"; - [ObservableProperty] private ObservableCollection> _audioProjectViewerDataGrid; - [ObservableProperty] private ObservableCollection> _selectedDataGridRows; - [ObservableProperty] private ObservableCollection> _copiedDataGridRows; - [ObservableProperty] public ObservableCollection _soundBanks; - [ObservableProperty] private bool _isUpdateRowButtonEnabled = false; - [ObservableProperty] private bool _isRemoveRowButtonEnabled = false; - [ObservableProperty] private bool _isCopyEnabled = false; - [ObservableProperty] private bool _isPasteEnabled = false; - - public AudioProjectViewerViewModel( - IEventHub eventHub, - IAudioRepository audioRepository, - IAudioEditorService audioEditorService, - AudioProjectViewerDataGridServiceFactory audioProjectViewerDataGridServiceFactory, - AudioProjectDataServiceFactory audioProjectDataServiceFactory) - { - _eventHub = eventHub; - _audioRepository = audioRepository; - _audioEditorService = audioEditorService; - _audioProjectViewerDataGridServiceFactory = audioProjectViewerDataGridServiceFactory; - _audioProjectDataServiceFactory = audioProjectDataServiceFactory; - - AudioProjectViewerLabel = $"{DisplayName}"; - - _eventHub.Register(this, OnSelectedNodeChanged); - _eventHub.Register(this, OnItemAdded); - } - - public void OnDataGridSelectionChanged(IList selectedItems) - { - if (SelectedDataGridRows.Count == 0) - SetSelectedDataGridRows(selectedItems); - - // TODO: Should probably add an event for this. - if (_audioEditorService.AudioSettingsViewModel.ShowSettingsFromAudioProjectViewer) - { - _audioEditorService.AudioSettingsViewModel.ShowSettingsFromAudioProjectViewerItem(); - _audioEditorService.AudioSettingsViewModel.DisableAllAudioSettings(); - } - - SetSelectedDataGridRows(selectedItems); - SetButtonEnablement(); - SetCopyEnablement(); - } - - public void OnSelectedNodeChanged(NodeSelectedEvent nodeSelectedEvent) - { - ResetAudioProjectViewerLabel(); - ResetButtonEnablement(); - ResetDataGrid(); - - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType == NodeType.ActionEventSoundBank) - { - SetAudioProjectViewerLabel(selectedNode.Name); - LoadDataGrid(selectedNode.NodeType); - } - else if (selectedNode.NodeType == NodeType.DialogueEvent) - { - // Rebuild StateGroupsWithModdedStates in case any have been added since the Audio Project was initialised - _audioEditorService.BuildModdedStatesByStateGroupLookup(_audioEditorService.AudioProject.StateGroups, _audioEditorService.ModdedStatesByStateGroupLookup); - - SetAudioProjectViewerLabel(DataGridHelpers.AddExtraUnderscoresToString(selectedNode.Name)); - LoadDataGrid(selectedNode.NodeType); - } - else if (selectedNode.NodeType == NodeType.StateGroup) - { - SetAudioProjectViewerLabel(DataGridHelpers.AddExtraUnderscoresToString(selectedNode.Name)); - LoadDataGrid(selectedNode.NodeType); - } - else - return; - - _logger.Here().Information($"Loaded {selectedNode.NodeType}: {selectedNode.Name}"); - - SetCopyEnablement(); - SetPasteEnablement(); - } - - private void LoadDataGrid(NodeType selectedNodeType) - { - var dataGridService = _audioProjectViewerDataGridServiceFactory.GetService(selectedNodeType); - dataGridService.LoadDataGrid(); - } - - public void OnItemAdded(ItemAddedEvent itemAddedEvent) - { - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType != NodeType.ActionEventSoundBank && selectedNode.NodeType != NodeType.DialogueEvent && selectedNode.NodeType != NodeType.StateGroup) - return; - - var dataGridService = _audioProjectViewerDataGridServiceFactory.GetService(selectedNode.NodeType); - dataGridService.InsertDataGridRow(); - - _logger.Here().Information($"Added {selectedNode.NodeType} item in: {selectedNode.Name}"); - } - - private void SetSelectedDataGridRows(IList selectedItems) - { - SelectedDataGridRows.Clear(); - - foreach (var item in selectedItems.OfType>()) - SelectedDataGridRows.Add(item); - } - - public void SetCopyEnablement() - { - if (SelectedDataGridRows != null) - IsCopyEnabled = SelectedDataGridRows.Any(); - } - - partial void OnAudioProjectViewerDataGridChanged(ObservableCollection> value) - { - if (AudioProjectViewerDataGrid != null) - { - AudioProjectViewerDataGrid.CollectionChanged += AudioProjectViewerDataGrid_CollectionChanged; - OnAudioProjectViewerDataGridChanged(); - } - } - - private void AudioProjectViewerDataGrid_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) - { - OnAudioProjectViewerDataGridChanged(); - } - - private void OnAudioProjectViewerDataGridChanged() - { - if (AudioProjectViewerDataGrid != null && AudioProjectViewerDataGrid.Count > 0) - SetPasteEnablement(); - } - - public void SetPasteEnablement() - { - if (!CopiedDataGridRows.Any()) - { - IsPasteEnabled = false; - return; - } - - var areAnyCopiedRowsInDataGrid = CopiedDataGridRows - .Any(copiedRow => _audioEditorService.GetViewerDataGrid() - .Any(dataGridRow => copiedRow.Count == dataGridRow.Count && !copiedRow.Except(dataGridRow).Any())); - - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType == NodeType.DialogueEvent) - { - var dialogueEvent = AudioProjectHelpers.GetDialogueEventFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - var dialogueEventStateGroups = _audioRepository - .QualifiedStateGroupLookupByStateGroupByDialogueEvent[dialogueEvent.Name] - .Select(kvp => DataGridHelpers.AddExtraUnderscoresToString(kvp.Key)) - .ToList(); - - var copiedDataGridRowStateGroups = CopiedDataGridRows[0] - .Select(kvp => kvp.Key) - .ToList(); - - var areStateGroupsEqual = dialogueEventStateGroups.SequenceEqual(copiedDataGridRowStateGroups); - - IsPasteEnabled = areStateGroupsEqual && !areAnyCopiedRowsInDataGrid; - } - } - - [RelayCommand] public void EditAudioProjectViewerDataGridRow() - { - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType != NodeType.ActionEventSoundBank && selectedNode.NodeType != NodeType.DialogueEvent && selectedNode.NodeType != NodeType.StateGroup) - return; - - _eventHub.Publish(new ItemEditedEvent()); // Publish before removing to ensure that an item is still selected - - RemoveData(selectedNode.NodeType); - - _logger.Here().Information($"Edited {selectedNode.NodeType} item in: {selectedNode.Name}"); - } - - [RelayCommand] public void RemoveAudioProjectViewerDataGridRow() - { - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType != NodeType.ActionEventSoundBank && selectedNode.NodeType != NodeType.DialogueEvent && selectedNode.NodeType != NodeType.StateGroup) - return; - - RemoveData(selectedNode.NodeType); - } - - private void RemoveData(NodeType nodeType) - { - var actionEventDataService = _audioProjectDataServiceFactory.GetService(nodeType); - actionEventDataService.RemoveFromAudioProject(); - } - - [RelayCommand] public void CopyRows() - { - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType == NodeType.DialogueEvent) - CopyDialogueEventRows(); - } - - public void CopyDialogueEventRows() - { - CopiedDataGridRows = []; - - foreach (var item in SelectedDataGridRows) - CopiedDataGridRows.Add(new Dictionary(item)); - - SetPasteEnablement(); - } - - [RelayCommand] public void PasteRows() - { - var selectedNode = _audioEditorService.GetSelectedExplorerNode(); - if (selectedNode.NodeType == NodeType.DialogueEvent) - PasteDialogueEventRows(); - } - - public void PasteDialogueEventRows() - { - foreach (var copiedDataGridRow in CopiedDataGridRows) - { - _audioEditorService.GetViewerDataGrid().Add(copiedDataGridRow); - - var dialogueEventDataService = _audioProjectDataServiceFactory.GetService(NodeType.DialogueEvent); - dialogueEventDataService.AddToAudioProject(); - } - - SetPasteEnablement(); - } - - public void SetButtonEnablement() - { - ResetButtonEnablement(); - - if (SelectedDataGridRows.Count == 1) - { - IsUpdateRowButtonEnabled = true; - IsRemoveRowButtonEnabled = true; - } - else if (SelectedDataGridRows.Count > 1) - IsRemoveRowButtonEnabled = true; - } - - public void SetAudioProjectViewerLabel(string label) - { - AudioProjectViewerLabel = $"Audio Project Viewer {label}"; - } - - public void ResetAudioProjectViewerLabel() - { - AudioProjectViewerLabel = $"Audio Project Viewer"; - } - - public void ResetButtonEnablement() - { - IsUpdateRowButtonEnabled = false; - IsRemoveRowButtonEnabled = false; - } - - public void ResetDataGrid() - { - DataGridHelpers.ClearDataGridColumns(DataGridHelpers.GetDataGridByTag(AudioProjectViewerDataGridTag)); - DataGridHelpers.ClearDataGrid(AudioProjectViewerDataGrid); - } - - public void Close() { } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/ActionEventDataGridService.cs b/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/ActionEventDataGridService.cs deleted file mode 100644 index a2129c0f5..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/ActionEventDataGridService.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Collections.Generic; -using System.Windows.Controls; -using Editors.Audio.AudioEditor.AudioProjectData; -using Editors.Audio.AudioEditor.DataGrids; - -namespace Editors.Audio.AudioEditor.AudioProjectViewer.DataGrid -{ - public class ActionEventDataGridService : IAudioProjectViewerDataGridService - { - private readonly IAudioEditorService _audioEditorService; - - public ActionEventDataGridService(IAudioEditorService audioEditorService) - { - _audioEditorService = audioEditorService; - } - - public void LoadDataGrid() - { - ConfigureDataGrid(); - SetDataGridData(); - } - - public void ConfigureDataGrid() - { - var dataGrid = DataGridConfiguration.InitialiseDataGrid(_audioEditorService.AudioProjectViewerViewModel.AudioProjectViewerDataGridTag); - - var columnsCount = 2; - var columnWidth = 1.0 / columnsCount; - - var eventColumn = DataGridConfiguration.CreateColumn(_audioEditorService.AudioEditorViewModel, DataGridConfiguration.EventNameColumn, columnWidth, DataGridColumnType.ReadOnlyTextBlock); - dataGrid.Columns.Add(eventColumn); - } - - public void SetDataGridData() - { - var soundBank = AudioProjectHelpers.GetSoundBankFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - foreach (var actionEvent in soundBank.ActionEvents) - { - var rowData = new Dictionary - { - { DataGridConfiguration.EventNameColumn, actionEvent.Name } - }; - _audioEditorService.GetViewerDataGrid().Add(rowData); - } - } - - public void InsertDataGridRow() - { - var editorRow = _audioEditorService.GetEditorDataGrid()[0]; - var rowData = new Dictionary - { - { DataGridConfiguration.EventNameColumn, AudioProjectHelpers.GetActionEventName(editorRow) } - }; - - DataGridHelpers.InsertRowAlphabetically(_audioEditorService.GetViewerDataGrid(), rowData); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/AudioProjectViewerDataGridServiceFactory.cs b/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/AudioProjectViewerDataGridServiceFactory.cs deleted file mode 100644 index 26c79c133..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/AudioProjectViewerDataGridServiceFactory.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Editors.Audio.AudioEditor.AudioProjectExplorer; -using Editors.Audio.Storage; - -namespace Editors.Audio.AudioEditor.AudioProjectViewer.DataGrid -{ - public class AudioProjectViewerDataGridServiceFactory - { - private readonly IAudioEditorService _audioEditorService; - private readonly IAudioRepository _audioRepository; - - public AudioProjectViewerDataGridServiceFactory(IAudioEditorService audioEditorService, IAudioRepository audioRepositry) - { - _audioEditorService = audioEditorService; - _audioRepository = audioRepositry; - } - - public IAudioProjectViewerDataGridService GetService(NodeType nodeType) - { - return nodeType switch - { - NodeType.ActionEventSoundBank => new ActionEventDataGridService(_audioEditorService), - NodeType.DialogueEvent => new DialogueEventDataGridService(_audioEditorService, _audioRepository), - NodeType.StateGroup => new StateGroupDataGridService(_audioEditorService), - _ => throw new System.NotImplementedException($"No service defined for node type {nodeType}") - }; - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/DialogueEventDataGridService.cs b/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/DialogueEventDataGridService.cs deleted file mode 100644 index e00777933..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/DialogueEventDataGridService.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Editors.Audio.AudioEditor.AudioProjectData; -using Editors.Audio.AudioEditor.DataGrids; -using Editors.Audio.Storage; - -namespace Editors.Audio.AudioEditor.AudioProjectViewer.DataGrid -{ - public class DialogueEventDataGridService : IAudioProjectViewerDataGridService - { - private readonly IAudioEditorService _audioEditorService; - private readonly IAudioRepository _audioRepository; - - public DialogueEventDataGridService(IAudioEditorService audioEditorService, IAudioRepository audioRepository) - { - _audioEditorService = audioEditorService; - _audioRepository = audioRepository; - } - - public void LoadDataGrid() - { - ConfigureDataGrid(); - SetDataGridData(); - } - - public void ConfigureDataGrid() - { - var dataGrid = DataGridConfiguration.InitialiseDataGrid(_audioEditorService.AudioProjectViewerViewModel.AudioProjectViewerDataGridTag); - DataGridConfiguration.CreateContextMenu(_audioEditorService.AudioEditorViewModel, dataGrid); - - var dialogueEvent = AudioProjectHelpers.GetDialogueEventFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - - var stateGroupsCount = _audioRepository.StateGroupsLookupByDialogueEvent[dialogueEvent.Name].Count; - var columnWidth = 1.0 / (1 + stateGroupsCount); - - var stateGroupsWithQualifiers = _audioRepository.QualifiedStateGroupLookupByStateGroupByDialogueEvent[dialogueEvent.Name]; - foreach (var stateGroupWithQualifier in stateGroupsWithQualifiers) - { - var stateGroupColumnHeader = DataGridHelpers.AddExtraUnderscoresToString(stateGroupWithQualifier.Key); - var stateGroupColumn = DataGridConfiguration.CreateColumn(_audioEditorService.AudioEditorViewModel, stateGroupColumnHeader, columnWidth, DataGridColumnType.ReadOnlyTextBlock); - dataGrid.Columns.Add(stateGroupColumn); - } - } - - public void SetDataGridData() - { - var dialogueEvent = AudioProjectHelpers.GetDialogueEventFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - var stateGroupsWithQualifiers = _audioRepository.QualifiedStateGroupLookupByStateGroupByDialogueEvent[dialogueEvent.Name]; - - foreach (var statePath in dialogueEvent.StatePaths) - ProcessStatePathData(stateGroupsWithQualifiers, statePath); - } - - private void ProcessStatePathData(Dictionary stateGroupsWithQualifiers, StatePath statePath) - { - var rowData = new Dictionary(); - - foreach (var stateGroupWithQualifier in stateGroupsWithQualifiers) - { - var stateGroupColumnHeader = DataGridHelpers.AddExtraUnderscoresToString(stateGroupWithQualifier.Key); - var node = statePath.Nodes.FirstOrDefault(node => node.StateGroup.Name == stateGroupWithQualifier.Value); - if (node != null) - rowData[stateGroupColumnHeader] = node.State.Name; - else - rowData[stateGroupColumnHeader] = string.Empty; - } - - _audioEditorService.GetViewerDataGrid().Add(rowData); - } - - public void InsertDataGridRow() - { - DataGridHelpers.InsertRowAlphabetically(_audioEditorService.GetViewerDataGrid(), _audioEditorService.GetEditorDataGrid()[0]); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/IAudioProjectViewerDataGridService.cs b/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/IAudioProjectViewerDataGridService.cs deleted file mode 100644 index 8fb35083c..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/IAudioProjectViewerDataGridService.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Editors.Audio.AudioEditor.AudioProjectViewer.DataGrid -{ - public interface IAudioProjectViewerDataGridService - { - public void LoadDataGrid(); - public void ConfigureDataGrid(); - public void SetDataGridData(); - public void InsertDataGridRow(); - } -} diff --git a/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/StateGroupDataGridService.cs b/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/StateGroupDataGridService.cs deleted file mode 100644 index 5484fc753..000000000 --- a/Editors/Audio/AudioEditor/AudioProjectViewer/DataGrid/StateGroupDataGridService.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections.Generic; -using Editors.Audio.AudioEditor.AudioProjectData; -using Editors.Audio.AudioEditor.DataGrids; - -namespace Editors.Audio.AudioEditor.AudioProjectViewer.DataGrid -{ - public class StateGroupDataGridService : IAudioProjectViewerDataGridService - { - private readonly IAudioEditorService _audioEditorService; - - public StateGroupDataGridService(IAudioEditorService audioEditorService) - { - _audioEditorService = audioEditorService; - } - - public void LoadDataGrid() - { - ConfigureDataGrid(); - SetDataGridData(); - } - - public void ConfigureDataGrid() - { - var dataGrid = DataGridConfiguration.InitialiseDataGrid(_audioEditorService.AudioProjectViewerViewModel.AudioProjectViewerDataGridTag); - var stateGroup = AudioProjectHelpers.GetStateGroupFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - var stateGroupColumn = DataGridConfiguration.CreateColumn(_audioEditorService.AudioEditorViewModel, DataGridHelpers.AddExtraUnderscoresToString(stateGroup.Name), 1.0, DataGridColumnType.ReadOnlyTextBlock); - dataGrid.Columns.Add(stateGroupColumn); - } - - public void SetDataGridData() - { - var stateGroup = AudioProjectHelpers.GetStateGroupFromName(_audioEditorService, _audioEditorService.GetSelectedExplorerNode().Name); - foreach (var state in stateGroup.States) - { - var dataGridRow = new Dictionary(); - dataGridRow[DataGridHelpers.AddExtraUnderscoresToString(stateGroup.Name)] = state.Name; - _audioEditorService.GetViewerDataGrid().Add(dataGridRow); - } - } - - public void InsertDataGridRow() - { - DataGridHelpers.InsertRowAlphabetically(_audioEditorService.GetViewerDataGrid(), _audioEditorService.GetEditorDataGrid()[0]); - } - } -} diff --git a/Editors/Audio/AudioEditor/AudioSettings/AudioFile.cs b/Editors/Audio/AudioEditor/AudioSettings/AudioFile.cs deleted file mode 100644 index 739254fd1..000000000 --- a/Editors/Audio/AudioEditor/AudioSettings/AudioFile.cs +++ /dev/null @@ -1,10 +0,0 @@ -using CommunityToolkit.Mvvm.ComponentModel; - -namespace Editors.Audio.AudioEditor.AudioSettings -{ - public partial class AudioFile : ObservableObject - { - [ObservableProperty] public string _fileName; - [ObservableProperty] public string _filePath; - } -} diff --git a/Editors/Audio/AudioEditor/AudioSettings/AudioSettings.cs b/Editors/Audio/AudioEditor/AudioSettings/AudioSettings.cs deleted file mode 100644 index 1a655e3f8..000000000 --- a/Editors/Audio/AudioEditor/AudioSettings/AudioSettings.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System.Collections.Generic; - -namespace Editors.Audio.AudioEditor.AudioSettings -{ - public class AudioSettings - { - public enum PlaylistType - { - Random, - RandomExhaustive, - Sequence - } - - public const string Random = "Random"; - public const string RandomExhaustive = "Random Exhaustive"; - public const string Sequence = "Sequence"; - - public static Dictionary PlaylistTypeStringLookup { get; } = new() - { - { PlaylistType.Random, Random }, - { PlaylistType.RandomExhaustive, RandomExhaustive }, - { PlaylistType.Sequence, Sequence } - }; - - public enum PlaylistMode - { - Step, - Continuous - } - - public const string Step = "Step"; - public const string Continous = "Continuous"; - - public static Dictionary PlaylistModeStringLookup { get; } = new() - { - { PlaylistMode.Continuous, Continous }, - { PlaylistMode.Step, Step } - }; - - public enum EndBehaviour - { - Restart, - PlayInReverseOrder - } - - public const string Restart = "Restart"; - public const string PlayInReverseOrder = "Play In Reverse Order"; - - public static Dictionary EndBehaviourStringLookup { get; } = new() - { - { EndBehaviour.Restart, Restart }, - { EndBehaviour.PlayInReverseOrder, PlayInReverseOrder} - }; - - public enum LoopingType - { - Disabled, - FiniteLooping, - InfiniteLooping, - } - - public const string LoopingTypeDisabled = "Disabled"; - public const string FiniteLooping = "Finite Looping"; - public const string InfiniteLooping = "Infinite Looping"; - - public static Dictionary LoopingTypeStringLookup { get; } = new() - { - { LoopingType.Disabled, LoopingTypeDisabled }, - { LoopingType.FiniteLooping, FiniteLooping }, - { LoopingType.InfiniteLooping, InfiniteLooping } - }; - - public enum TransitionType - { - Disabled, - XfadeAmp, - XfadePower, - Delay, - SampleAccurate, - TriggerRate - } - - public const string TransitionTypeDisabled = "Disabled"; - public const string XfadeAmp = "Xfade (amp)"; - public const string XfadePower = "Xfade (power)"; - public const string Delay = "Delay"; - public const string SampleAccurate = "Sample Accurate"; - public const string TriggerRate = "Trigger Rate"; - - public static Dictionary TransitionTypeStringLookup { get; } = new() - { - { TransitionType.Disabled, TransitionTypeDisabled }, - { TransitionType.XfadeAmp, XfadeAmp }, - { TransitionType.XfadePower, XfadePower }, - { TransitionType.Delay, Delay }, - { TransitionType.SampleAccurate, SampleAccurate }, - { TransitionType.TriggerRate, TriggerRate } - }; - } -} diff --git a/Editors/Audio/AudioEditor/AudioSettings/AudioSettingsView.xaml b/Editors/Audio/AudioEditor/AudioSettings/AudioSettingsView.xaml deleted file mode 100644 index 6f5190a14..000000000 --- a/Editors/Audio/AudioEditor/AudioSettings/AudioSettingsView.xaml +++ /dev/null @@ -1,421 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -