Skip to content

Commit 5d82e9d

Browse files
authored
v2.3.0 (#18)
1 parent c38c90d commit 5d82e9d

146 files changed

Lines changed: 5137 additions & 447 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Packages/AudioConductor/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## v2.3.0 - 2026/06/05
4+
5+
- New Features
6+
- CueSheet validation window for detecting asset configuration issues
7+
38
## v2.2.0 - 2026/05/19
49

510
- New Features

Packages/AudioConductor/Editor/Core/Tools/CodeGen/CueEnumDefinitionEditorWindow.cs

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ internal sealed class CueEnumDefinitionEditorWindow : EditorWindow
4646
// UI elements
4747
private ObjectField? _definitionField;
4848
private VisualElement? _emptyInspectorHelpBox;
49-
private TextField? _excludePathRuleField;
5049
private VisualElement? _excludedInspector;
50+
private TextField? _excludePathRuleField;
5151
private VisualElement? _fileEntryInspector;
5252
private TextField? _fileNameField;
5353
private Button? _generateButton;
@@ -305,7 +305,7 @@ private void OnTreeViewGUI()
305305
_treeView.OnGUI(rect);
306306

307307
var e = Event.current;
308-
if (GetEventAction(e) && e.type == EventType.KeyDown)
308+
if (EventExtensions.GetEventAction(e) && e.type == EventType.KeyDown)
309309
{
310310
if (e.keyCode == UndoKey)
311311
{
@@ -621,10 +621,10 @@ private void UpdateInspector()
621621
var showExcluded = _selectedItem is ExcludedHeaderTreeItem;
622622
var showAsset = _selectedItem is CueSheetAssetTreeItem;
623623

624-
SetDisplay(_emptyInspectorHelpBox, showEmpty);
625-
SetDisplay(_fileEntryInspector, showFileEntry);
626-
SetDisplay(_excludedInspector, showExcluded);
627-
SetDisplay(_assetInspector, showAsset);
624+
_emptyInspectorHelpBox.SetDisplay(showEmpty);
625+
_fileEntryInspector.SetDisplay(showFileEntry);
626+
_excludedInspector.SetDisplay(showExcluded);
627+
_assetInspector.SetDisplay(showAsset);
628628

629629
_removeButton?.SetEnabled(_selectedItem is not (null or ExcludedHeaderTreeItem));
630630

@@ -826,12 +826,6 @@ private void MarkDirtyAndSave()
826826
AssetDatabase.SaveAssets();
827827
}
828828

829-
private static void SetDisplay(VisualElement? element, bool visible)
830-
{
831-
if (element != null)
832-
element.style.display = visible ? DisplayStyle.Flex : DisplayStyle.None;
833-
}
834-
835829
private void ApplyTooltips()
836830
{
837831
// Default Settings
@@ -879,13 +873,13 @@ private void ApplyTooltips()
879873

880874
private void HandleKeyDownEvent(KeyDownEvent e)
881875
{
882-
if (GetEventAction(e) && e.keyCode == UndoKey)
876+
if (EventExtensions.GetEventAction(e) && e.keyCode == UndoKey)
883877
{
884878
PerformUndo();
885879
e.StopPropagation();
886880
}
887881

888-
if (GetEventAction(e) && e.keyCode == RedoKey)
882+
if (EventExtensions.GetEventAction(e) && e.keyCode == RedoKey)
889883
{
890884
PerformRedo();
891885
e.StopPropagation();
@@ -902,24 +896,6 @@ private void PerformRedo()
902896
_history.Redo();
903897
}
904898

905-
private static bool GetEventAction(Event e)
906-
{
907-
#if UNITY_EDITOR_WIN
908-
return e.control;
909-
#else
910-
return e.command;
911-
#endif
912-
}
913-
914-
private static bool GetEventAction(IKeyboardEvent e)
915-
{
916-
#if UNITY_EDITOR_WIN
917-
return e.ctrlKey;
918-
#else
919-
return e.commandKey;
920-
#endif
921-
}
922-
923899
private void OnLanguageChanged()
924900
{
925901
ApplyTooltips();

Packages/AudioConductor/Editor/Core/Tools/CueSheetEditor/CueSheetAssetEditorWindow.cs

Lines changed: 59 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
using AudioConductor.Editor.Core.Tools.CueSheetEditor.Presenters;
1212
using AudioConductor.Editor.Core.Tools.CueSheetEditor.Views;
1313
using AudioConductor.Editor.Core.Tools.Shared;
14+
using AudioConductor.Editor.Core.Tools.Validation;
1415
using AudioConductor.Editor.Foundation.TinyRx;
1516
using UnityEditor;
17+
using UnityEditor.UIElements;
1618
using UnityEngine;
1719
using UnityEngine.UIElements;
1820

@@ -22,7 +24,6 @@ internal sealed class CueSheetAssetEditorWindow : EditorWindow
2224
{
2325
private const KeyCode UndoKey = KeyCode.Z;
2426
private const KeyCode RedoKey = KeyCode.Y;
25-
private const string SelectedSettingsGuidPrefKey = "AudioConductor.SelectedSettingsGuid";
2627

2728
private static MethodInfo? _addTabMethod;
2829
private static bool _addTabMethodResolved;
@@ -33,7 +34,9 @@ internal sealed class CueSheetAssetEditorWindow : EditorWindow
3334
private readonly CompositeDisposable _disposable = new();
3435

3536
private CueSheetEditorPresenter _cueSheetEditorPresenter = null!;
37+
private string? _pendingFocusCueEditorId;
3638
private DropdownField? _settingsDropdown;
39+
private ToolbarButton? _validateButton;
3740

3841
private void OnEnable()
3942
{
@@ -49,13 +52,13 @@ private void OnGUI()
4952
{
5053
var e = Event.current;
5154

52-
if (GetEventAction(e) && e.type == EventType.KeyDown && e.keyCode == UndoKey)
55+
if (EventExtensions.GetEventAction(e) && e.type == EventType.KeyDown && e.keyCode == UndoKey)
5356
{
5457
_target.Undo();
5558
e.Use();
5659
}
5760

58-
if (GetEventAction(e) && e.type == EventType.KeyDown && e.keyCode == RedoKey)
61+
if (EventExtensions.GetEventAction(e) && e.type == EventType.KeyDown && e.keyCode == RedoKey)
5962
{
6063
_target.Redo();
6164
e.Use();
@@ -87,7 +90,17 @@ private void CreateGUI()
8790
_settingsDropdown = rootVisualElement.Q<DropdownField>("SettingsDropdown");
8891
_settingsDropdown.RegisterValueChangedCallback(_ => ApplySelectedSettings());
8992

93+
_validateButton = rootVisualElement.Q<ToolbarButton>("ValidateButton");
94+
if (_validateButton is not null)
95+
_validateButton.clicked += OnValidateClicked;
96+
9097
RefreshSettingsDropdown();
98+
99+
if (_pendingFocusCueEditorId is not null)
100+
{
101+
_cueSheetEditorPresenter.FocusCue(_pendingFocusCueEditorId);
102+
_pendingFocusCueEditorId = null;
103+
}
91104
}
92105

93106
private void OnFocus()
@@ -103,19 +116,33 @@ private void OnFocus()
103116
}
104117

105118
public static void Open(CueSheetAsset cueSheetAsset)
119+
{
120+
OpenOrCreate(cueSheetAsset, null);
121+
}
122+
123+
internal static void OpenWithFocus(CueSheetAsset cueSheetAsset, string? cueEditorId)
124+
{
125+
OpenOrCreate(cueSheetAsset, cueEditorId);
126+
}
127+
128+
private static void OpenOrCreate(CueSheetAsset cueSheetAsset, string? cueEditorId)
106129
{
107130
var openedWindows = Resources.FindObjectsOfTypeAll<CueSheetAssetEditorWindow>();
108131
var sameCueSheetWindow =
109132
openedWindows.FirstOrDefault(window => window._target.CueSheetId == cueSheetAsset.cueSheet.Id);
110133
if (sameCueSheetWindow != null)
111134
{
112135
sameCueSheetWindow.Focus();
136+
if (cueEditorId is not null)
137+
sameCueSheetWindow._cueSheetEditorPresenter.FocusCue(cueEditorId);
113138
return;
114139
}
115140

116141
var window = CreateInstance<CueSheetAssetEditorWindow>();
117142
window._target = new CueSheetAssetEditorWindowModel(cueSheetAsset);
118143
window.minSize = new Vector2(1340, 700);
144+
if (cueEditorId is not null)
145+
window._pendingFocusCueEditorId = cueEditorId;
119146

120147
var existingWindow = openedWindows.FirstOrDefault();
121148
if (existingWindow != null && TryAddTab(existingWindow, window))
@@ -155,30 +182,40 @@ private void Cleanup()
155182
{
156183
rootVisualElement.UnregisterCallback<KeyDownEvent>(HandleKeyDownEvent);
157184

185+
if (_validateButton is not null)
186+
_validateButton.clicked -= OnValidateClicked;
187+
158188
_disposable.Clear();
159189

160-
_cueSheetEditorPresenter?.Dispose();
190+
_cueSheetEditorPresenter.Dispose();
191+
}
192+
193+
private void OnValidateClicked()
194+
{
195+
CueSheetValidationWindow.Open(new[] { _target.Asset }, ValidationScope.Selected);
161196
}
162197

163198
private void RefreshSettingsDropdown()
164199
{
165200
_settingsDropdown ??= rootVisualElement?.Q<DropdownField>("SettingsDropdown");
166201

167202
var allSettings = AudioConductorSettingsRepository.instance.AllSettings;
168-
if (allSettings == null || allSettings.Length == 0)
203+
switch (allSettings.Length)
169204
{
170-
if (_settingsDropdown != null)
171-
_settingsDropdown.style.display = DisplayStyle.None;
172-
return;
173-
}
174-
175-
if (allSettings.Length == 1)
176-
{
177-
if (_settingsDropdown != null)
178-
_settingsDropdown.style.display = DisplayStyle.None;
179-
_selectedSettingsGuid =
180-
AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(allSettings[0]));
181-
return;
205+
case 0:
206+
{
207+
if (_settingsDropdown != null)
208+
_settingsDropdown.style.display = DisplayStyle.None;
209+
return;
210+
}
211+
case 1:
212+
{
213+
if (_settingsDropdown != null)
214+
_settingsDropdown.style.display = DisplayStyle.None;
215+
_selectedSettingsGuid =
216+
AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(allSettings[0]));
217+
return;
218+
}
182219
}
183220

184221
var choices = allSettings.Select(s => s != null ? s.name : "(Missing)").ToList();
@@ -187,7 +224,7 @@ private void RefreshSettingsDropdown()
187224
var index = FindSettingsIndex(allSettings, _selectedSettingsGuid);
188225
if (index < 0)
189226
index = FindSettingsIndex(allSettings,
190-
EditorPrefs.GetString(SelectedSettingsGuidPrefKey, string.Empty));
227+
EditorPrefs.GetString(EditorPrefsKeys.SelectedSettingsGuid, string.Empty));
191228
if (index < 0)
192229
index = 0;
193230

@@ -217,7 +254,7 @@ private static int FindSettingsIndex(AudioConductorSettings[] allSettings, strin
217254
private void ApplySelectedSettings()
218255
{
219256
var allSettings = AudioConductorSettingsRepository.instance.AllSettings;
220-
if (_settingsDropdown == null || allSettings == null)
257+
if (_settingsDropdown == null)
221258
return;
222259

223260
var index = _settingsDropdown.index;
@@ -232,43 +269,25 @@ private void ApplySelectedSettings()
232269
var assetPath = AssetDatabase.GetAssetPath(selected);
233270
var guid = AssetDatabase.AssetPathToGUID(assetPath);
234271
_selectedSettingsGuid = guid;
235-
EditorPrefs.SetString(SelectedSettingsGuidPrefKey, guid);
272+
EditorPrefs.SetString(EditorPrefsKeys.SelectedSettingsGuid, guid);
236273
}
237274

238275
CategoryListRepository.instance.Refresh(selected);
239276
}
240277

241-
private static bool GetEventAction(Event e)
242-
{
243-
#if UNITY_EDITOR_WIN
244-
return e.control;
245-
#else
246-
return e.command;
247-
#endif
248-
}
249-
250278
private void HandleKeyDownEvent(KeyDownEvent e)
251279
{
252-
if (GetEventAction(e) && e.keyCode == UndoKey)
280+
if (EventExtensions.GetEventAction(e) && e.keyCode == UndoKey)
253281
{
254282
_target.Undo();
255283
e.StopPropagation();
256284
}
257285

258-
if (GetEventAction(e) && e.keyCode == RedoKey)
286+
if (EventExtensions.GetEventAction(e) && e.keyCode == RedoKey)
259287
{
260288
_target.Redo();
261289
e.StopPropagation();
262290
}
263291
}
264-
265-
private static bool GetEventAction(IKeyboardEvent e)
266-
{
267-
#if UNITY_EDITOR_WIN
268-
return e.ctrlKey;
269-
#else
270-
return e.commandKey;
271-
#endif
272-
}
273292
}
274293
}

Packages/AudioConductor/Editor/Core/Tools/CueSheetEditor/Models/CueListEditorPaneModel.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
using System;
88
using System.Collections.Generic;
9-
using System.Diagnostics.CodeAnalysis;
109
using AudioConductor.Core.Models;
1110
using AudioConductor.Editor.Core.Tools.CueSheetEditor.Models.Interfaces;
1211
using AudioConductor.Editor.Core.Tools.CueSheetEditor.Views;
@@ -18,9 +17,9 @@ namespace AudioConductor.Editor.Core.Tools.CueSheetEditor.Models
1817
{
1918
internal sealed class CueListEditorPaneModel : ICueListEditorPaneModel
2019
{
21-
public CueListEditorPaneModel([NotNull] CueSheet cueSheet,
22-
[NotNull] AutoIncrementHistory history,
23-
[NotNull] IAssetSaveService assetSaveService,
20+
public CueListEditorPaneModel(CueSheet cueSheet,
21+
AutoIncrementHistory history,
22+
IAssetSaveService assetSaveService,
2423
IObservableProperty<bool> inspectorUnCollapsed,
2524
CueListTreeView.State cueListTreeViewState,
2625
Func<AudioConductorSettings?>? settingsProvider = null)
@@ -39,5 +38,18 @@ public CueListEditorPaneModel([NotNull] CueSheet cueSheet,
3938
public IReadOnlyCollection<int> VisibleColumns { get; }
4039

4140
public string SearchString { get; }
41+
42+
public int FindItemIdByCueEditorId(string cueEditorId)
43+
{
44+
var root = CueListModel.Root;
45+
if (root.children is null)
46+
return -1;
47+
48+
foreach (var child in root.children)
49+
if (child is CueListItem item && item.TargetId == cueEditorId)
50+
return item.id;
51+
52+
return -1;
53+
}
4254
}
4355
}

Packages/AudioConductor/Editor/Core/Tools/CueSheetEditor/Models/CueSheetAssetEditorWindowModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public CueSheetAssetEditorWindowModel(CueSheetAsset cueSheetAsset)
4242
}
4343

4444
public string CueSheetId => _target.cueSheet.Id;
45+
public CueSheetAsset Asset => _target;
4546

4647
public ICueSheetEditorModel CueSheetEditorModel { get; private set; } = null!;
4748

Packages/AudioConductor/Editor/Core/Tools/CueSheetEditor/Models/Interfaces/ICueListEditorPaneModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ internal interface ICueListEditorPaneModel
1818
IReadOnlyCollection<int> VisibleColumns { get; }
1919

2020
string SearchString { get; }
21+
22+
int FindItemIdByCueEditorId(string cueEditorId);
2123
}
2224
}

0 commit comments

Comments
 (0)