From a9386e95940eaceb8de7a743ea22f0bd0ec0f4de Mon Sep 17 00:00:00 2001 From: Masusder <59669685+Masusder@users.noreply.github.com> Date: Mon, 21 Sep 2026 20:09:27 +0200 Subject: [PATCH] Massively improved folder tree navigation performance Global search jump to asset should now be instantaneous PUBG/ABI/Conan Exiles Enhanced update, New Gundam Breaker/Destroy All Humans 2 Reprobed support, Delta Force/Roco/Splitgate2 fixes Co-Authored-By: LongerWarrior <37636768+LongerWarrior@users.noreply.github.com> Co-Authored-By: Adain Rivers <93623214+adainrivers@users.noreply.github.com> Co-Authored-By: Abishek <73873078+Abishek82828@users.noreply.github.com> Co-Authored-By: Valentin <26126862+4sval@users.noreply.github.com> Co-Authored-By: Mao <60669781+hexaov91@users.noreply.github.com> Co-Authored-By: Luke <17146677+LukeFZ@users.noreply.github.com> --- CUE4Parse | 2 +- FModel/Extensions/ListBoxExtensions.cs | 36 + FModel/Extensions/VisualTreeExtensions.cs | 16 + FModel/Framework/RangeObservableCollection.cs | 24 +- FModel/MainWindow.xaml | 48 +- FModel/MainWindow.xaml.cs | 85 +-- FModel/ViewModels/AssetsFolderViewModel.cs | 240 ++++-- FModel/ViewModels/CUE4ParseViewModel.cs | 2 +- FModel/ViewModels/Commands/GoToCommand.cs | 56 +- FModel/ViewModels/Commands/LoadCommand.cs | 2 +- FModel/ViewModels/Commands/MenuCommand.cs | 53 +- .../Resources/Controls/Breadcrumb.xaml.cs | 2 +- .../Controls/Explorer/Resources.xaml | 2 +- .../Controls/Explorer/Resources.xaml.cs | 16 +- FModel/Views/Resources/Controls/FolderTree.cs | 158 ++++ .../Controls/TreeViewItemBehavior.cs | 41 - .../Converters/FolderTreeIconConverter.cs | 57 ++ FModel/Views/Resources/Resources.xaml | 702 ++++++------------ FModel/Views/SearchView.xaml.cs | 39 +- 19 files changed, 838 insertions(+), 743 deletions(-) create mode 100644 FModel/Extensions/ListBoxExtensions.cs create mode 100644 FModel/Views/Resources/Controls/FolderTree.cs delete mode 100644 FModel/Views/Resources/Controls/TreeViewItemBehavior.cs create mode 100644 FModel/Views/Resources/Converters/FolderTreeIconConverter.cs diff --git a/CUE4Parse b/CUE4Parse index 6409f38e..cfff57a0 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 6409f38e09e2a21aa839cd77b4515bca6c66f280 +Subproject commit cfff57a0483501e0fa555dff5bf542748afe0bab diff --git a/FModel/Extensions/ListBoxExtensions.cs b/FModel/Extensions/ListBoxExtensions.cs new file mode 100644 index 00000000..8bcb2b17 --- /dev/null +++ b/FModel/Extensions/ListBoxExtensions.cs @@ -0,0 +1,36 @@ +using System.Windows.Controls; + +namespace FModel.Extensions; + +public static class ListBoxExtensions +{ + public static ListBoxItem RevealItem(this ListBox list, object item, bool alignToTop = false) + { + var index = list.Items.IndexOf(item); + if (index < 0) + return null; + + list.ApplyTemplate(); + list.UpdateLayout(); + if (alignToTop && list.FindVisualChild() is { } scroll) + { + scroll.ScrollToVerticalOffset(index); + list.UpdateLayout(); + } + + if (list.FindVisualChild() is { } panel) + { + panel.BringIndexIntoViewPublic(index); + } + else + { + list.ScrollIntoView(item); + } + + list.UpdateLayout(); + var container = list.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem; + container?.BringIntoView(); + list.UpdateLayout(); + return container; + } +} diff --git a/FModel/Extensions/VisualTreeExtensions.cs b/FModel/Extensions/VisualTreeExtensions.cs index 1a54a808..4072a552 100644 --- a/FModel/Extensions/VisualTreeExtensions.cs +++ b/FModel/Extensions/VisualTreeExtensions.cs @@ -17,4 +17,20 @@ public static class VisualTreeExtensions } return null; } + + public static T? FindVisualChild(this DependencyObject parent) where T : DependencyObject + { + for (var i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++) + { + var child = VisualTreeHelper.GetChild(parent, i); + if (child is T result) + return result; + + if (FindVisualChild(child) is { } descendant) + return descendant; + } + + return null; + } + } diff --git a/FModel/Framework/RangeObservableCollection.cs b/FModel/Framework/RangeObservableCollection.cs index cf0b5261..3bdc5034 100644 --- a/FModel/Framework/RangeObservableCollection.cs +++ b/FModel/Framework/RangeObservableCollection.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; +using System.ComponentModel; namespace FModel.Framework; @@ -17,8 +18,7 @@ public sealed class RangeObservableCollection : ObservableCollection public void AddRange(IEnumerable list) { - if (list == null) - throw new ArgumentNullException(nameof(list)); + ArgumentNullException.ThrowIfNull(list); _suppressNotification = true; @@ -29,6 +29,24 @@ public sealed class RangeObservableCollection : ObservableCollection OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } + public void ReplaceRange(IEnumerable collection) + { + ArgumentNullException.ThrowIfNull(collection); + + var items = collection as IList ?? [.. collection]; + + CheckReentrancy(); + + Items.Clear(); + + foreach (var item in items) + Items.Add(item); + + OnPropertyChanged(new PropertyChangedEventArgs(nameof(Count))); + OnPropertyChanged(new PropertyChangedEventArgs("Item[]")); + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); + } + public void SetSuppressionState(bool state) { _suppressNotification = state; @@ -38,4 +56,4 @@ public sealed class RangeObservableCollection : ObservableCollection { OnCollectionChanged(new NotifyCollectionChangedEventArgs(changedAction)); } -} \ No newline at end of file +} diff --git a/FModel/MainWindow.xaml b/FModel/MainWindow.xaml index 53048aa6..614b866e 100644 --- a/FModel/MainWindow.xaml +++ b/FModel/MainWindow.xaml @@ -344,16 +344,16 @@ - - - + + +