use custom version container instead of list.

ETexturePlatform -> EPlatform as it's not JUST for textures.
This commit is contained in:
GMatrixGames 2023-08-11 16:28:26 -04:00
parent 250b199b2a
commit dd78c68e86
No known key found for this signature in database
GPG Key ID: CA09F9FCEDB4B7EC
6 changed files with 30 additions and 56 deletions

View File

@ -19,7 +19,7 @@ public class DirectorySettings : ViewModel, ICloneable
GameDirectory = gameDir,
IsManual = manual,
UeVersion = old?.UeVersion ?? ue,
TexturePlatform = old?.TexturePlatform ?? ETexturePlatform.DesktopMobile,
TexturePlatform = old?.TexturePlatform ?? EPlatform.DesktopMobile,
Versioning = old?.Versioning ?? new VersioningSettings(),
Endpoints = old?.Endpoints ?? EndpointSettings.Default(gameName),
Directories = old?.Directories ?? CustomDirectory.Default(gameName),
@ -56,8 +56,8 @@ public class DirectorySettings : ViewModel, ICloneable
set => SetProperty(ref _ueVersion, value);
}
private ETexturePlatform _texturePlatform;
public ETexturePlatform TexturePlatform
private EPlatform _texturePlatform;
public EPlatform TexturePlatform
{
get => _texturePlatform;
set => SetProperty(ref _texturePlatform, value);

View File

@ -6,8 +6,8 @@ namespace FModel.Settings;
public class VersioningSettings : ViewModel
{
private IList<FCustomVersion> _customVersions;
public IList<FCustomVersion> CustomVersions
private FCustomVersionContainer _customVersions;
public FCustomVersionContainer CustomVersions
{
get => _customVersions;
set => SetProperty(ref _customVersions, value);
@ -26,6 +26,4 @@ public class VersioningSettings : ViewModel
get => _mapStructTypes;
set => SetProperty(ref _mapStructTypes, value);
}
public VersioningSettings() {}
}

View File

@ -11,7 +11,6 @@ using CUE4Parse.Encryption.Aes;
using CUE4Parse.FileProvider;
using CUE4Parse.FileProvider.Vfs;
using CUE4Parse.MappingsProvider;
using CUE4Parse.UE4.AssetRegistry;
using CUE4Parse.UE4.Assets.Exports;
using CUE4Parse.UE4.Assets.Exports.Animation;
using CUE4Parse.UE4.Assets.Exports.Material;
@ -32,7 +31,7 @@ using CUE4Parse.UE4.Wwise;
using CUE4Parse_Conversion;
using CUE4Parse_Conversion.Sounds;
using CUE4Parse.FileProvider.Objects;
using CUE4Parse.UE4.Objects.Core.Serialization;
using CUE4Parse.UE4.Structs.AssetRegistry;
using EpicManifestParser.Objects;
using FModel.Creator;
using FModel.Extensions;
@ -129,7 +128,7 @@ public class CUE4ParseViewModel : ViewModel
var gameDirectory = currentDir.GameDirectory;
var versionContainer = new VersionContainer(
game: currentDir.UeVersion, platform: currentDir.TexturePlatform,
customVersions: new FCustomVersionContainer(currentDir.Versioning.CustomVersions),
customVersions: currentDir.Versioning.CustomVersions,
optionOverrides: currentDir.Versioning.Options,
mapStructTypesOverrides: currentDir.Versioning.MapStructTypes);

View File

@ -32,8 +32,8 @@ public class SettingsViewModel : ViewModel
set => SetProperty(ref _selectedUpdateMode, value);
}
private ETexturePlatform _selectedUePlatform;
public ETexturePlatform SelectedUePlatform
private EPlatform _selectedUePlatform;
public EPlatform SelectedUePlatform
{
get => _selectedUePlatform;
set => SetProperty(ref _selectedUePlatform, value);
@ -46,8 +46,8 @@ public class SettingsViewModel : ViewModel
set => SetProperty(ref _selectedUeGame, value);
}
private IList<FCustomVersion> _selectedCustomVersions;
public IList<FCustomVersion> SelectedCustomVersions
private FCustomVersionContainer _selectedCustomVersions;
public FCustomVersionContainer SelectedCustomVersions
{
get => _selectedCustomVersions;
set => SetProperty(ref _selectedCustomVersions, value);
@ -163,7 +163,7 @@ public class SettingsViewModel : ViewModel
public ReadOnlyObservableCollection<ELodFormat> LodExportFormats { get; private set; }
public ReadOnlyObservableCollection<EMaterialFormat> MaterialExportFormats { get; private set; }
public ReadOnlyObservableCollection<ETextureFormat> TextureExportFormats { get; private set; }
public ReadOnlyObservableCollection<ETexturePlatform> Platforms { get; private set; }
public ReadOnlyObservableCollection<EPlatform> Platforms { get; private set; }
private string _outputSnapshot;
private string _rawDataSnapshot;
@ -173,9 +173,9 @@ public class SettingsViewModel : ViewModel
private string _modelSnapshot;
private string _gameSnapshot;
private EUpdateMode _updateModeSnapshot;
private ETexturePlatform _uePlatformSnapshot;
private EPlatform _uePlatformSnapshot;
private EGame _ueGameSnapshot;
private IList<FCustomVersion> _customVersionsSnapshot;
private FCustomVersionContainer _customVersionsSnapshot;
private IDictionary<string, bool> _optionsSnapshot;
private IDictionary<string, KeyValuePair<string, string>> _mapStructTypesSnapshot;
private ELanguage _assetLanguageSnapshot;
@ -187,12 +187,7 @@ public class SettingsViewModel : ViewModel
private EMaterialFormat _materialExportFormatSnapshot;
private ETextureFormat _textureExportFormatSnapshot;
private bool _mappingsUpdate = false;
public SettingsViewModel()
{
}
private bool _mappingsUpdate;
public void Initialize()
{
@ -256,7 +251,7 @@ public class SettingsViewModel : ViewModel
LodExportFormats = new ReadOnlyObservableCollection<ELodFormat>(new ObservableCollection<ELodFormat>(EnumerateLodExportFormat()));
MaterialExportFormats = new ReadOnlyObservableCollection<EMaterialFormat>(new ObservableCollection<EMaterialFormat>(EnumerateMaterialExportFormat()));
TextureExportFormats = new ReadOnlyObservableCollection<ETextureFormat>(new ObservableCollection<ETextureFormat>(EnumerateTextureExportFormat()));
Platforms = new ReadOnlyObservableCollection<ETexturePlatform>(new ObservableCollection<ETexturePlatform>(EnumerateUePlatforms()));
Platforms = new ReadOnlyObservableCollection<EPlatform>(new ObservableCollection<EPlatform>(EnumerateUePlatforms()));
}
public bool Save(out List<SettingsOut> whatShouldIDo)
@ -323,5 +318,5 @@ public class SettingsViewModel : ViewModel
private IEnumerable<ELodFormat> EnumerateLodExportFormat() => Enum.GetValues<ELodFormat>();
private IEnumerable<EMaterialFormat> EnumerateMaterialExportFormat() => Enum.GetValues<EMaterialFormat>();
private IEnumerable<ETextureFormat> EnumerateTextureExportFormat() => Enum.GetValues<ETextureFormat>();
private IEnumerable<ETexturePlatform> EnumerateUePlatforms() => Enum.GetValues<ETexturePlatform>();
private IEnumerable<EPlatform> EnumerateUePlatforms() => Enum.GetValues<EPlatform>();
}

View File

@ -12,17 +12,17 @@ namespace FModel.Views.Resources.Controls;
public partial class DictionaryEditor
{
private readonly List<FCustomVersion> _defaultCustomVersions;
private readonly FCustomVersionContainer _defaultCustomVersions;
private readonly Dictionary<string, bool> _defaultOptions;
private readonly Dictionary<string, KeyValuePair<string, string>> _defaultMapStructTypes;
public List<FCustomVersion> CustomVersions { get; private set; }
public FCustomVersionContainer CustomVersions { get; private set; }
public Dictionary<string, bool> Options { get; private set; }
public Dictionary<string, KeyValuePair<string, string>> MapStructTypes { get; private set; }
public DictionaryEditor(string title)
{
_defaultCustomVersions = new List<FCustomVersion> { new() { Key = new FGuid(), Version = 0 } };
_defaultCustomVersions = new FCustomVersionContainer(new[] { new FCustomVersion { Key = new FGuid(), Version = 0 } });
_defaultOptions = new Dictionary<string, bool> { { "key1", true }, { "key2", false } };
_defaultMapStructTypes = new Dictionary<string, KeyValuePair<string, string>> { { "MapName", new KeyValuePair<string, string>("KeyType", "ValueType") } };
@ -32,28 +32,19 @@ public partial class DictionaryEditor
MyAvalonEditor.SyntaxHighlighting = AvalonExtensions.HighlighterSelector("");
}
public DictionaryEditor(IList<FCustomVersion> customVersions, string title) : this(title)
public DictionaryEditor(FCustomVersionContainer customVersions, string title) : this(title)
{
MyAvalonEditor.Document = new TextDocument
{
Text = JsonConvert.SerializeObject(customVersions ?? _defaultCustomVersions, Formatting.Indented)
};
MyAvalonEditor.Document = new TextDocument { Text = JsonConvert.SerializeObject(customVersions ?? _defaultCustomVersions, Formatting.Indented) };
}
public DictionaryEditor(IDictionary<string, bool> options, string title) : this(title)
{
MyAvalonEditor.Document = new TextDocument
{
Text = JsonConvert.SerializeObject(options ?? _defaultOptions, Formatting.Indented)
};
MyAvalonEditor.Document = new TextDocument { Text = JsonConvert.SerializeObject(options ?? _defaultOptions, Formatting.Indented) };
}
public DictionaryEditor(IDictionary<string, KeyValuePair<string, string>> options, string title) : this(title)
{
MyAvalonEditor.Document = new TextDocument
{
Text = JsonConvert.SerializeObject(options ?? _defaultMapStructTypes, Formatting.Indented)
};
MyAvalonEditor.Document = new TextDocument { Text = JsonConvert.SerializeObject(options ?? _defaultMapStructTypes, Formatting.Indented) };
}
private void OnClick(object sender, RoutedEventArgs e)
@ -63,7 +54,7 @@ public partial class DictionaryEditor
switch (Title)
{
case "Versioning Configuration (Custom Versions)":
CustomVersions = JsonConvert.DeserializeObject<List<FCustomVersion>>(MyAvalonEditor.Document.Text);
CustomVersions = JsonConvert.DeserializeObject<FCustomVersionContainer>(MyAvalonEditor.Document.Text);
// DialogResult = !CustomVersions.SequenceEqual(_defaultCustomVersions);
DialogResult = true;
Close();
@ -87,7 +78,7 @@ public partial class DictionaryEditor
catch
{
HeBrokeIt.Text = "GG YOU BROKE THE FORMAT, FIX THE JSON OR RESET THE CHANGES!";
HeBrokeIt.Foreground = new SolidColorBrush((Color) ColorConverter.ConvertFromString(Constants.RED));
HeBrokeIt.Foreground = new SolidColorBrush((Color) ColorConverter.ConvertFromString(Constants.RED)!);
}
}
@ -95,18 +86,9 @@ public partial class DictionaryEditor
{
MyAvalonEditor.Document = Title switch
{
"Versioning Configuration (Custom Versions)" => new TextDocument
{
Text = JsonConvert.SerializeObject(_defaultCustomVersions, Formatting.Indented)
},
"Versioning Configuration (Options)" => new TextDocument
{
Text = JsonConvert.SerializeObject(_defaultOptions, Formatting.Indented)
},
"Versioning Configuration (MapStructTypes)" => new TextDocument
{
Text = JsonConvert.SerializeObject(_defaultMapStructTypes, Formatting.Indented)
},
"Versioning Configuration (Custom Versions)" => new TextDocument { Text = JsonConvert.SerializeObject(_defaultCustomVersions, Formatting.Indented) },
"Versioning Configuration (Options)" => new TextDocument { Text = JsonConvert.SerializeObject(_defaultOptions, Formatting.Indented) },
"Versioning Configuration (MapStructTypes)" => new TextDocument { Text = JsonConvert.SerializeObject(_defaultMapStructTypes, Formatting.Indented) },
_ => throw new NotImplementedException()
};
}

View File

@ -31,7 +31,7 @@ public class Options
public readonly Dictionary<string, Texture> Icons;
private readonly ETexturePlatform _platform;
private readonly EPlatform _platform;
private readonly string _game;
public Options()