From a714bb5e603ea8ae45a294b51916a62c728ba4ba Mon Sep 17 00:00:00 2001 From: Asval Date: Sat, 20 Jun 2026 16:46:51 +0200 Subject: [PATCH] re-use the export options control for the settings --- CUE4Parse | 2 +- FModel/Settings/UserSettings.cs | 9 +- ...ViewModel.cs => ExportOptionsViewModel.cs} | 8 +- FModel/ViewModels/ExportSessionViewModel.cs | 2 +- FModel/ViewModels/SettingsViewModel.cs | 124 +-------- FModel/Views/ExportSessionWindow.xaml | 256 +----------------- FModel/Views/ExportSessionWindow.xaml.cs | 16 -- .../Controls/ExportOptionsControl.xaml | 247 +++++++++++++++++ .../Controls/ExportOptionsControl.xaml.cs | 32 +++ FModel/Views/SettingsView.xaml | 202 +++----------- FModel/Views/SettingsView.xaml.cs | 2 + 11 files changed, 348 insertions(+), 552 deletions(-) rename FModel/ViewModels/{ExportSessionOptionsViewModel.cs => ExportOptionsViewModel.cs} (96%) create mode 100644 FModel/Views/Resources/Controls/ExportOptionsControl.xaml create mode 100644 FModel/Views/Resources/Controls/ExportOptionsControl.xaml.cs diff --git a/CUE4Parse b/CUE4Parse index 20f91801..3b2a6867 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 20f91801ae8b6dd7318e6fc3055f8c354b7f78ff +Subproject commit 3b2a686787bb08c28940271709897957b759a6f4 diff --git a/FModel/Settings/UserSettings.cs b/FModel/Settings/UserSettings.cs index f0883b3c..63b0fd63 100644 --- a/FModel/Settings/UserSettings.cs +++ b/FModel/Settings/UserSettings.cs @@ -61,7 +61,7 @@ namespace FModel.Settings Default.MeshQuality, Default.CurrentDir.TexturePlatform, Default.TextureExportFormat, - 100, + Default.TextureQuality, Default.SaveHdrTexturesAsHdr, Default.MaterialExportFormat, Default.SaveEmbeddedMaterials, @@ -450,6 +450,13 @@ namespace FModel.Settings set => SetProperty(ref _textureExportFormat, value); } + private int _textureQuality = 100; + public int TextureQuality + { + get => _textureQuality; + set => SetProperty(ref _textureQuality, value); + } + private ESocketFormat _socketExportFormat = ESocketFormat.Bone; public ESocketFormat SocketExportFormat { diff --git a/FModel/ViewModels/ExportSessionOptionsViewModel.cs b/FModel/ViewModels/ExportOptionsViewModel.cs similarity index 96% rename from FModel/ViewModels/ExportSessionOptionsViewModel.cs rename to FModel/ViewModels/ExportOptionsViewModel.cs index f8930ead..22e883a4 100644 --- a/FModel/ViewModels/ExportSessionOptionsViewModel.cs +++ b/FModel/ViewModels/ExportOptionsViewModel.cs @@ -10,7 +10,7 @@ using FModel.Settings; namespace FModel.ViewModels; -public class ExportSessionOptionsViewModel : ViewModel +public class ExportOptionsViewModel : ViewModel { public bool OverrideOptions { @@ -139,7 +139,7 @@ public class ExportSessionOptionsViewModel : ViewModel set => SetProperty(ref field, value); } - public ExportSessionOptionsViewModel() + public ExportOptionsViewModel() { ResetToUserDefaults(); } @@ -158,8 +158,9 @@ public class ExportSessionOptionsViewModel : ViewModel SelectedTextureFormat = UserSettings.Default.TextureExportFormat; ExportHdrTexturesAsHdr = UserSettings.Default.SaveHdrTexturesAsHdr; ExportMorphTargets = UserSettings.Default.SaveMorphTargets; - TextureQuality = 100; + TextureQuality = UserSettings.Default.TextureQuality; + OverrideOptions = false; FeedbackMessage = "Reset to defaults"; } @@ -177,6 +178,7 @@ public class ExportSessionOptionsViewModel : ViewModel UserSettings.Default.TextureExportFormat = SelectedTextureFormat; UserSettings.Default.SaveHdrTexturesAsHdr = ExportHdrTexturesAsHdr; UserSettings.Default.SaveMorphTargets = ExportMorphTargets; + UserSettings.Default.TextureQuality = TextureQuality; UserSettings.Save(); OverrideOptions = false; diff --git a/FModel/ViewModels/ExportSessionViewModel.cs b/FModel/ViewModels/ExportSessionViewModel.cs index e46bbe66..cc511219 100644 --- a/FModel/ViewModels/ExportSessionViewModel.cs +++ b/FModel/ViewModels/ExportSessionViewModel.cs @@ -64,7 +64,7 @@ public class ExportSessionViewModel : ViewModel } } - public ExportSessionOptionsViewModel Options { get; } = new(); + public ExportOptionsViewModel Options { get; } = new(); public bool IsRunning { diff --git a/FModel/ViewModels/SettingsViewModel.cs b/FModel/ViewModels/SettingsViewModel.cs index bf35071f..a6e8e395 100644 --- a/FModel/ViewModels/SettingsViewModel.cs +++ b/FModel/ViewModels/SettingsViewModel.cs @@ -25,13 +25,6 @@ public class SettingsViewModel : ViewModel set => SetProperty(ref _useCustomOutputFolders, value); } - private ETexturePlatform _selectedUePlatform; - public ETexturePlatform SelectedUePlatform - { - get => _selectedUePlatform; - set => SetProperty(ref _selectedUePlatform, value); - } - private EGame _selectedUeGame; public EGame SelectedUeGame { @@ -109,60 +102,6 @@ public class SettingsViewModel : ViewModel set => SetProperty(ref _selectedCosmeticStyle, value); } - private EMeshFormat _selectedMeshExportFormat; - public EMeshFormat SelectedMeshExportFormat - { - get => _selectedMeshExportFormat; - set - { - SetProperty(ref _selectedMeshExportFormat, value); - RaisePropertyChanged(nameof(SocketSettingsEnabled)); - RaisePropertyChanged(nameof(CompressionSettingsEnabled)); - } - } - - private ESocketFormat _selectedSocketExportFormat; - public ESocketFormat SelectedSocketExportFormat - { - get => _selectedSocketExportFormat; - set => SetProperty(ref _selectedSocketExportFormat, value); - } - - private EFileCompressionFormat _selectedCompressionFormat; - public EFileCompressionFormat SelectedCompressionFormat - { - get => _selectedCompressionFormat; - set => SetProperty(ref _selectedCompressionFormat, value); - } - - private EMeshQuality _selectedLodExportFormat; - public EMeshQuality SelectedLodExportFormat - { - get => _selectedLodExportFormat; - set => SetProperty(ref _selectedLodExportFormat, value); - } - - private ENaniteMeshFormat _selectedNaniteMeshExportFormat; - public ENaniteMeshFormat SelectedNaniteMeshExportFormat - { - get => _selectedNaniteMeshExportFormat; - set => SetProperty(ref _selectedNaniteMeshExportFormat, value); - } - - private EMaterialDepth _selectedMaterialExportFormat; - public EMaterialDepth SelectedMaterialExportFormat - { - get => _selectedMaterialExportFormat; - set => SetProperty(ref _selectedMaterialExportFormat, value); - } - - private ETextureFormat _selectedTextureExportFormat; - public ETextureFormat SelectedTextureExportFormat - { - get => _selectedTextureExportFormat; - set => SetProperty(ref _selectedTextureExportFormat, value); - } - private ulong _criwareDecryptionKey; public ulong CriwareDecryptionKey { @@ -177,8 +116,7 @@ public class SettingsViewModel : ViewModel set => SetProperty(ref _unluacOpcodeMap, value); } - public bool SocketSettingsEnabled => SelectedMeshExportFormat == EMeshFormat.ActorX; - public bool CompressionSettingsEnabled => SelectedMeshExportFormat == EMeshFormat.UEFormat; + public ExportOptionsViewModel Options { get; } = new(); public ReadOnlyObservableCollection UeGames { get; private set; } public ReadOnlyObservableCollection AssetLanguages { get; private set; } @@ -186,14 +124,6 @@ public class SettingsViewModel : ViewModel public ReadOnlyObservableCollection DiscordRpcs { get; private set; } public ReadOnlyObservableCollection CompressedAudios { get; private set; } public ReadOnlyObservableCollection CosmeticStyles { get; private set; } - public ReadOnlyObservableCollection MeshExportFormats { get; private set; } - public ReadOnlyObservableCollection SocketExportFormats { get; private set; } - public ReadOnlyObservableCollection CompressionFormats { get; private set; } - public ReadOnlyObservableCollection LodExportFormats { get; private set; } - public ReadOnlyObservableCollection NaniteMeshExportFormats { get; private set; } - public ReadOnlyObservableCollection MaterialExportFormats { get; private set; } - public ReadOnlyObservableCollection TextureExportFormats { get; private set; } - public ReadOnlyObservableCollection Platforms { get; private set; } private string _outputSnapshot; private string _rawDataSnapshot; @@ -203,7 +133,6 @@ public class SettingsViewModel : ViewModel private string _codeSnapshot; private string _modelSnapshot; private string _gameSnapshot; - private ETexturePlatform _uePlatformSnapshot; private EGame _ueGameSnapshot; private IList _customVersionsSnapshot; private IDictionary _optionsSnapshot; @@ -211,13 +140,6 @@ public class SettingsViewModel : ViewModel private ELanguage _assetLanguageSnapshot; private ECompressedAudio _compressedAudioSnapshot; private EIconStyle _cosmeticStyleSnapshot; - private EMeshFormat _meshExportFormatSnapshot; - private ESocketFormat _socketExportFormatSnapshot; - private EFileCompressionFormat _compressionFormatSnapshot; - private EMeshQuality _lodExportFormatSnapshot; - private ENaniteMeshFormat _naniteMeshExportFormatSnapshot; - private EMaterialDepth _materialExportFormatSnapshot; - private ETextureFormat _textureExportFormatSnapshot; private bool _mappingsUpdate = false; @@ -236,7 +158,6 @@ public class SettingsViewModel : ViewModel _codeSnapshot = UserSettings.Default.CodeDirectory; _modelSnapshot = UserSettings.Default.ModelDirectory; _gameSnapshot = UserSettings.Default.GameDirectory; - _uePlatformSnapshot = UserSettings.Default.CurrentDir.TexturePlatform; _ueGameSnapshot = UserSettings.Default.CurrentDir.UeVersion; _customVersionsSnapshot = UserSettings.Default.CurrentDir.Versioning.CustomVersions; _optionsSnapshot = UserSettings.Default.CurrentDir.Versioning.Options; @@ -255,15 +176,7 @@ public class SettingsViewModel : ViewModel _assetLanguageSnapshot = UserSettings.Default.AssetLanguage; _compressedAudioSnapshot = UserSettings.Default.CompressedAudioMode; _cosmeticStyleSnapshot = UserSettings.Default.CosmeticStyle; - _meshExportFormatSnapshot = UserSettings.Default.MeshExportFormat; - _socketExportFormatSnapshot = UserSettings.Default.SocketExportFormat; - _compressionFormatSnapshot = UserSettings.Default.CompressionFormat; - _lodExportFormatSnapshot = UserSettings.Default.MeshQuality; - _naniteMeshExportFormatSnapshot = UserSettings.Default.NaniteMeshExportFormat; - _materialExportFormatSnapshot = UserSettings.Default.MaterialExportFormat; - _textureExportFormatSnapshot = UserSettings.Default.TextureExportFormat; - SelectedUePlatform = _uePlatformSnapshot; SelectedUeGame = _ueGameSnapshot; SelectedCustomVersions = _customVersionsSnapshot; SelectedOptions = _optionsSnapshot; @@ -271,13 +184,6 @@ public class SettingsViewModel : ViewModel SelectedAssetLanguage = _assetLanguageSnapshot; SelectedCompressedAudio = _compressedAudioSnapshot; SelectedCosmeticStyle = _cosmeticStyleSnapshot; - SelectedMeshExportFormat = _meshExportFormatSnapshot; - SelectedSocketExportFormat = _socketExportFormatSnapshot; - SelectedCompressionFormat = _selectedCompressionFormat; - SelectedLodExportFormat = _lodExportFormatSnapshot; - SelectedNaniteMeshExportFormat = _naniteMeshExportFormatSnapshot; - SelectedMaterialExportFormat = _materialExportFormatSnapshot; - SelectedTextureExportFormat = _textureExportFormatSnapshot; CriwareDecryptionKey = _criwareDecryptionKey; UnluacOpcodeMap = _unluacOpcodeMap; SelectedAesReload = UserSettings.Default.AesReload; @@ -289,14 +195,6 @@ public class SettingsViewModel : ViewModel DiscordRpcs = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateDiscordRpcs())); CompressedAudios = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateCompressedAudios())); CosmeticStyles = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateCosmeticStyles())); - MeshExportFormats = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateMeshExportFormat())); - SocketExportFormats = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateSocketExportFormat())); - CompressionFormats = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateCompressionFormat())); - LodExportFormats = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateLodExportFormat())); - NaniteMeshExportFormats = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateNaniteMeshExportFormat())); - MaterialExportFormats = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateMaterialExportFormat())); - TextureExportFormats = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateTextureExportFormat())); - Platforms = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateUePlatforms())); } public bool Save(out List whatShouldIDo) @@ -310,13 +208,12 @@ public class SettingsViewModel : ViewModel whatShouldIDo.Add(SettingsOut.ReloadMappings); if (_ueGameSnapshot != SelectedUeGame || _customVersionsSnapshot != SelectedCustomVersions || - _uePlatformSnapshot != SelectedUePlatform || _optionsSnapshot != SelectedOptions || // combobox + _optionsSnapshot != SelectedOptions || // combobox _mapStructTypesSnapshot != SelectedMapStructTypes || _gameSnapshot != UserSettings.Default.GameDirectory) // textbox restart = true; UserSettings.Default.CurrentDir.UeVersion = SelectedUeGame; - UserSettings.Default.CurrentDir.TexturePlatform = SelectedUePlatform; UserSettings.Default.CurrentDir.Versioning.CustomVersions = SelectedCustomVersions; UserSettings.Default.CurrentDir.Versioning.Options = SelectedOptions; UserSettings.Default.CurrentDir.Versioning.MapStructTypes = SelectedMapStructTypes; @@ -326,16 +223,11 @@ public class SettingsViewModel : ViewModel UserSettings.Default.AssetLanguage = SelectedAssetLanguage; UserSettings.Default.CompressedAudioMode = SelectedCompressedAudio; UserSettings.Default.CosmeticStyle = SelectedCosmeticStyle; - UserSettings.Default.MeshExportFormat = SelectedMeshExportFormat; - UserSettings.Default.SocketExportFormat = SelectedSocketExportFormat; - UserSettings.Default.CompressionFormat = SelectedCompressionFormat; - UserSettings.Default.MeshQuality = SelectedLodExportFormat; - UserSettings.Default.NaniteMeshExportFormat = SelectedNaniteMeshExportFormat; - UserSettings.Default.MaterialExportFormat = SelectedMaterialExportFormat; - UserSettings.Default.TextureExportFormat = SelectedTextureExportFormat; UserSettings.Default.AesReload = SelectedAesReload; UserSettings.Default.DiscordRpc = SelectedDiscordRpc; + Options.SaveAsUserDefaults(); + if (SelectedDiscordRpc == EDiscordRpc.Never) _discordHandler.Shutdown(); @@ -352,12 +244,4 @@ public class SettingsViewModel : ViewModel private IEnumerable EnumerateDiscordRpcs() => Enum.GetValues(); private IEnumerable EnumerateCompressedAudios() => Enum.GetValues(); private IEnumerable EnumerateCosmeticStyles() => Enum.GetValues(); - private IEnumerable EnumerateMeshExportFormat() => Enum.GetValues(); - private IEnumerable EnumerateSocketExportFormat() => Enum.GetValues(); - private IEnumerable EnumerateCompressionFormat() => Enum.GetValues(); - private IEnumerable EnumerateLodExportFormat() => Enum.GetValues(); - private IEnumerable EnumerateNaniteMeshExportFormat() => Enum.GetValues(); - private IEnumerable EnumerateMaterialExportFormat() => Enum.GetValues(); - private IEnumerable EnumerateTextureExportFormat() => Enum.GetValues(); - private IEnumerable EnumerateUePlatforms() => Enum.GetValues(); } diff --git a/FModel/Views/ExportSessionWindow.xaml b/FModel/Views/ExportSessionWindow.xaml index 9a37bcba..480b55e7 100644 --- a/FModel/Views/ExportSessionWindow.xaml +++ b/FModel/Views/ExportSessionWindow.xaml @@ -12,10 +12,11 @@ xmlns:adonisControls="clr-namespace:AdonisUI.Controls;assembly=AdonisUI" xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI" xmlns:converters="clr-namespace:FModel.Views.Resources.Converters" - xmlns:viewModels="clr-namespace:FModel.ViewModels" + xmlns:controls="clr-namespace:FModel.Views.Resources.Controls" xmlns:serilog="clr-namespace:Serilog.Events;assembly=Serilog" xmlns:c4pMeshes="clr-namespace:CUE4Parse_Conversion.Options;assembly=CUE4Parse-Conversion" + DataContext="{x:Static vm:ExportSessionViewModel.Instance}" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" IconVisibility="Collapsed" Height="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenHeight}, Converter={converters:RatioConverter}, ConverterParameter='0.75'}" Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.40'}"> @@ -131,7 +132,7 @@ - + @@ -179,7 +180,7 @@ - + @@ -215,7 +216,7 @@ - + @@ -387,21 +388,21 @@ - - - + @@ -418,7 +419,7 @@ - + @@ -466,242 +467,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - -