mirror of
https://github.com/4sval/FModel.git
synced 2026-12-04 23:02:22 -06:00
Texture formats compression settings
This commit is contained in:
Submodule CUE4Parse updated: 3fc091a085...3dd95075fa
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -216,10 +216,37 @@
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Grid.Row="13" Grid.Column="0" Text="Texture Quality" VerticalAlignment="Center" Margin="0 0 0 12" />
|
||||
<TextBlock Grid.Row="13" Grid.Column="0" Text="Texture Quality" VerticalAlignment="Center" Margin="0 0 0 12"
|
||||
Visibility="{Binding ShowTextureQuality, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<Slider Grid.Row="13" Grid.Column="2" Grid.ColumnSpan="3" Minimum="1" Maximum="100" TickPlacement="None"
|
||||
AutoToolTipPlacement="BottomRight" IsMoveToPointEnabled="True" IsSnapToTickEnabled="True" Margin="0 0 0 12"
|
||||
Value="{Binding TextureQuality, Mode=TwoWay}" />
|
||||
Value="{Binding TextureQuality, Mode=TwoWay}"
|
||||
Visibility="{Binding ShowTextureQuality, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
|
||||
<TextBlock x:Name="PngCompressionText" Grid.Row="13" Grid.Column="0" Text="PNG Compression" VerticalAlignment="Center" Margin="0 0 0 12"
|
||||
ToolTip="Lossless compression. Level 3 is recommended for speed."
|
||||
Visibility="{Binding ShowPngCompression, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<Grid Grid.Row="13" Grid.Column="2" Grid.ColumnSpan="3" Margin="0 0 0 12"
|
||||
ToolTip="{Binding ToolTip, ElementName=PngCompressionText}"
|
||||
Visibility="{Binding ShowPngCompression, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PngCompressionSlider" Minimum="0" Maximum="9" TickFrequency="1" TickPlacement="None"
|
||||
AutoToolTipPlacement="BottomRight" IsMoveToPointEnabled="True" IsSnapToTickEnabled="True"
|
||||
Value="{Binding PngCompressionLevel, Mode=TwoWay}" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding PngCompressionLevel}" VerticalAlignment="Center" Margin="8 0 0 0" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="13" Grid.Column="0" Text="TGA RLE Compression" VerticalAlignment="Center" Margin="0 0 0 12"
|
||||
ToolTip="Lossless compression of repeated pixels. File size depends on the image."
|
||||
Visibility="{Binding ShowTgaCompression, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<CheckBox Grid.Row="13" Grid.Column="2" Grid.ColumnSpan="3" Margin="0 0 0 12"
|
||||
IsChecked="{Binding TgaRleCompression, Mode=TwoWay}"
|
||||
Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
|
||||
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}"
|
||||
Visibility="{Binding ShowTgaCompression, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
|
||||
<TextBlock Grid.Row="14" Grid.Column="0" Text="Save HDR as .hdr" VerticalAlignment="Center" Margin="0 0 0 12" />
|
||||
<CheckBox Grid.Row="14" Grid.Column="2" Grid.ColumnSpan="3"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Documents;
|
||||
using FModel.ViewModels;
|
||||
using Ookii.Dialogs.Wpf;
|
||||
@@ -12,6 +13,16 @@ public partial class ExportOptionsControl
|
||||
public ExportOptionsControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
PngCompressionSlider.AddHandler(Thumb.DragStartedEvent, new DragStartedEventHandler(OnPngCompressionDrag), true);
|
||||
PngCompressionSlider.AddHandler(Thumb.DragDeltaEvent, new DragDeltaEventHandler(OnPngCompressionDrag), true);
|
||||
}
|
||||
|
||||
private void OnPngCompressionDrag(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (PngCompressionSlider.Value == 3 && e.OriginalSource is Thumb { ToolTip: ToolTip tooltip })
|
||||
{
|
||||
tooltip.Content = "3 (Recommended)";
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBrowseOutputDirectory(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user