Skip to content

Commit

Permalink
Merge pull request #497 from GhostScissors/TGA
Browse files Browse the repository at this point in the history
Texture export format based on user settings
  • Loading branch information
4sval authored Sep 9, 2024
2 parents b6d6774 + 581db18 commit b536f10
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CUE4Parse
4 changes: 2 additions & 2 deletions FModel/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Folder's Packages Textures (.png)" Click="OnFolderTextureClick">
<MenuItem Header="Save Folder's Packages Textures" Click="OnFolderTextureClick">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
Expand Down Expand Up @@ -517,7 +517,7 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Texture (.png)" Command="{Binding DataContext.RightClickMenuCommand}">
<MenuItem Header="Save Texture" Command="{Binding DataContext.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Textures" />
Expand Down
2 changes: 1 addition & 1 deletion FModel/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ await Task.WhenAll(
#if DEBUG
// await _threadWorkerView.Begin(cancellationToken =>
// _applicationView.CUE4Parse.Extract(cancellationToken,
// "fortnitegame/Content/Characters/Player/Female/Large/Bodies/F_LRG_BunnyBR/Meshes/F_LRG_BunnyBR.uasset"));
// "FortniteGame/Content/Athena/Apollo/Maps/UI/Apollo_Terrain_Minimap.uasset"));
// await _threadWorkerView.Begin(cancellationToken =>
// _applicationView.CUE4Parse.Extract(cancellationToken,
// "FortniteGame/Content/Environments/Helios/Props/GlacierHotel/GlacierHotel_Globe_A/Meshes/SM_GlacierHotel_Globe_A.uasset"));
Expand Down
12 changes: 10 additions & 2 deletions FModel/ViewModels/TabControlViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void SetImage(SKBitmap bitmap)
return;
}
_bmp = bitmap;
using var data = _bmp.Encode(NoAlpha ? SKEncodedImageFormat.Jpeg : SKEncodedImageFormat.Png, 100);
using var data = _bmp.Encode(NoAlpha ? ETextureFormat.Jpeg : UserSettings.Default.TextureExportFormat, 100);
using var stream = new MemoryStream(ImageBuffer = data.ToArray(), false);
var image = new BitmapImage();
image.BeginInit();
Expand Down Expand Up @@ -301,7 +301,15 @@ public void SetDocumentText(string text, bool save, bool updateUi)
private void SaveImage(TabImage image, bool updateUi)
{
if (image == null) return;
var fileName = $"{image.ExportName}.png";

var ext = UserSettings.Default.TextureExportFormat switch
{
ETextureFormat.Png => ".png",
ETextureFormat.Tga => ".tga",
_ => ".png"
};

var fileName = image.ExportName + ext;
var path = Path.Combine(UserSettings.Default.TextureDirectory,
UserSettings.Default.KeepDirectoryStructure ? Directory : "", fileName!).Replace('\\', '/');

Expand Down
2 changes: 1 addition & 1 deletion FModel/Views/Resources/Resources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Texture (.png)" Command="{Binding TabCommand}" CommandParameter="Asset_Save_Textures">
<MenuItem Header="Save Texture" Command="{Binding TabCommand}" CommandParameter="Asset_Save_Textures">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
Expand Down
2 changes: 1 addition & 1 deletion FModel/Views/SearchView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Texture (.png)" Command="{Binding DataContext.RightClickMenuCommand}">
<MenuItem Header="Save Texture" Command="{Binding DataContext.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Textures" />
Expand Down

0 comments on commit b536f10

Please sign in to comment.