From 7f14a5ca05bf0315f7896b313efe5fb16ea4f9cb Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Mon, 6 Dec 2021 13:48:50 +0100 Subject: [PATCH] improved model settings close #222 --- FModel/Creator/Bases/FN/BaseCommunity.cs | 15 +++- FModel/MainWindow.xaml | 16 ----- FModel/MainWindow.xaml.cs | 5 -- FModel/Settings/UserSettings.cs | 87 +++++++++++++++++++----- FModel/ViewModels/CUE4ParseViewModel.cs | 9 ++- FModel/Views/SettingsView.xaml | 56 +++++++++------ 6 files changed, 121 insertions(+), 67 deletions(-) diff --git a/FModel/Creator/Bases/FN/BaseCommunity.cs b/FModel/Creator/Bases/FN/BaseCommunity.cs index d0066e94..0ae9ceb3 100644 --- a/FModel/Creator/Bases/FN/BaseCommunity.cs +++ b/FModel/Creator/Bases/FN/BaseCommunity.cs @@ -102,10 +102,19 @@ namespace FModel.Creator.Bases.FN if (!bShort) return base.GetCosmeticSeason(seasonNumber); var s = seasonNumber["Cosmetics.Filter.Season.".Length..]; var number = int.Parse(s); - if (number == 10) - s = "X"; - return number > 10 ? $"C{number / 10 + 1} S{s[^1..]}" : $"C1 S{s}"; + switch (number) + { + case 10: + s = "X"; + break; + case > 18: + number += 2; + s = number.ToString(); + break; + } + + return $"C{number / 10 + 1} S{s[^1..]}"; } private new void DrawBackground(SKCanvas c) diff --git a/FModel/MainWindow.xaml b/FModel/MainWindow.xaml index b0f7a876..33c357cd 100644 --- a/FModel/MainWindow.xaml +++ b/FModel/MainWindow.xaml @@ -162,9 +162,6 @@ - @@ -866,19 +863,6 @@ - - - - - - - diff --git a/FModel/MainWindow.xaml.cs b/FModel/MainWindow.xaml.cs index c0983618..53f5a506 100644 --- a/FModel/MainWindow.xaml.cs +++ b/FModel/MainWindow.xaml.cs @@ -37,8 +37,6 @@ namespace FModel {new KeyGesture(UserSettings.Default.AutoSaveAnimations.Key, UserSettings.Default.AutoSaveAnimations.Modifiers)}), OnAutoTriggerExecuted)); CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoOpenSounds", typeof(MainWindow), new InputGestureCollection {new KeyGesture(UserSettings.Default.AutoOpenSounds.Key, UserSettings.Default.AutoOpenSounds.Modifiers)}), OnAutoTriggerExecuted)); - CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoOpenMeshes", typeof(MainWindow), new InputGestureCollection - {new KeyGesture(UserSettings.Default.AutoOpenMeshes.Key, UserSettings.Default.AutoOpenMeshes.Modifiers)}), OnAutoTriggerExecuted)); CommandBindings.Add(new CommandBinding(new RoutedCommand("ReloadMappings", typeof(MainWindow), new InputGestureCollection {new KeyGesture(Key.F12)}), OnMappingsReload)); CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (s, e) => OnOpenAvalonFinder())); @@ -152,9 +150,6 @@ namespace FModel case "AutoOpenSounds": UserSettings.Default.IsAutoOpenSounds = !UserSettings.Default.IsAutoOpenSounds; break; - case "AutoOpenMeshes": - UserSettings.Default.IsAutoOpenMeshes = !UserSettings.Default.IsAutoOpenMeshes; - break; } } diff --git a/FModel/Settings/UserSettings.cs b/FModel/Settings/UserSettings.cs index 8fdf63a6..77fa8508 100644 --- a/FModel/Settings/UserSettings.cs +++ b/FModel/Settings/UserSettings.cs @@ -100,13 +100,6 @@ namespace FModel.Settings set => SetProperty(ref _isAutoOpenSounds, value); } - private bool _isAutoOpenMeshes = true; - public bool IsAutoOpenMeshes - { - get => _isAutoOpenMeshes; - set => SetProperty(ref _isAutoOpenMeshes, value); - } - private bool _isLoggerExpanded = true; public bool IsLoggerExpanded { @@ -478,13 +471,6 @@ namespace FModel.Settings set => SetProperty(ref _autoOpenSounds, value); } - private Hotkey _autoOpenMeshes = new(Key.F6); - public Hotkey AutoOpenMeshes - { - get => _autoOpenMeshes; - set => SetProperty(ref _autoOpenMeshes, value); - } - private Hotkey _addAudio = new(Key.N, ModifierKeys.Control); public Hotkey AddAudio { @@ -527,11 +513,76 @@ namespace FModel.Settings set => SetProperty(ref _lodExportFormat, value); } - private bool _openMaterialsInModelViewer = true; - public bool OpenMaterialsInModelViewer + private bool _previewStaticMeshes = true; + public bool PreviewStaticMeshes { - get => _openMaterialsInModelViewer; - set => SetProperty(ref _openMaterialsInModelViewer, value); + get => _previewStaticMeshes; + set + { + SetProperty(ref _previewStaticMeshes, value); + if (_previewStaticMeshes && SaveStaticMeshes) + SaveStaticMeshes = false; + } + } + + private bool _previewSkeletalMeshes = true; + public bool PreviewSkeletalMeshes + { + get => _previewSkeletalMeshes; + set + { + SetProperty(ref _previewSkeletalMeshes, value); + if (_previewSkeletalMeshes && SaveSkeletalMeshes) + SaveSkeletalMeshes = false; + } + } + + private bool _previewMaterials = true; + public bool PreviewMaterials + { + get => _previewMaterials; + set + { + SetProperty(ref _previewMaterials, value); + if (_previewMaterials && SaveMaterials) + SaveMaterials = false; + } + } + + private bool _saveStaticMeshes; + public bool SaveStaticMeshes + { + get => _saveStaticMeshes; + set + { + SetProperty(ref _saveStaticMeshes, value); + if (_saveStaticMeshes && PreviewStaticMeshes) + PreviewStaticMeshes = false; + } + } + + private bool _saveSkeletalMeshes; + public bool SaveSkeletalMeshes + { + get => _saveSkeletalMeshes; + set + { + SetProperty(ref _saveSkeletalMeshes, value); + if (_saveSkeletalMeshes && PreviewSkeletalMeshes) + PreviewSkeletalMeshes = false; + } + } + + private bool _saveMaterials; + public bool SaveMaterials + { + get => _saveMaterials; + set + { + SetProperty(ref _saveMaterials, value); + if (_saveMaterials && PreviewMaterials) + PreviewMaterials = false; + } } private bool _saveSkeletonAsMesh; diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 994ef42f..36596076 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -670,9 +670,9 @@ namespace FModel.ViewModels SaveAndPlaySound(Path.Combine(TabControl.SelectedTab.Directory, TabControl.SelectedTab.Header.SubstringBeforeLast('.')).Replace('\\', '/'), audioFormat, data); return false; } - case UStaticMesh when UserSettings.Default.IsAutoOpenMeshes: - case USkeletalMesh when UserSettings.Default.IsAutoOpenMeshes: - case UMaterialInstance when UserSettings.Default.OpenMaterialsInModelViewer && !ModelIsSwappingMaterial && + case UStaticMesh when UserSettings.Default.PreviewStaticMeshes: + case USkeletalMesh when UserSettings.Default.PreviewSkeletalMeshes: + case UMaterialInstance when UserSettings.Default.PreviewMaterials && !ModelIsSwappingMaterial && !(Game == FGame.FortniteGame && export.Owner != null && (export.Owner.Name.EndsWith($"/MI_OfferImages/{export.Name}", StringComparison.OrdinalIgnoreCase) || export.Owner.Name.EndsWith($"/RenderSwitch_Materials/{export.Name}", StringComparison.OrdinalIgnoreCase) || export.Owner.Name.EndsWith($"/MI_BPTile/{export.Name}", StringComparison.OrdinalIgnoreCase))): @@ -693,6 +693,9 @@ namespace FModel.ViewModels }); return true; } + case UStaticMesh when UserSettings.Default.SaveStaticMeshes: + case USkeletalMesh when UserSettings.Default.SaveSkeletalMeshes: + case UMaterialInstance when UserSettings.Default.SaveMaterials: case USkeleton when UserSettings.Default.SaveSkeletonAsMesh: case UAnimSequence when UserSettings.Default.IsAutoSaveAnimations: { diff --git a/FModel/Views/SettingsView.xaml b/FModel/Views/SettingsView.xaml index defe4685..c2596baa 100644 --- a/FModel/Views/SettingsView.xaml +++ b/FModel/Views/SettingsView.xaml @@ -236,6 +236,7 @@ + @@ -263,20 +264,35 @@ - - + + + + + + - - + + + + + + + + - + - - + @@ -307,7 +323,6 @@ - @@ -354,23 +369,20 @@ - - - + - - + - - + - - + - - +