From f4e7eeb6ae2f14ec155630281abdcb8a23e1b90f Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Sat, 10 Jul 2021 01:59:46 +0200 Subject: [PATCH] mesh export settings --- CUE4Parse | 2 +- .../Creator/Bases/FN/BaseMaterialInstance.cs | 1 - FModel/Settings/UserSettings.cs | 23 +++++++ FModel/ViewModels/CUE4ParseViewModel.cs | 6 +- FModel/ViewModels/Commands/MenuCommand.cs | 2 - FModel/ViewModels/SettingsViewModel.cs | 44 ++++++++++++ FModel/Views/SettingsView.xaml | 68 +++++++++++++++++++ 7 files changed, 139 insertions(+), 7 deletions(-) diff --git a/CUE4Parse b/CUE4Parse index 32c5a34d..a30473bb 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 32c5a34d1ce89f657508e53eb3535bfd9a37396d +Subproject commit a30473bbfe73f759365572409b95381e94adc9a9 diff --git a/FModel/Creator/Bases/FN/BaseMaterialInstance.cs b/FModel/Creator/Bases/FN/BaseMaterialInstance.cs index 50b332a8..31f211ae 100644 --- a/FModel/Creator/Bases/FN/BaseMaterialInstance.cs +++ b/FModel/Creator/Bases/FN/BaseMaterialInstance.cs @@ -19,7 +19,6 @@ namespace FModel.Creator.Bases.FN { if (Object is not UMaterialInstanceConstant material) return; - // MY ONLY GOTO texture_finding: foreach (var textureParameter in material.TextureParameterValues) // get texture from base material { diff --git a/FModel/Settings/UserSettings.cs b/FModel/Settings/UserSettings.cs index 5bcf565f..2c619a77 100644 --- a/FModel/Settings/UserSettings.cs +++ b/FModel/Settings/UserSettings.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.IO; using System.Windows.Input; using CUE4Parse.UE4.Versions; +using CUE4Parse_Conversion.Meshes; +using CUE4Parse_Conversion.Textures; using FModel.Framework; using FModel.ViewModels; using FModel.ViewModels.ApiEndpoints.Models; @@ -428,5 +430,26 @@ namespace FModel.Settings get => _nextAudio; set => SetProperty(ref _nextAudio, value); } + + private EMeshFormat _meshExportFormat = EMeshFormat.ActorX; + public EMeshFormat MeshExportFormat + { + get => _meshExportFormat; + set => SetProperty(ref _meshExportFormat, value); + } + + private ELodFormat _lodExportFormat = ELodFormat.FirstLod; + public ELodFormat LodExportFormat + { + get => _lodExportFormat; + set => SetProperty(ref _lodExportFormat, value); + } + + private ETextureFormat _textureExportFormat = ETextureFormat.Png; + public ETextureFormat TextureExportFormat + { + get => _textureExportFormat; + set => SetProperty(ref _textureExportFormat, value); + } } } \ No newline at end of file diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 7db6b30b..eead9d3c 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -580,13 +580,13 @@ namespace FModel.ViewModels case UStaticMesh when UserSettings.Default.IsAutoSaveMeshes: case USkeletalMesh when UserSettings.Default.IsAutoSaveMeshes: { - var toSave = new Exporter(export); + var toSave = new Exporter(export, UserSettings.Default.TextureExportFormat, UserSettings.Default.LodExportFormat); var toSaveDirectory = new DirectoryInfo(Path.Combine(UserSettings.Default.OutputDirectory, "Saves")); if (toSave.TryWriteToDir(toSaveDirectory, out var savedFileName)) { - Log.Information("{FileName} successfully saved", savedFileName); + Log.Information("Successfully saved {FileName}", savedFileName); FLogger.AppendInformation(); - FLogger.AppendText($"Successfully saved '{savedFileName}'", Constants.WHITE, true); + FLogger.AppendText($"Successfully saved {savedFileName}", Constants.WHITE, true); } else { diff --git a/FModel/ViewModels/Commands/MenuCommand.cs b/FModel/ViewModels/Commands/MenuCommand.cs index 7528761b..237f386c 100644 --- a/FModel/ViewModels/Commands/MenuCommand.cs +++ b/FModel/ViewModels/Commands/MenuCommand.cs @@ -1,7 +1,5 @@ using System.Diagnostics; -using System.Threading.Tasks; using AdonisUI.Controls; -using FModel.Extensions; using FModel.Framework; using FModel.Settings; using FModel.Views; diff --git a/FModel/ViewModels/SettingsViewModel.cs b/FModel/ViewModels/SettingsViewModel.cs index 1bec79be..ba4de94e 100644 --- a/FModel/ViewModels/SettingsViewModel.cs +++ b/FModel/ViewModels/SettingsViewModel.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using CUE4Parse.UE4.Versions; +using CUE4Parse_Conversion.Meshes; +using CUE4Parse_Conversion.Textures; using FModel.Framework; using FModel.Services; using FModel.Settings; @@ -82,6 +84,27 @@ namespace FModel.ViewModels get => _selectedCosmeticDisplayAsset; set => SetProperty(ref _selectedCosmeticDisplayAsset, value); } + + private EMeshFormat _selectedMeshExportFormat; + public EMeshFormat SelectedMeshExportFormat + { + get => _selectedMeshExportFormat; + set => SetProperty(ref _selectedMeshExportFormat, value); + } + + private ELodFormat _selectedLodExportFormat; + public ELodFormat SelectedLodExportFormat + { + get => _selectedLodExportFormat; + set => SetProperty(ref _selectedLodExportFormat, value); + } + + private ETextureFormat _selectedTextureExportFormat; + public ETextureFormat SelectedTextureExportFormat + { + get => _selectedTextureExportFormat; + set => SetProperty(ref _selectedTextureExportFormat, value); + } public ReadOnlyObservableCollection UpdateModes { get; private set; } public ReadOnlyObservableCollection UeGames { get; private set; } @@ -93,6 +116,9 @@ namespace FModel.ViewModels public ReadOnlyObservableCollection CompressedAudios { get; private set; } public ReadOnlyObservableCollection CosmeticStyles { get; private set; } public ReadOnlyObservableCollection CosmeticDisplayAssets { get; private set; } + public ReadOnlyObservableCollection MeshExportFormats { get; private set; } + public ReadOnlyObservableCollection LodExportFormats { get; private set; } + public ReadOnlyObservableCollection TextureExportFormats { get; private set; } private readonly FGame _game; private string _outputSnapshot; @@ -105,6 +131,9 @@ namespace FModel.ViewModels private ECompressedAudio _compressedAudioSnapshot; private EIconStyle _cosmeticStyleSnapshot; private EEnabledDisabled _cosmeticDisplayAssetSnapshot; + private EMeshFormat _meshExportFormatSnapshot; + private ELodFormat _lodExportFormatSnapshot; + private ETextureFormat _textureExportFormatSnapshot; public SettingsViewModel(FGame game) { @@ -123,6 +152,9 @@ namespace FModel.ViewModels _compressedAudioSnapshot = UserSettings.Default.CompressedAudioMode; _cosmeticStyleSnapshot = UserSettings.Default.CosmeticStyle; _cosmeticDisplayAssetSnapshot = UserSettings.Default.CosmeticDisplayAsset; + _meshExportFormatSnapshot = UserSettings.Default.MeshExportFormat; + _lodExportFormatSnapshot = UserSettings.Default.LodExportFormat; + _textureExportFormatSnapshot = UserSettings.Default.TextureExportFormat; SelectedUpdateMode = _updateModeSnapshot; SelectedUeGame = _ueGameSnapshot; @@ -132,6 +164,9 @@ namespace FModel.ViewModels SelectedCompressedAudio = _compressedAudioSnapshot; SelectedCosmeticStyle = _cosmeticStyleSnapshot; SelectedCosmeticDisplayAsset = _cosmeticDisplayAssetSnapshot; + SelectedMeshExportFormat = _meshExportFormatSnapshot; + SelectedLodExportFormat = _lodExportFormatSnapshot; + SelectedTextureExportFormat = _textureExportFormatSnapshot; SelectedAesReload = UserSettings.Default.AesReload; SelectedDiscordRpc = UserSettings.Default.DiscordRpc; @@ -145,6 +180,9 @@ namespace FModel.ViewModels CompressedAudios = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateCompressedAudios())); CosmeticStyles = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateCosmeticStyles())); CosmeticDisplayAssets = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateEnabledDisabled())); + MeshExportFormats = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateMeshExportFormat())); + LodExportFormats = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateLodExportFormat())); + TextureExportFormats = new ReadOnlyObservableCollection(new ObservableCollection(EnumerateTextureExportFormat())); } public SettingsOut Save() @@ -167,6 +205,9 @@ namespace FModel.ViewModels UserSettings.Default.CompressedAudioMode = SelectedCompressedAudio; UserSettings.Default.CosmeticStyle = SelectedCosmeticStyle; UserSettings.Default.CosmeticDisplayAsset = SelectedCosmeticDisplayAsset; + UserSettings.Default.MeshExportFormat = SelectedMeshExportFormat; + UserSettings.Default.LodExportFormat = SelectedLodExportFormat; + UserSettings.Default.TextureExportFormat = SelectedTextureExportFormat; UserSettings.Default.AesReload = SelectedAesReload; UserSettings.Default.DiscordRpc = SelectedDiscordRpc; @@ -185,5 +226,8 @@ namespace FModel.ViewModels private IEnumerable EnumerateCompressedAudios() => Enum.GetValues(SelectedCompressedAudio.GetType()).Cast(); private IEnumerable EnumerateCosmeticStyles() => Enum.GetValues(SelectedCosmeticStyle.GetType()).Cast(); private IEnumerable EnumerateEnabledDisabled() => Enum.GetValues(SelectedCosmeticDisplayAsset.GetType()).Cast(); + private IEnumerable EnumerateMeshExportFormat() => Enum.GetValues(SelectedMeshExportFormat.GetType()).Cast(); + private IEnumerable EnumerateLodExportFormat() => Enum.GetValues(SelectedLodExportFormat.GetType()).Cast(); + private IEnumerable EnumerateTextureExportFormat() => Enum.GetValues(SelectedTextureExportFormat.GetType()).Cast(); } } \ No newline at end of file diff --git a/FModel/Views/SettingsView.xaml b/FModel/Views/SettingsView.xaml index 86019044..c0dbd8c5 100644 --- a/FModel/Views/SettingsView.xaml +++ b/FModel/Views/SettingsView.xaml @@ -228,6 +228,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -365,6 +417,22 @@ + + + + + + + + + + + + + + + +