diff --git a/CUE4Parse b/CUE4Parse index 3fc091a0..3dd95075 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 3fc091a085a609bdb7bd2f8934890051b88ac18b +Subproject commit 3dd95075fa46f53a88052b466aab7dda76ccac90 diff --git a/FModel/Settings/UserSettings.cs b/FModel/Settings/UserSettings.cs index b2f8c8cc..11d6152f 100644 --- a/FModel/Settings/UserSettings.cs +++ b/FModel/Settings/UserSettings.cs @@ -69,7 +69,9 @@ public sealed class UserSettings : ViewModel Default.SaveEmbeddedMaterials, Default.SaveMorphTargets, Default.SocketExportFormat, - Default.CompressionFormat + Default.CompressionFormat, + Default.PngCompressionLevel, + Default.TgaRleCompression ); } @@ -522,6 +524,20 @@ public sealed class UserSettings : ViewModel set => SetProperty(ref _textureQuality, value); } + private int _pngCompressionLevel = 3; + public int PngCompressionLevel + { + get => _pngCompressionLevel; + set => SetProperty(ref _pngCompressionLevel, Math.Clamp(value, 0, 9)); + } + + private bool _tgaRleCompression = true; + public bool TgaRleCompression + { + get => _tgaRleCompression; + set => SetProperty(ref _tgaRleCompression, value); + } + private ESocketFormat _socketExportFormat = ESocketFormat.Bone; public ESocketFormat SocketExportFormat { diff --git a/FModel/ViewModels/ExportOptionsViewModel.cs b/FModel/ViewModels/ExportOptionsViewModel.cs index c2f808bc..d11a254b 100644 --- a/FModel/ViewModels/ExportOptionsViewModel.cs +++ b/FModel/ViewModels/ExportOptionsViewModel.cs @@ -136,9 +136,19 @@ public class ExportOptionsViewModel : ViewModel public ETextureFormat SelectedTextureFormat { get; - set => SetProperty(ref field, value); + set + { + if (!SetProperty(ref field, value)) return; + RaisePropertyChanged(nameof(ShowTextureQuality)); + RaisePropertyChanged(nameof(ShowPngCompression)); + RaisePropertyChanged(nameof(ShowTgaCompression)); + } } + public bool ShowTextureQuality => SelectedTextureFormat is ETextureFormat.Jpeg or ETextureFormat.Webp; + public bool ShowPngCompression => SelectedTextureFormat is ETextureFormat.Png; + public bool ShowTgaCompression => SelectedTextureFormat is ETextureFormat.Tga; + private ETextureFormat? _preUsdTextureFormat; public bool TextureFormatsEnabled => SelectedMeshFormat != EMeshFormat.USD; @@ -154,6 +164,18 @@ public class ExportOptionsViewModel : ViewModel set => SetProperty(ref field, value); } + public int PngCompressionLevel + { + get; + set => SetProperty(ref field, Math.Clamp(value, 0, 9)); + } + + public bool TgaRleCompression + { + get; + set => SetProperty(ref field, value); + } + public bool ExportMorphTargets { get; @@ -184,9 +206,16 @@ public class ExportOptionsViewModel : ViewModel ExportMaterials = UserSettings.Default.SaveEmbeddedMaterials; SelectedTexturePlatform = UserSettings.Default.CurrentDir.TexturePlatform; SelectedTextureFormat = UserSettings.Default.TextureExportFormat; + if (SelectedMeshFormat is EMeshFormat.USD) + { + _preUsdTextureFormat = SelectedTextureFormat; + SelectedTextureFormat = ETextureFormat.Png; + } ExportHdrTexturesAsHdr = UserSettings.Default.SaveHdrTexturesAsHdr; ExportMorphTargets = UserSettings.Default.SaveMorphTargets; TextureQuality = UserSettings.Default.TextureQuality; + PngCompressionLevel = UserSettings.Default.PngCompressionLevel; + TgaRleCompression = UserSettings.Default.TgaRleCompression; ExportAllTextureMips = UserSettings.Default.ExportAllTextureMips; ExportImmediately = UserSettings.Default.ExportImmediately; @@ -209,6 +238,8 @@ public class ExportOptionsViewModel : ViewModel UserSettings.Default.SaveHdrTexturesAsHdr = ExportHdrTexturesAsHdr; UserSettings.Default.SaveMorphTargets = ExportMorphTargets; UserSettings.Default.TextureQuality = TextureQuality; + UserSettings.Default.PngCompressionLevel = PngCompressionLevel; + UserSettings.Default.TgaRleCompression = TgaRleCompression; UserSettings.Default.ExportAllTextureMips = ExportAllTextureMips; UserSettings.Default.ExportImmediately = ExportImmediately; UserSettings.Save(); @@ -230,6 +261,8 @@ public class ExportOptionsViewModel : ViewModel ExportMaterials, ExportMorphTargets, SelectedSocketFormat, - SelectedCompressionFormat + SelectedCompressionFormat, + PngCompressionLevel, + TgaRleCompression ); } diff --git a/FModel/Views/Resources/Controls/ExportOptionsControl.xaml b/FModel/Views/Resources/Controls/ExportOptionsControl.xaml index fcec1dc7..7a245e18 100644 --- a/FModel/Views/Resources/Controls/ExportOptionsControl.xaml +++ b/FModel/Views/Resources/Controls/ExportOptionsControl.xaml @@ -216,10 +216,37 @@ - + + Value="{Binding TextureQuality, Mode=TwoWay}" + Visibility="{Binding ShowTextureQuality, Converter={StaticResource BoolToVisibilityConverter}}" /> + + + + + + + + + + + + +