Skip to content

Commit

Permalink
experimental: faster data explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
wavebend committed Dec 1, 2024
1 parent 550ceed commit 885d99b
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 103 deletions.
40 changes: 20 additions & 20 deletions FrostyEditor/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private void FrostyWindow_Loaded(object sender, EventArgs e)
{
NewProject();

UpdateUI(true);
InitialUILoad();
}
}
}
Expand Down Expand Up @@ -474,29 +474,31 @@ private static bool SelectProfile(string profile)
return result;
}

private void UpdateUI(bool newProject = false)
private void InitialUILoad()
{
if (m_project.RequiresNewProfile || newProject)
{
LoadedPluginsList.ItemsSource = App.PluginManager.LoadedPlugins;
LoadedPluginsList.ItemsSource = App.PluginManager.LoadedPlugins;

LoadPluginExtensions();
LoadPluginExtensions();

dataExplorer.ItemsSource = App.AssetManager.EnumerateEbx();
legacyExplorer.ItemsSource = App.AssetManager.EnumerateCustomAssets("legacy");
}
else
{
dataExplorer.RefreshItems();
legacyExplorer.RefreshItems();
}
dataExplorer.ItemsSource = App.AssetManager.EnumerateEbx();
legacyExplorer.ItemsSource = App.AssetManager.EnumerateCustomAssets("legacy");

if(ProfilesLibrary.EnableExecution)
{
LaunchButton.IsEnabled = true;
}
}


private void ResetItemsSources()
{
if (dataExplorer.ItemsSource != null)
dataExplorer.ItemsSource = null;
if (legacyExplorer.ItemsSource != null)
legacyExplorer.ItemsSource = null;
dataExplorer.ItemsSource = App.AssetManager.EnumerateEbx();
legacyExplorer.ItemsSource = App.AssetManager.EnumerateCustomAssets("legacy");
}

private void NewProject()
{
m_autoSaveTimer?.Stop();
Expand All @@ -522,8 +524,7 @@ private void NewProject()

// clear all modifications
App.AssetManager.Reset();
dataExplorer.RefreshAll();
legacyExplorer.RefreshAll();
ResetItemsSources();

// create a new blank project
m_project = new FrostyProject();
Expand Down Expand Up @@ -644,7 +645,7 @@ private void LoadProject(string filename, bool saveProject)

m_project = newProject;

UpdateUI();
ResetItemsSources();

legacyExplorer.ShowOnlyModified = false;
legacyExplorer.ShowOnlyModified = true;
Expand Down Expand Up @@ -967,8 +968,7 @@ private void contextMenuRevert_Click(object sender, RoutedEventArgs e)

FrostyTaskWindow.Show("Reverting Asset", "", (task) => { App.AssetManager.RevertAsset(entry, suppressOnModify: false); });

dataExplorer.RefreshAll();
legacyExplorer.RefreshAll();
ResetItemsSources();
}

private void contextMenuImportAsset_Click(object sender, RoutedEventArgs e)
Expand Down
Loading

0 comments on commit 885d99b

Please sign in to comment.