Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ private void AddTableRow(DataRow row)
else
Table.ImportRow(row);

if (Table.Rows.Count != 1)
throw new Exception("There must only be one row in the Editor table.");

var selectedAudioProjectExplorerNode = _audioEditorStateService.SelectedAudioProjectExplorerNode;
_logger.Here().Information($"Added {selectedAudioProjectExplorerNode.Type} row to Audio Project Editor table for {selectedAudioProjectExplorerNode.Name} ");
}
Expand Down Expand Up @@ -172,8 +175,8 @@ private void AddDataGridColumns(DataGridColumn column)

private void OnEditorTableRowAddedToViewer(EditorTableRowAddedToViewerEvent e)
{
// Clear table to ensure there's only one row
Table.Clear();
// Clear rows to ensure there will only one row
Table.Rows.Clear();

// Re-initialise table
var selectedAudioProjectExplorerNode = _audioEditorStateService.SelectedAudioProjectExplorerNode;
Expand All @@ -186,8 +189,8 @@ private void OnEditorTableRowAddedToViewer(EditorTableRowAddedToViewerEvent e)

private void OnViewerTableRowEdited(ViewerTableRowEditedEvent e)
{
// Clear table to ensure there's only one row
Table.Clear();
// Clear rows to ensure there will only one row
Table.Rows.Clear();

_eventHub.Publish(new EditorTableRowAddRequestedEvent(e.Row));
}
Expand Down Expand Up @@ -286,7 +289,9 @@ partial void OnShowModdedStatesOnlyChanged(bool value)
var selectedAudioProjectExplorerNode = _audioEditorStateService.SelectedAudioProjectExplorerNode;
if (selectedAudioProjectExplorerNode.IsDialogueEvent())
{
Table.Clear();
ResetTable();

// Reload the table from scratch because ComboBoxes values can't be updated
LoadTable(selectedAudioProjectExplorerNode.Type);
}
}
Expand Down Expand Up @@ -393,8 +398,11 @@ private void SetShowModdedStatesOnlyButtonEnablementAndVisibility()
}

private void ResetTable()
{
Table = new DataTable();
{
// Table.Clear() only removes the rows, so we need to do Table.Columns.Clear() to clear it fully. If we don't clear the table properly
// it leads to issues where e.g. a Dialogue Event may reference a table from a previous Dialogue Event with different State Groups.
Table.Clear();
Table.Columns.Clear();
DataGridColumns.Clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,10 @@ public void ResetContextMenuVisibility()

public void ResetTable()
{
// Table.Clear() only removes the rows, so we need to do Table.Columns.Clear() to clear it fully. If we don't clear the table properly
// it leads to issues where e.g. a Dialogue Event may reference a table from a previous Dialogue Event with different State Groups.
Table.Clear();
Table.Columns.Clear();
DataGridColumns.Clear();
SelectedRows = [];
}
Expand Down
Loading