From 8bceb10f4456a272f5103e66a09d133b40c38b0d Mon Sep 17 00:00:00 2001 From: GMatrixGames Date: Sun, 19 Sep 2021 22:24:12 -0400 Subject: [PATCH 01/58] Force quest bundles to use 512x512 image, and Tandem images based on display asset settings --- CUE4Parse | 2 +- FModel/Creator/Bases/FN/BaseIcon.cs | 2 +- FModel/Creator/Bases/FN/BaseQuest.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CUE4Parse b/CUE4Parse index 6d911668..7423a772 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 6d911668e730b3f4c1eab0b3f7e9a99bc3dde943 +Subproject commit 7423a772c652d5bd957dd35c67ab5f6c39db63fc diff --git a/FModel/Creator/Bases/FN/BaseIcon.cs b/FModel/Creator/Bases/FN/BaseIcon.cs index 6ecfce2b..525a7f80 100644 --- a/FModel/Creator/Bases/FN/BaseIcon.cs +++ b/FModel/Creator/Bases/FN/BaseIcon.cs @@ -40,7 +40,7 @@ namespace FModel.Creator.Bases.FN Preview = preview; else if (Object.TryGetValue(out FPackageIndex itemDefinition, "HeroDefinition", "WeaponDefinition")) Preview = Utils.GetBitmap(itemDefinition); - else if (Object.TryGetValue(out FSoftObjectPath largePreview, "LargePreviewImage", "SidePanelIcon", "EntryListIcon", "SmallPreviewImage", "ItemDisplayAsset", "LargeIcon", "ToastIcon", "SmallIcon")) + else if (Object.TryGetValue(out FSoftObjectPath largePreview, "LargePreviewImage", "EntryListIcon", "SmallPreviewImage", "ItemDisplayAsset", "LargeIcon", "ToastIcon", "SmallIcon")) Preview = Utils.GetBitmap(largePreview); else if (Object.TryGetValue(out string s, "LargePreviewImage") && !string.IsNullOrEmpty(s)) Preview = Utils.GetBitmap(s); diff --git a/FModel/Creator/Bases/FN/BaseQuest.cs b/FModel/Creator/Bases/FN/BaseQuest.cs index b4a1df51..469d296c 100644 --- a/FModel/Creator/Bases/FN/BaseQuest.cs +++ b/FModel/Creator/Bases/FN/BaseQuest.cs @@ -72,7 +72,7 @@ namespace FModel.Creator.Bases.FN Description += "\n" + completionText.Text; if (Object.TryGetValue(out FSoftObjectPath tandemCharacterData, "TandemCharacterData") && Utils.TryLoadObject(tandemCharacterData.AssetPathName.Text, out UObject uObject) && - uObject.TryGetValue(out FSoftObjectPath tandemIcon, "SidePanelIcon", "EntryListIcon", "ToastIcon")) + uObject.TryGetValue(out FSoftObjectPath tandemIcon, "EntryListIcon", "ToastIcon")) { Preview = Utils.GetBitmap(tandemIcon); } From 3768ad2fdde47e7e6982c8ee8e183f054b36ad12 Mon Sep 17 00:00:00 2001 From: GMatrixGames Date: Mon, 20 Sep 2021 19:13:03 -0400 Subject: [PATCH 02/58] No need for FName "Rarity" anymore. --- CUE4Parse | 2 +- FModel/Creator/Bases/FN/BaseCommunity.cs | 40 +----------------------- FModel/Creator/Bases/FN/BaseIcon.cs | 39 ++--------------------- FModel/Creator/Bases/FN/BaseIconStats.cs | 40 +----------------------- 4 files changed, 6 insertions(+), 115 deletions(-) diff --git a/CUE4Parse b/CUE4Parse index 7423a772..efdb3872 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 7423a772c652d5bd957dd35c67ab5f6c39db63fc +Subproject commit efdb3872f392dfa5431e5646bf7f66229eb34afb diff --git a/FModel/Creator/Bases/FN/BaseCommunity.cs b/FModel/Creator/Bases/FN/BaseCommunity.cs index 78c2fe30..018ea547 100644 --- a/FModel/Creator/Bases/FN/BaseCommunity.cs +++ b/FModel/Creator/Bases/FN/BaseCommunity.cs @@ -35,7 +35,7 @@ namespace FModel.Creator.Bases.FN if (Object.TryGetValue(out FPackageIndex series, "Series") && Utils.TryGetPackageIndexExport(series, out UObject export)) _rarityName = export.Name; else - _rarityName = GetRarityName(Object.GetOrDefault("Rarity")); + _rarityName = Object.GetOrDefault("Rarity", EFortRarity.Uncommon).GetDescription(); if (Object.TryGetValue(out FGameplayTagContainer gameplayTags, "GameplayTags")) CheckGameplayTags(gameplayTags); @@ -108,44 +108,6 @@ namespace FModel.Creator.Bases.FN return number > 10 ? $"C{number / 10 + 1} S{s[^1..]}" : $"C1 S{s}"; } - private string GetRarityName(FName r) - { - var rarity = EFortRarity.Uncommon; - switch (r.Text) - { - case "EFortRarity::Common": - case "EFortRarity::Handmade": - rarity = EFortRarity.Common; - break; - case "EFortRarity::Rare": - case "EFortRarity::Sturdy": - rarity = EFortRarity.Rare; - break; - case "EFortRarity::Epic": - case "EFortRarity::Quality": - rarity = EFortRarity.Epic; - break; - case "EFortRarity::Legendary": - case "EFortRarity::Fine": - rarity = EFortRarity.Legendary; - break; - case "EFortRarity::Mythic": - case "EFortRarity::Elegant": - rarity = EFortRarity.Mythic; - break; - case "EFortRarity::Transcendent": - case "EFortRarity::Masterwork": - rarity = EFortRarity.Transcendent; - break; - case "EFortRarity::Unattainable": - case "EFortRarity::Badass": - rarity = EFortRarity.Unattainable; - break; - } - - return rarity.GetDescription(); - } - private new void DrawBackground(SKCanvas c) { if (_design.Rarities.TryGetValue(_rarityName, out var rarity)) diff --git a/FModel/Creator/Bases/FN/BaseIcon.cs b/FModel/Creator/Bases/FN/BaseIcon.cs index 525a7f80..84c48dd8 100644 --- a/FModel/Creator/Bases/FN/BaseIcon.cs +++ b/FModel/Creator/Bases/FN/BaseIcon.cs @@ -33,7 +33,7 @@ namespace FModel.Creator.Bases.FN { // rarity if (Object.TryGetValue(out FPackageIndex series, "Series")) GetSeries(series); - else GetRarity(Object.GetOrDefault("Rarity")); // default is uncommon + else GetRarity(Object.GetOrDefault("Rarity", EFortRarity.Uncommon)); // default is uncommon // preview if (isUsingDisplayAsset && Utils.TryGetDisplayAsset(Object, out var preview)) @@ -165,44 +165,11 @@ namespace FModel.Creator.Bases.FN } } - private void GetRarity(FName r) + private void GetRarity(EFortRarity r) { if (!Utils.TryLoadObject("FortniteGame/Content/Balance/RarityData.RarityData", out UObject export)) return; - var rarity = EFortRarity.Uncommon; - switch (r.Text) - { - case "EFortRarity::Common": - case "EFortRarity::Handmade": - rarity = EFortRarity.Common; - break; - case "EFortRarity::Rare": - case "EFortRarity::Sturdy": - rarity = EFortRarity.Rare; - break; - case "EFortRarity::Epic": - case "EFortRarity::Quality": - rarity = EFortRarity.Epic; - break; - case "EFortRarity::Legendary": - case "EFortRarity::Fine": - rarity = EFortRarity.Legendary; - break; - case "EFortRarity::Mythic": - case "EFortRarity::Elegant": - rarity = EFortRarity.Mythic; - break; - case "EFortRarity::Transcendent": - case "EFortRarity::Masterwork": - rarity = EFortRarity.Transcendent; - break; - case "EFortRarity::Unattainable": - case "EFortRarity::Badass": - rarity = EFortRarity.Unattainable; - break; - } - - if (export.GetByIndex((int) rarity) is { } data && + if (export.GetByIndex((int) r) is { } data && data.TryGetValue(out FLinearColor color1, "Color1") && data.TryGetValue(out FLinearColor color2, "Color2") && data.TryGetValue(out FLinearColor color3, "Color3")) diff --git a/FModel/Creator/Bases/FN/BaseIconStats.cs b/FModel/Creator/Bases/FN/BaseIconStats.cs index b1c44508..682f97d0 100644 --- a/FModel/Creator/Bases/FN/BaseIconStats.cs +++ b/FModel/Creator/Bases/FN/BaseIconStats.cs @@ -114,7 +114,7 @@ namespace FModel.Creator.Bases.FN weaponRowValue.TryGetValue(out UDataTable durabilityTable, "Durability") && weaponRowValue.TryGetValue(out FName durabilityRowName, "DurabilityRowName") && durabilityTable.TryGetDataTableRow(durabilityRowName.Text, StringComparison.OrdinalIgnoreCase, out var durability) && - durability.TryGetValue(out int duraByRarity, GetRarityName(Object.GetOrDefault("Rarity")))) + durability.TryGetValue(out int duraByRarity, Object.GetOrDefault("Rarity", EFortRarity.Uncommon).GetDescription())) { _statistics.Add(new IconStat(Utils.GetLocalizedResource("", "6FA2882140CB69DE32FD73A392F0585B", "Durability"), duraByRarity, 20)); } @@ -153,44 +153,6 @@ namespace FModel.Creator.Bases.FN return false; } - private string GetRarityName(FName r) - { - var rarity = EFortRarity.Uncommon; - switch (r.Text) - { - case "EFortRarity::Common": - case "EFortRarity::Handmade": - rarity = EFortRarity.Common; - break; - case "EFortRarity::Rare": - case "EFortRarity::Sturdy": - rarity = EFortRarity.Rare; - break; - case "EFortRarity::Epic": - case "EFortRarity::Quality": - rarity = EFortRarity.Epic; - break; - case "EFortRarity::Legendary": - case "EFortRarity::Fine": - rarity = EFortRarity.Legendary; - break; - case "EFortRarity::Mythic": - case "EFortRarity::Elegant": - rarity = EFortRarity.Mythic; - break; - case "EFortRarity::Transcendent": - case "EFortRarity::Masterwork": - rarity = EFortRarity.Transcendent; - break; - case "EFortRarity::Unattainable": - case "EFortRarity::Badass": - rarity = EFortRarity.Unattainable; - break; - } - - return rarity.GetDescription(); - } - private readonly SKPaint _informationPaint = new() { IsAntialias = true, FilterQuality = SKFilterQuality.High, From 16411edf9c63d74ca9fdf402d83430dc00ecc335 Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Wed, 22 Sep 2021 15:59:23 +0200 Subject: [PATCH 03/58] i'd say better than nothing --- CUE4Parse | 2 +- FModel/FModel.csproj | 4 ++-- FModel/MainWindow.xaml | 9 +++++++++ FModel/ViewModels/CUE4ParseViewModel.cs | 6 ++++++ FModel/ViewModels/Commands/MenuCommand.cs | 7 +++++++ FModel/ViewModels/TabControlViewModel.cs | 12 +++++++++++- FModel/Views/Resources/Resources.xaml | 2 +- 7 files changed, 37 insertions(+), 5 deletions(-) diff --git a/CUE4Parse b/CUE4Parse index efdb3872..29316b4a 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit efdb3872f392dfa5431e5646bf7f66229eb34afb +Subproject commit 29316b4ae38c3690fa24e39bcd48ac63a4a5805e diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index a081481e..801b5904 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -6,8 +6,8 @@ true FModel.ico 4.0.0 - 4.0.1.1 - 4.0.1.1 + 4.0.2.0 + 4.0.2.0 false true win-x64 diff --git a/FModel/MainWindow.xaml b/FModel/MainWindow.xaml index c926fc3c..8d22d73f 100644 --- a/FModel/MainWindow.xaml +++ b/FModel/MainWindow.xaml @@ -64,6 +64,15 @@ + + + + + + + + + diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index db93bd5c..d6bbd1e2 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -20,6 +20,7 @@ using CUE4Parse.UE4.Assets.Exports.Sound; using CUE4Parse.UE4.Assets.Exports.StaticMesh; using CUE4Parse.UE4.Assets.Exports.Texture; using CUE4Parse.UE4.Assets.Exports.Wwise; +using CUE4Parse.UE4.IO; using CUE4Parse.UE4.Localization; using CUE4Parse.UE4.Oodle.Objects; using CUE4Parse.UE4.Shaders; @@ -229,7 +230,12 @@ namespace FModel.ViewModels { cancellationToken.ThrowIfCancellationRequested(); if (Provider.MountedVfs.FirstOrDefault(x => x.Name == file.Name) is not { } vfs) + { + if (Provider.UnloadedVfs.FirstOrDefault(x => x.Name == file.Name) is IoStoreReader store) + file.FileCount = (int)store.Info.TocEntryCount - 1; + continue; + } file.IsEnabled = true; file.MountPoint = vfs.MountPoint; diff --git a/FModel/ViewModels/Commands/MenuCommand.cs b/FModel/ViewModels/Commands/MenuCommand.cs index f1ffbfc1..2a488dfa 100644 --- a/FModel/ViewModels/Commands/MenuCommand.cs +++ b/FModel/ViewModels/Commands/MenuCommand.cs @@ -1,11 +1,13 @@ using System.Diagnostics; using System.Threading; using AdonisUI.Controls; +using FModel.Extensions; using FModel.Framework; using FModel.Services; using FModel.Settings; using FModel.Views; using FModel.Views.Resources.Controls; +using Newtonsoft.Json; namespace FModel.ViewModels.Commands { @@ -28,6 +30,11 @@ namespace FModel.ViewModels.Commands case "Directory_Backup": Helper.OpenWindow("Backup Manager", () => new BackupManager(contextViewModel.CUE4Parse.Provider.GameName).Show()); break; + case "Directory_PackagesInfo": + contextViewModel.CUE4Parse.TabControl.AddTab("Packages Info"); + contextViewModel.CUE4Parse.TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector("json"); + contextViewModel.CUE4Parse.TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(contextViewModel.CUE4Parse.GameDirectory.DirectoryFiles, Formatting.Indented), false); + break; case "Views_AudioPlayer": Helper.OpenWindow("Audio Player", () => new AudioPlayer().Show()); break; diff --git a/FModel/ViewModels/TabControlViewModel.cs b/FModel/ViewModels/TabControlViewModel.cs index f5d7e6c7..f0ba784c 100644 --- a/FModel/ViewModels/TabControlViewModel.cs +++ b/FModel/ViewModels/TabControlViewModel.cs @@ -315,9 +315,19 @@ namespace FModel.ViewModels public void AddTab(string header = null, string directory = null) { if (!CanAddTabs) return; + + var h = header ?? "New Tab"; + var d = directory ?? string.Empty; + if (SelectedTab is { Header : "New Tab" }) + { + SelectedTab.Header = h; + SelectedTab.Directory = d; + return; + } + Application.Current.Dispatcher.Invoke(() => { - _tabItems.Add(new TabItem(header ?? "New Tab", directory ?? string.Empty)); + _tabItems.Add(new TabItem(h, d)); SelectedTab = _tabItems.Last(); }); } diff --git a/FModel/Views/Resources/Resources.xaml b/FModel/Views/Resources/Resources.xaml index 9580f3d9..567bdea8 100644 --- a/FModel/Views/Resources/Resources.xaml +++ b/FModel/Views/Resources/Resources.xaml @@ -36,7 +36,7 @@ M14,12H10V10H14M14,16H10V14H14M20,8H17.19C16.74,7.22 16.12,6.55 15.37,6.04L17,4.41L15.59,3L13.42,5.17C12.96,5.06 12.5,5 12,5C11.5,5 11.04,5.06 10.59,5.17L8.41,3L7,4.41L8.62,6.04C7.88,6.55 7.26,7.22 6.81,8H4V10H6.09C6.04,10.33 6,10.66 6,11V12H4V14H6V15C6,15.34 6.04,15.67 6.09,16H4V18H6.81C7.85,19.79 9.78,21 12,21C14.22,21 16.15,19.79 17.19,18H20V16H17.91C17.96,15.67 18,15.34 18,15V14H20V12H18V11C18,10.66 17.96,10.33 17.91,10H20V8Z M22 10.92L19.26 9.33C21.9 7.08 19.25 2.88 16.08 4.31L15.21 4.68L15.1 3.72C15 2.64 14.44 1.87 13.7 1.42C12.06 .467 9.56 1.12 9.16 3.5L6.41 1.92C5.45 1.36 4.23 1.69 3.68 2.65L2.68 4.38C2.4 4.86 2.57 5.47 3.05 5.75L10.84 10.25L12.34 7.65L14.07 8.65L12.57 11.25L20.36 15.75C20.84 16 21.46 15.86 21.73 15.38L22.73 13.65C23.28 12.69 22.96 11.47 22 10.92M12.37 5C11.5 5.25 10.8 4.32 11.24 3.55C11.5 3.07 12.13 2.91 12.61 3.18C13.38 3.63 13.23 4.79 12.37 5M17.56 8C16.7 8.25 16 7.32 16.44 6.55C16.71 6.07 17.33 5.91 17.8 6.18C18.57 6.63 18.42 7.79 17.56 8M20.87 16.88C21.28 16.88 21.67 16.74 22 16.5V20C22 21.11 21.11 22 20 22H4C2.9 22 2 21.11 2 20V11H10.15L11 11.5V20H13V12.65L19.87 16.61C20.17 16.79 20.5 16.88 20.87 16.88Z M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z - M11.5,2C6.81,2,3,5.81,3,10.5S6.81,19,11.5,19H12v3c4.86-2.34,8-7,8-11.5C20,5.81,16.19,2,11.5,2z M11.48,16 c-0.59,0-1.05-0.47-1.05-1.05c0-0.59,0.47-1.04,1.05-1.04c0.59,0,1.04,0.45,1.04,1.04C12.52,15.53,12.08,16,11.48,16z M13.99,9.83 c-0.63,0.93-1.23,1.21-1.56,1.81c-0.08,0.14-0.13,0.26-0.16,0.49c-0.05,0.39-0.36,0.68-0.75,0.68h-0.03 c-0.44,0-0.79-0.38-0.75-0.82c0.03-0.28,0.09-0.57,0.25-0.84c0.41-0.73,1.18-1.16,1.63-1.8c0.48-0.68,0.21-1.94-1.14-1.94 c-0.61,0-1.01,0.32-1.26,0.7c-0.19,0.29-0.57,0.39-0.89,0.25l0,0c-0.42-0.18-0.6-0.7-0.34-1.07C9.5,6.55,10.35,6,11.47,6 c1.23,0,2.08,0.56,2.51,1.26C14.34,7.87,14.56,8.99,13.99,9.83z + M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 15c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm1-8h-2V7h2v2z M6,19c0,1.1,0.9,2,2,2h8c1.1,0,2-0.9,2-2V7H6V19z M9.17,12.59c-0.39-0.39-0.39-1.02,0-1.41c0.39-0.39,1.02-0.39,1.41,0 L12,12.59l1.41-1.41c0.39-0.39,1.02-0.39,1.41,0s0.39,1.02,0,1.41L13.41,14l1.41,1.41c0.39,0.39,0.39,1.02,0,1.41 s-1.02,0.39-1.41,0L12,15.41l-1.41,1.41c-0.39,0.39-1.02,0.39-1.41,0c-0.39-0.39-0.39-1.02,0-1.41L10.59,14L9.17,12.59z M18,4h-2.5 l-0.71-0.71C14.61,3.11,14.35,3,14.09,3H9.91c-0.26,0-0.52,0.11-0.7,0.29L8.5,4H6C5.45,4,5,4.45,5,5s0.45,1,1,1h12 c0.55,0,1-0.45,1-1S18.55,4,18,4z M18,4v16H6V4H18 M18,2H6C4.9,2,4,2.9,4,4v16c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V4C20,2.9,19.1,2,18,2L18,2z M7,19h10v-6H7 V19z M10,10h4v1h3V5H7v6h3V10z M16,16.92C15.67,16.97 15.34,17 15,17C14.66,17 14.33,16.97 14,16.92V13.41L11.5,15.89C11,15.5 10.5,15 10.11,14.5L12.59,12H9.08C9.03,11.67 9,11.34 9,11C9,10.66 9.03,10.33 9.08,10H12.59L10.11,7.5C10.3,7.25 10.5,7 10.76,6.76V6.76C11,6.5 11.25,6.3 11.5,6.11L14,8.59V5.08C14.33,5.03 14.66,5 15,5C15.34,5 15.67,5.03 16,5.08V8.59L18.5,6.11C19,6.5 19.5,7 19.89,7.5L17.41,10H20.92C20.97,10.33 21,10.66 21,11C21,11.34 20.97,11.67 20.92,12H17.41L19.89,14.5C19.7,14.75 19.5,15 19.24,15.24V15.24C19,15.5 18.75,15.7 18.5,15.89L16,13.41V16.92H16V16.92M5,19A2,2 0 0,1 7,17A2,2 0 0,1 9,19A2,2 0 0,1 7,21A2,2 0 0,1 5,19H5Z From 2d8a1322e11c59f71857ce7f380d11401348c050 Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Wed, 22 Sep 2021 19:47:12 +0200 Subject: [PATCH 04/58] prout --- FModel/MainWindow.xaml | 2 +- FModel/ViewModels/Commands/MenuCommand.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FModel/MainWindow.xaml b/FModel/MainWindow.xaml index 8d22d73f..4489bc8f 100644 --- a/FModel/MainWindow.xaml +++ b/FModel/MainWindow.xaml @@ -64,7 +64,7 @@ - + diff --git a/FModel/ViewModels/Commands/MenuCommand.cs b/FModel/ViewModels/Commands/MenuCommand.cs index 2a488dfa..34609b57 100644 --- a/FModel/ViewModels/Commands/MenuCommand.cs +++ b/FModel/ViewModels/Commands/MenuCommand.cs @@ -30,8 +30,8 @@ namespace FModel.ViewModels.Commands case "Directory_Backup": Helper.OpenWindow("Backup Manager", () => new BackupManager(contextViewModel.CUE4Parse.Provider.GameName).Show()); break; - case "Directory_PackagesInfo": - contextViewModel.CUE4Parse.TabControl.AddTab("Packages Info"); + case "Directory_ArchivesInfo": + contextViewModel.CUE4Parse.TabControl.AddTab("Archives Info"); contextViewModel.CUE4Parse.TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector("json"); contextViewModel.CUE4Parse.TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(contextViewModel.CUE4Parse.GameDirectory.DirectoryFiles, Formatting.Indented), false); break; From a2f7098063f09ee87a52ba17414f404654dfcae0 Mon Sep 17 00:00:00 2001 From: floxay <57007485+floxay@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:08:04 +0200 Subject: [PATCH 05/58] Fix normals in model viewer --- FModel/ViewModels/ModelViewerViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FModel/ViewModels/ModelViewerViewModel.cs b/FModel/ViewModels/ModelViewerViewModel.cs index 29140f8b..2cc7e260 100644 --- a/FModel/ViewModels/ModelViewerViewModel.cs +++ b/FModel/ViewModels/ModelViewerViewModel.cs @@ -167,7 +167,7 @@ namespace FModel.ViewModels { builder.AddNode( new Vector3(verts[i].Position.X, -verts[i].Position.Y, verts[i].Position.Z), - new Vector3(verts[i].Normal.X, verts[i].Normal.Y, verts[i].Normal.Z), + new Vector3(verts[i].Normal.X, -verts[i].Normal.Y, verts[i].Normal.Z), new Vector2(verts[i].UV.U, verts[i].UV.V)); } From 743303b4db331e2db90b4716b6106304cb459426 Mon Sep 17 00:00:00 2001 From: Not Officer Date: Thu, 23 Sep 2021 14:10:21 +0200 Subject: [PATCH 06/58] use official adonis ui --- FModel/FModel.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index 801b5904..12aff1b5 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -102,14 +102,14 @@ - - + + - + From fa9f64b0602f39bffb4373343f735883e8f4216b Mon Sep 17 00:00:00 2001 From: Not Officer Date: Thu, 23 Sep 2021 14:10:37 +0200 Subject: [PATCH 07/58] added simple editorconfig --- .editorconfig | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..b436bf08 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,164 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +# C# files +[*.cs] +indent_size = 4 +# New line preferences +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_within_query_expression_clauses = true + +# Code files +[*.{cs,csx,vb,vbx}] +indent_size = 4 + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_indent_labels = one_less_than_current + +# avoid this. unless absolutely necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# only use var when it's obvious what the variable type is +csharp_style_var_for_built_in_types = false:none +csharp_style_var_when_type_is_apparent = false:none +csharp_style_var_elsewhere = false:suggestion + +# use language keywords instead of BCL types +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion + +# name all constant fields using PascalCase +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style + +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.required_modifiers = const + +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# internal and private fields should be _camelCase +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style + +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal + +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case + +# Code style defaults +dotnet_sort_system_directives_first = true +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = false + +# Expression-level preferences +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion + +# Expression-bodied members +csharp_style_expression_bodied_methods = false:none +csharp_style_expression_bodied_constructors = false:none +csharp_style_expression_bodied_operators = false:none +csharp_style_expression_bodied_properties = true:none +csharp_style_expression_bodied_indexers = true:none +csharp_style_expression_bodied_accessors = true:none + +# Pattern matching +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion + +# Null checking preferences +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = do_not_ignore +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +[*.{asm,inc}] +indent_size = 8 + +# Visual Studio Solution Files +[*.sln] +indent_style = tab + +# Visual Studio XML Project Files +[*.{csproj,vbproj,vcxproj.filters,proj,projitems,shproj}] +indent_size = 2 + +# XML Configuration Files +[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}] +indent_size = 2 + +[CMakeLists.txt] +indent_size = 2 + +# Makefiles +[Makefile] +indent_style = tab + +# Batch Files +[*.{cmd,bat}] +indent_size = 2 +end_of_line = crlf + +# Bash Files +[*.sh] +end_of_line = lf + +# Web Files +[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,pcss,svg,vue}] +indent_size = 2 + +# Markdown Files +[*.md] +trim_trailing_whitespace = false + +# JSON Files +[*.{json,json5,webmanifest}] +indent_size = 2 From f87fc8baeb16fb4c20e11e6a450c258e1a54aab6 Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Wed, 29 Sep 2021 22:09:07 +0200 Subject: [PATCH 08/58] bug fixes --- FModel/Creator/Utils.cs | 10 +-- FModel/ViewModels/CUE4ParseViewModel.cs | 49 +++++----- FModel/ViewModels/MapViewerViewModel.cs | 114 +++++++++++------------- FModel/Views/MapViewer.xaml | 14 +-- 4 files changed, 95 insertions(+), 92 deletions(-) diff --git a/FModel/Creator/Utils.cs b/FModel/Creator/Utils.cs index 9a6fd51b..915dc477 100644 --- a/FModel/Creator/Utils.cs +++ b/FModel/Creator/Utils.cs @@ -46,7 +46,7 @@ namespace FModel.Creator var path = $"/Game/Catalog/MI_OfferImages/MI_{uObject.Name.Replace("Athena_Commando_", string.Empty)}"; if (!TryLoadObject(path, out UMaterialInstanceConstant material)) // non-obfuscated item definition { - if (!TryLoadObject($"{path[..path.LastIndexOf('_')]}_{path.SubstringAfterLast('_').ToLower()}", out material)) // Try to get MI with lowercase obfuscation + if (!TryLoadObject($"{path[..path.LastIndexOf('_')]}_{path.SubstringAfterLast('_').ToLower()}", out material)) // Try to get MI with lowercase obfuscation TryLoadObject(path[..path.LastIndexOf('_')], out material); // hopefully gets obfuscated item definition } @@ -122,11 +122,11 @@ namespace FModel.Creator me.ScalePixels(pixmap, SKFilterQuality.Medium); return bmp; } - - public static void ClearToTransparent(this SKBitmap me) { + + public static void ClearToTransparent(this SKBitmap me, SKColor colorToDelete) { var colors = me.Pixels; for (var n = 0; n < colors.Length; n++) { - if (colors[n] != SKColors.Black) continue; + if (colors[n] != colorToDelete) continue; colors[n] = SKColors.Transparent; } me.Pixels = colors; @@ -274,4 +274,4 @@ namespace FModel.Creator return ret; } } -} \ No newline at end of file +} diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index d6bbd1e2..73689e17 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -371,7 +371,7 @@ namespace FModel.ViewModels { Thread.Sleep(10); cancellationToken.ThrowIfCancellationRequested(); - Extract(asset.FullPath, TabControl.HasNoTabs); + try {Extract(asset.FullPath, TabControl.HasNoTabs);} catch {/**/} } foreach (var f in folder.Folders) ExtractFolder(cancellationToken, f); @@ -395,7 +395,7 @@ namespace FModel.ViewModels { Thread.Sleep(10); cancellationToken.ThrowIfCancellationRequested(); - Extract(asset.FullPath, TabControl.HasNoTabs, true); + try {Extract(asset.FullPath, TabControl.HasNoTabs, true);} catch {/**/} } foreach (var f in folder.Folders) SaveFolder(cancellationToken, f); @@ -625,25 +625,10 @@ namespace FModel.ViewModels } case UStaticMesh: case USkeletalMesh: - case UMaterialInterface when UserSettings.Default.IsAutoSaveMaterials: // don't trigger model viewer if false - case UAnimSequence when UserSettings.Default.IsAutoSaveAnimations: // don't trigger model viewer if false { - if (UserSettings.Default.IsAutoSaveMaterials || UserSettings.Default.IsAutoSaveMeshes || UserSettings.Default.IsAutoSaveAnimations) + if (UserSettings.Default.IsAutoSaveMeshes) { - 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("Successfully saved {FileName}", savedFileName); - FLogger.AppendInformation(); - FLogger.AppendText($"Successfully saved {savedFileName}", Constants.WHITE, true); - } - else - { - Log.Error("{FileName} could not be saved", savedFileName); - FLogger.AppendError(); - FLogger.AppendText($"Could not save '{savedFileName}'", Constants.WHITE, true); - } + SaveExport(export); } else { @@ -655,6 +640,12 @@ namespace FModel.ViewModels } return true; } + case UMaterialInterface when UserSettings.Default.IsAutoSaveMaterials: + case UAnimSequence when UserSettings.Default.IsAutoSaveAnimations: + { + SaveExport(export); + return true; + } default: { using var package = new CreatorPackage(export, UserSettings.Default.CosmeticStyle); @@ -696,6 +687,24 @@ namespace FModel.ViewModels }); } + private void SaveExport(UObject 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("Successfully saved {FileName}", savedFileName); + FLogger.AppendInformation(); + FLogger.AppendText($"Successfully saved {savedFileName}", Constants.WHITE, true); + } + else + { + Log.Error("{FileName} could not be saved", savedFileName); + FLogger.AppendError(); + FLogger.AppendText($"Could not save '{savedFileName}'", Constants.WHITE, true); + } + } + public void ExportData(string fullPath) { var fileName = fullPath.SubstringAfterLast('/'); @@ -723,4 +732,4 @@ namespace FModel.ViewModels } } } -} \ No newline at end of file +} diff --git a/FModel/ViewModels/MapViewerViewModel.cs b/FModel/ViewModels/MapViewerViewModel.cs index 301835fe..dde9b2e7 100644 --- a/FModel/ViewModels/MapViewerViewModel.cs +++ b/FModel/ViewModels/MapViewerViewModel.cs @@ -31,49 +31,49 @@ namespace FModel.ViewModels Parkour, TimeTrials } - + public class MapViewerViewModel : ViewModel { private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView; private DiscordHandler _discordHandler => DiscordService.DiscordHandler; #region BINDINGS - + private bool _brPois; public bool BrPois { get => _brPois; set => SetProperty(ref _brPois, value, "ApolloGameplay_MapPois"); } - + private bool _brLandmarks; public bool BrLandmarks { get => _brLandmarks; set => SetProperty(ref _brLandmarks, value, "ApolloGameplay_MapLandmarks"); } - + private bool _brTagsLocation; public bool BrTagsLocation { get => _brTagsLocation; set => SetProperty(ref _brTagsLocation, value, "ApolloGameplay_TagsLocation"); } - + private bool _brPatrolsPath; public bool BrPatrolsPath { get => _brPatrolsPath; set => SetProperty(ref _brPatrolsPath, value, "ApolloGameplay_PatrolsPath"); } - + private bool _brUpgradeBenches; public bool BrUpgradeBenches { get => _brUpgradeBenches; set => SetProperty(ref _brUpgradeBenches, value, "ApolloGameplay_UpgradeBenches"); } - + private bool _brPhonebooths; public bool BrPhonebooths { @@ -87,77 +87,77 @@ namespace FModel.ViewModels get => _brVendingMachines; set => SetProperty(ref _brVendingMachines, value, "ApolloGameplay_VendingMachines"); } - + private bool _brFireflies; public bool BrFireflies { get => _brFireflies; set => SetProperty(ref _brFireflies, value, "ApolloGameplay_Fireflies"); } - + private bool _brCorruptionZones; public bool BrCorruptionZones { get => _brCorruptionZones; set => SetProperty(ref _brCorruptionZones, value, "ApolloGameplay_CorruptionZones"); } - + private bool _brCubeMovements; public bool BrCubeMovements { get => _brCubeMovements; set => SetProperty(ref _brCubeMovements, value, "ApolloGameplay_CubeMovements"); } - + private bool _prLandmarks; public bool PrLandmarks { get => _prLandmarks; set => SetProperty(ref _prLandmarks, value, "PapayaGameplay_MapLandmarks"); } - + private bool _prCannonball; public bool PrCannonball { get => _prCannonball; set => SetProperty(ref _prCannonball, value, "PapayaGameplay_CannonballGame"); } - + private bool _prSkydive; public bool PrSkydive { get => _prSkydive; set => SetProperty(ref _prSkydive, value, "PapayaGameplay_SkydiveGame"); } - + private bool _prShootingTargets; public bool PrShootingTargets { get => _prShootingTargets; set => SetProperty(ref _prShootingTargets, value, "PapayaGameplay_ShootingTargets"); } - + private bool _prParkour; public bool PrParkour { get => _prParkour; set => SetProperty(ref _prParkour, value, "PapayaGameplay_ParkourGame"); } - + private bool _prTimeTrials; public bool PrTimeTrials { get => _prTimeTrials; set => SetProperty(ref _prTimeTrials, value, "PapayaGameplay_TimeTrials"); } - + private bool _prVendingMachines; public bool PrVendingMachines { get => _prVendingMachines; set => SetProperty(ref _prVendingMachines, value, "PapayaGameplay_VendingMachines"); } - + private bool _prMusicBlocks; public bool PrMusicBlocks { @@ -177,7 +177,7 @@ namespace FModel.ViewModels get => _mapImage; set => SetProperty(ref _mapImage, value); } - + private BitmapImage _brLayerImage; private BitmapImage _prLayerImage; private BitmapImage _layerImage; @@ -239,8 +239,8 @@ namespace FModel.ViewModels SKPaint p = null; if (key == "ApolloGameplay_CorruptionZones") - p = new SKPaint { BlendMode = SKBlendMode.Color }; - + p = new SKPaint { BlendMode = SKBlendMode.Difference }; + c.DrawBitmap(value.Layer, new SKRect(0, 0, _widthHeight, _widthHeight), p); } @@ -253,7 +253,7 @@ namespace FModel.ViewModels if (bool.TryParse(value.ToString(), out var b)) GenericToggle(propertyName, b); return ret; } - + private async void GenericToggle(string key, bool enabled) { if (_bitmaps[MapIndex].TryGetValue(key, out var layer) && layer.Layer != null) @@ -360,11 +360,11 @@ namespace FModel.ViewModels _layerImage = _prLayerImage; break; } - + RaisePropertyChanged(nameof(MapImage)); RaisePropertyChanged(nameof(LayerImage)); } - + private readonly SKPaint _textPaint = new() { IsAntialias = true, FilterQuality = SKFilterQuality.High, @@ -389,12 +389,12 @@ namespace FModel.ViewModels var ny = (1 - (vector.X + mapRadius) / (mapRadius * 2)) * _widthHeight; return new FVector2D(nx, ny); } - + private async Task LoadBrMiniMap() { if (_bitmaps[0].TryGetValue(_FIRST_BITMAP, out var brMap) && brMap.Layer != null) return; // if map already loaded - + await _threadWorkerView.Begin(_ => { if (!Utils.TryLoadObject("FortniteGame/Content/UI/IngameMap/UIMapManagerBR.Default__UIMapManagerBR_C", out UObject mapManager) || @@ -412,7 +412,7 @@ namespace FModel.ViewModels { if (_bitmaps[1].TryGetValue(_FIRST_BITMAP, out var prMap) && prMap.Layer != null) return; // if map already loaded - + await _threadWorkerView.Begin(_ => { if (!Utils.TryLoadObject("FortniteGame/Content/UI/IngameMap/UIMapManagerPapaya.Default__UIMapManagerPapaya_C", out UObject mapManager) || @@ -423,7 +423,7 @@ namespace FModel.ViewModels _prMiniMapImage = GetImageSource(_bitmaps[1][_FIRST_BITMAP].Layer); }); } - + private async Task LoadQuestIndicatorData() { await _threadWorkerView.Begin(_ => @@ -434,7 +434,7 @@ namespace FModel.ViewModels using var pois = new SKCanvas(poisBitmap); using var brLandmarks = new SKCanvas(brLandmarksBitmap); using var prLandmarks = new SKCanvas(prLandmarksBitmap); - + if (Utils.TryLoadObject("FortniteGame/Content/Quests/QuestIndicatorData", out UObject indicatorData) && indicatorData.TryGetValue(out FStructFallback[] challengeMapPoiData, "ChallengeMapPoiData")) { @@ -444,7 +444,7 @@ namespace FModel.ViewModels !poiData.TryGetValue(out FText text, "Text") || string.IsNullOrEmpty(text.Text) || !poiData.TryGetValue(out FVector worldLocation, "WorldLocation") || !poiData.TryGetValue(out FName discoverBackend, "DiscoverObjectiveBackendName")) continue; - + var shaper = new CustomSKShaper(_textPaint.Typeface); var shapedText = shaper.Shape(text.Text, _textPaint); @@ -479,7 +479,7 @@ namespace FModel.ViewModels _bitmaps[1]["PapayaGameplay_MapLandmarks"] = new MapLayer {Layer = prLandmarksBitmap, IsEnabled = false}; }); } - + private async Task LoadPatrolsPath() { await _threadWorkerView.Begin(_ => @@ -514,7 +514,7 @@ namespace FModel.ViewModels vector = GetMapPosition(relativeLocation, _brRadius); path.LineTo(vector.X, vector.Y); } - + c.DrawPath(path, _pathPaint); c.DrawText(displayName, vector.X, vector.Y - 12.5F, _fillPaint); c.DrawText(displayName, vector.X, vector.Y - 12.5F, _textPaint); @@ -544,7 +544,7 @@ namespace FModel.ViewModels var displayName = Utils.GetLocalizedResource("", "D998BEF44F051E0885C6C58565934BEA", "Cannonball"); var vector = GetMapPosition(relativeLocation, _prRadius); - + c.DrawPoint(vector.X, vector.Y, _pathPaint); c.DrawText(displayName, vector.X, vector.Y - 12.5F, _fillPaint); c.DrawText(displayName, vector.X, vector.Y - 12.5F, _textPaint); @@ -573,7 +573,7 @@ namespace FModel.ViewModels !uObject.TryGetValue(out FVector relativeLocation, "RelativeLocation")) continue; var vector = GetMapPosition(relativeLocation, _prRadius); - + c.DrawPoint(vector.X, vector.Y, _pathPaint); c.DrawText(minigameActivityName.Text, vector.X, vector.Y - 12.5F, _fillPaint); c.DrawText(minigameActivityName.Text, vector.X, vector.Y - 12.5F, _textPaint); @@ -582,7 +582,7 @@ namespace FModel.ViewModels _bitmaps[1]["PapayaGameplay_SkydiveGame"] = new MapLayer {Layer = skydiveBitmap, IsEnabled = false}; }); } - + private async Task LoadShootingTargets() { await _threadWorkerView.Begin(_ => @@ -604,7 +604,7 @@ namespace FModel.ViewModels var vector = GetMapPosition(relativeLocation, _prRadius); c.DrawPoint(vector.X, vector.Y, _pathPaint); if (bDone) continue; - + bDone = true; c.DrawText("Shooting Target", vector.X, vector.Y - 12.5F, _fillPaint); c.DrawText("Shooting Target", vector.X, vector.Y - 12.5F, _textPaint); @@ -637,7 +637,7 @@ namespace FModel.ViewModels default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } - + var path = new SKPath(); var exports = Utils.LoadExports($"/PapayaGameplay/LevelOverlays/{file}"); foreach (var export in exports) @@ -647,7 +647,7 @@ namespace FModel.ViewModels if (!export.TryGetValue(out FPackageIndex rootComponent, "RootComponent") || !Utils.TryGetPackageIndexExport(rootComponent, out UObject root) || !root.TryGetValue(out FVector relativeLocation, "RelativeLocation")) continue; - + var vector = GetMapPosition(relativeLocation, _prRadius); if (path.IsEmpty || export.TryGetValue(out bool startsTrial, "StartsTrial") && startsTrial) { @@ -703,7 +703,7 @@ namespace FModel.ViewModels var vector = GetMapPosition(relativeLocation, _prRadius); c.DrawPoint(vector.X, vector.Y, _pathPaint); if (!set.Add(name)) continue; - + c.DrawText(name, vector.X, vector.Y - 12.5F, _fillPaint); c.DrawText(name, vector.X, vector.Y - 12.5F, _textPaint); } @@ -711,7 +711,7 @@ namespace FModel.ViewModels _bitmaps[1]["PapayaGameplay_VendingMachines"] = new MapLayer {Layer = timeTrialsBitmap, IsEnabled = false}; }); } - + private async Task LoadMusicBlocks() { await _threadWorkerView.Begin(_ => @@ -733,7 +733,7 @@ namespace FModel.ViewModels var vector = GetMapPosition(relativeLocation, _prRadius); c.DrawPoint(vector.X, vector.Y, _pathPaint); if (bDone) continue; - + bDone = true; c.DrawText("Music Blocks", vector.X, vector.Y - 12.5F, _fillPaint); c.DrawText("Music Blocks", vector.X, vector.Y - 12.5F, _textPaint); @@ -742,7 +742,7 @@ namespace FModel.ViewModels _bitmaps[1]["PapayaGameplay_MusicBlocks"] = new MapLayer {Layer = shootingTargetsBitmap, IsEnabled = false}; }); } - + private async Task LoadUpgradeBenches() { await _threadWorkerView.Begin(_ => @@ -770,7 +770,7 @@ namespace FModel.ViewModels _bitmaps[0]["ApolloGameplay_UpgradeBenches"] = new MapLayer {Layer = upgradeBenchesBitmap, IsEnabled = false}; }); } - + private async Task LoadPhonebooths() { await _threadWorkerView.Begin(_ => @@ -798,7 +798,7 @@ namespace FModel.ViewModels _bitmaps[0]["ApolloGameplay_Phonebooths"] = new MapLayer {Layer = phoneboothsBitmap, IsEnabled = false}; }); } - + private async Task LoadBrVendingMachines() { await _threadWorkerView.Begin(_ => @@ -827,7 +827,7 @@ namespace FModel.ViewModels _bitmaps[0]["ApolloGameplay_VendingMachines"] = new MapLayer {Layer = vendingMachinesBitmap, IsEnabled = false}; }); } - + private async Task LoadFireflies() { await _threadWorkerView.Begin(_ => @@ -863,7 +863,7 @@ namespace FModel.ViewModels _fillPaint.StrokeWidth = 5; if (!Utils.TryLoadObject("FortniteGame/Content/Quests/QuestTagToLocationDataRows.QuestTagToLocationDataRows", out UDataTable locationData)) return; - + var tagsLocationBitmap = new SKBitmap(_widthHeight, _widthHeight, SKColorType.Rgba8888, SKAlphaType.Premul); using var c = new SKCanvas(tagsLocationBitmap); @@ -878,7 +878,7 @@ namespace FModel.ViewModels var displayName = parts[^2]; if (!int.TryParse(parts[^1], out var _)) displayName += " " + parts[^1]; - + var vector = GetMapPosition(worldLocation, _brRadius); c.DrawPoint(vector.X, vector.Y, _pathPaint); c.DrawText(displayName, vector.X, vector.Y - 12.5F, _fillPaint); @@ -888,13 +888,13 @@ namespace FModel.ViewModels _bitmaps[0]["ApolloGameplay_TagsLocation"] = new MapLayer {Layer = tagsLocationBitmap, IsEnabled = false}; }); } - + private async Task LoadCorruptionZones() { await _threadWorkerView.Begin(_ => { _fillPaint.StrokeWidth = 5; - if (!Utils.TryLoadObject("FortniteGame/Content/Athena/Apollo/Environments/Landscape/Materials/Corruption/T_InitialCorruptionAreas.T_InitialCorruptionAreas", out UTexture2D corruption)) + if (!Utils.TryLoadObject("FortniteGame/Content/Athena/Apollo/Environments/Landscape/Materials/Corruption/T_InitialCorruptionAreas.T_InitialCorruptionAreas", out UTexture2D corruption)) return; var overlay = Utils.GetBitmap(corruption); @@ -906,20 +906,14 @@ namespace FModel.ViewModels c.Clear(); c.Translate(0, width); c.RotateDegrees(-90); - c.DrawRect(0, 0, width, height, new SKPaint - { - IsAntialias = true, FilterQuality = SKFilterQuality.High, - Shader = SKShader.CreateCompose(SKShader.CreateSweepGradient(new SKPoint(width / 2f, height / 2f),new [] { - SKColor.Parse("#352176"), SKColor.Parse("#fd78fa"), SKColor.Parse("#f0b843"), SKColor.Parse("#e54a21") - }, null), SKShader.CreatePerlinNoiseTurbulence(0.05f, 0.05f, 4, 0), SKBlendMode.SrcOver) - }); - c.DrawBitmap(overlay, 0, 0, new SKPaint { BlendMode = SKBlendMode.Darken }); - rotatedBitmap.ClearToTransparent(); + + overlay.ClearToTransparent(SKColors.Lime); + c.DrawBitmap(overlay, 0, 0); _bitmaps[0]["ApolloGameplay_CorruptionZones"] = new MapLayer {Layer = rotatedBitmap.Resize(_widthHeight, _widthHeight), IsEnabled = false}; }); } - + /// /// FortniteGame/Plugins/GameFeatures/CorruptionGameplay/Content/CorruptionGameplay_LevelOverlay.uasset /// too lazy to filters @@ -944,7 +938,7 @@ namespace FModel.ViewModels var objectName = cubeMovementStaticPath.SubPathString.SubstringAfterLast("."); if (!Utils.TryLoadObject($"{objectPath}.{objectName}", out UObject staticPath)) return; - + DrawCubeMovements(c, staticPath, true); } diff --git a/FModel/Views/MapViewer.xaml b/FModel/Views/MapViewer.xaml index f7f9fd27..083914ed 100644 --- a/FModel/Views/MapViewer.xaml +++ b/FModel/Views/MapViewer.xaml @@ -19,7 +19,7 @@ - + @@ -41,7 +41,7 @@ DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" /> + ToolTip="Saving the image with Corruption Zones enabled will better blend this overlay with the map"/> @@ -73,14 +73,14 @@ - + - + @@ -108,14 +108,14 @@ - + - + - + @@ -92,7 +96,7 @@ - + diff --git a/FModel/Views/ModelViewer.xaml.cs b/FModel/Views/ModelViewer.xaml.cs index d4a0b3ca..c71b1c78 100644 --- a/FModel/Views/ModelViewer.xaml.cs +++ b/FModel/Views/ModelViewer.xaml.cs @@ -1,13 +1,20 @@ using System.ComponentModel; +using System.Windows; using System.Windows.Input; +using AdonisUI.Controls; using CUE4Parse.UE4.Assets.Exports; +using CUE4Parse.UE4.Assets.Exports.Material; using FModel.Services; +using FModel.Settings; using FModel.ViewModels; +using MessageBox = AdonisUI.Controls.MessageBox; +using MessageBoxImage = AdonisUI.Controls.MessageBoxImage; namespace FModel.Views { public partial class ModelViewer { + private bool _messageShown; private ApplicationViewModel _applicationView => ApplicationService.ApplicationView; public ModelViewer() @@ -16,7 +23,27 @@ namespace FModel.Views InitializeComponent(); } - public void Load(UObject export) => _applicationView.ModelViewer.LoadExport(export); + public async void Load(UObject export) => await _applicationView.ModelViewer.LoadExport(export); + public async void Swap(UMaterialInstance materialInstance) + { + var sucess = await _applicationView.ModelViewer.TryChangeSelectedMaterial(materialInstance); + if (sucess) + { + _applicationView.CUE4Parse.ModelIsSwappingMaterial = false; + } + else + { + MessageBox.Show(new MessageBoxModel + { + Text = "An attempt to load a material failed.", + Caption = "Error", + Icon = MessageBoxImage.Error, + Buttons = MessageBoxButtons.OkCancel(), + IsSoundEnabled = false + }); + } + } + private void OnClosing(object sender, CancelEventArgs e) { _applicationView.ModelViewer.Clear(); @@ -39,5 +66,33 @@ namespace FModel.Views break; } } + + private void OnFocusClick(object sender, RoutedEventArgs e) + => _applicationView.ModelViewer.FocusOnSelectedMesh(); + + private void OnCopyClick(object sender, RoutedEventArgs e) + => _applicationView.ModelViewer.CopySelectedMaterialName(); + + private void Save(object sender, RoutedEventArgs e) + => _applicationView.ModelViewer.SaveLoadedModels(); + + private void OnChangeMaterialClick(object sender, RoutedEventArgs e) + { + _applicationView.CUE4Parse.ModelIsSwappingMaterial = true; + + if (!_messageShown) + { + MessageBox.Show(new MessageBoxModel + { + Text = "Simply extract a material once FModel will be brought to the foreground. This message will be shown once per Model Viewer's lifetime, close it to begin.", + Caption = "How To Change Material?", + Icon = MessageBoxImage.Information, + IsSoundEnabled = false + }); + _messageShown = true; + } + + MainWindow.YesWeCats.Activate(); + } } } diff --git a/FModel/Views/SettingsView.xaml b/FModel/Views/SettingsView.xaml index db0a1921..4a3ce0a6 100644 --- a/FModel/Views/SettingsView.xaml +++ b/FModel/Views/SettingsView.xaml @@ -320,7 +320,6 @@ - @@ -361,32 +360,29 @@ - + - - - - - - + + + - + - - + - - + - - + - - + From c62d3f691ede0fc571abd43fe4471fe0e677c2b8 Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Sun, 21 Nov 2021 02:02:00 +0100 Subject: [PATCH 52/58] gn --- CUE4Parse | 2 +- FModel/Views/ModelViewer.xaml.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CUE4Parse b/CUE4Parse index 1c565441..c1fbac1c 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 1c5654417460d291f7b80c056f1c54412c292bc8 +Subproject commit c1fbac1c5729fb541d36546f4ff32cbfa347e741 diff --git a/FModel/Views/ModelViewer.xaml.cs b/FModel/Views/ModelViewer.xaml.cs index c71b1c78..09853c6b 100644 --- a/FModel/Views/ModelViewer.xaml.cs +++ b/FModel/Views/ModelViewer.xaml.cs @@ -48,6 +48,7 @@ namespace FModel.Views { _applicationView.ModelViewer.Clear(); _applicationView.ModelViewer.AppendMode = false; + _applicationView.CUE4Parse.ModelIsSwappingMaterial = false; MyAntiCrashGroup.ItemsSource = null; // <3 } From 0669572d5de740afcce46517ae83c63c94c2e674 Mon Sep 17 00:00:00 2001 From: MountainFlash Date: Sun, 21 Nov 2021 12:48:37 +0530 Subject: [PATCH 53/58] shortcuts to recenter and focus selected mesh Shift+C: Recenter Decimal: Focus selected --- FModel/ViewModels/ModelViewerViewModel.cs | 14 ++++++-------- FModel/Views/ModelViewer.xaml | 1 + FModel/Views/ModelViewer.xaml.cs | 3 +++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/FModel/ViewModels/ModelViewerViewModel.cs b/FModel/ViewModels/ModelViewerViewModel.cs index 888f1967..3bbf7c4b 100644 --- a/FModel/ViewModels/ModelViewerViewModel.cs +++ b/FModel/ViewModels/ModelViewerViewModel.cs @@ -458,22 +458,20 @@ namespace FModel.ViewModels private void SetupCameraAndAxis(FBox box, ModelAndCam cam) { if (AppendMode && CanAppend) return; - var meanX = (box.Max.X + box.Min.X) / 2; - var meanY = (box.Max.Y + box.Min.Y) / 2; - var meanZ = (box.Max.Z + box.Min.Z) / 2; + var center = box.GetCenter(); var lineBuilder = new LineBuilder(); - lineBuilder.AddLine(new Vector3(box.Min.X, meanZ, meanY), new Vector3(box.Max.X, meanZ, meanY)); + lineBuilder.AddLine(new Vector3(box.Min.X, center.Z, center.Y), new Vector3(box.Max.X, center.Z, center.Y)); cam.XAxis = lineBuilder.ToLineGeometry3D(); lineBuilder = new LineBuilder(); - lineBuilder.AddLine(new Vector3(meanX, box.Min.Z, meanY), new Vector3(meanX, box.Max.Z, meanY)); + lineBuilder.AddLine(new Vector3(center.X, box.Min.Z, center.Y), new Vector3(center.X, box.Max.Z, center.Y)); cam.YAxis = lineBuilder.ToLineGeometry3D(); lineBuilder = new LineBuilder(); - lineBuilder.AddLine(new Vector3(meanX, meanZ, box.Min.Y), new Vector3(meanX, meanZ, box.Max.Y)); + lineBuilder.AddLine(new Vector3(center.X, center.Z, box.Min.Y), new Vector3(center.X, center.Z, box.Max.Y)); cam.ZAxis = lineBuilder.ToLineGeometry3D(); - cam.Position = new Point3D(box.Max.X + meanX * 2, meanZ, box.Min.Y + meanY * 2); - cam.LookDirection = new Vector3D(-cam.Position.X + meanX, 0, -cam.Position.Z + meanY); + cam.Position = new Point3D(box.Max.X + center.X * 2, center.Z, box.Min.Y + center.Y * 2); + cam.LookDirection = new Vector3D(-cam.Position.X + center.X, 0, -cam.Position.Z + center.Y); } private string FixName(string input) diff --git a/FModel/Views/ModelViewer.xaml b/FModel/Views/ModelViewer.xaml index bc0e09c1..dc07a792 100644 --- a/FModel/Views/ModelViewer.xaml +++ b/FModel/Views/ModelViewer.xaml @@ -122,6 +122,7 @@ + diff --git a/FModel/Views/ModelViewer.xaml.cs b/FModel/Views/ModelViewer.xaml.cs index 09853c6b..b122672a 100644 --- a/FModel/Views/ModelViewer.xaml.cs +++ b/FModel/Views/ModelViewer.xaml.cs @@ -65,6 +65,9 @@ namespace FModel.Views case Key.D: _applicationView.ModelViewer.DiffuseOnlyToggle(); break; + case Key.Decimal: + _applicationView.ModelViewer.FocusOnSelectedMesh(); + break; } } From 94e2ad3cc63a0bc31058675e34f6bec9cdfb21f0 Mon Sep 17 00:00:00 2001 From: Not Officer Date: Sun, 21 Nov 2021 15:32:02 +0100 Subject: [PATCH 54/58] nuget update --- FModel/FModel.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index 282752de..28e1b01b 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -108,7 +108,7 @@ - + From d37c5a922f19211a5a774d9ee8696164f5ad2e44 Mon Sep 17 00:00:00 2001 From: Not Officer Date: Sun, 21 Nov 2021 15:32:31 +0100 Subject: [PATCH 55/58] fix? --- FModel/ViewModels/CUE4ParseViewModel.cs | 22 ++++++++++++++++------ FModel/ViewModels/ModelViewerViewModel.cs | 19 +++++++++++++++---- FModel/ViewModels/ThreadWorkerViewModel.cs | 12 +++++++----- FModel/Views/ModelViewer.xaml.cs | 12 ++++++++---- 4 files changed, 46 insertions(+), 19 deletions(-) diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 0eadf9df..5b57665e 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -6,7 +6,9 @@ using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Windows; + using AdonisUI.Controls; + using CUE4Parse.Encryption.Aes; using CUE4Parse.FileProvider; using CUE4Parse.FileProvider.Vfs; @@ -26,10 +28,13 @@ using CUE4Parse.UE4.Oodle.Objects; using CUE4Parse.UE4.Shaders; using CUE4Parse.UE4.Versions; using CUE4Parse.UE4.Wwise; + using CUE4Parse_Conversion; using CUE4Parse_Conversion.Sounds; using CUE4Parse_Conversion.Textures; + using EpicManifestParser.Objects; + using FModel.Creator; using FModel.Extensions; using FModel.Framework; @@ -37,8 +42,11 @@ using FModel.Services; using FModel.Settings; using FModel.Views; using FModel.Views.Resources.Controls; + using Newtonsoft.Json; + using Serilog; + using SkiaSharp; namespace FModel.ViewModels @@ -147,7 +155,7 @@ namespace FModel.ViewModels byte[] manifestData; var chunksDir = Directory.CreateDirectory(Path.Combine(UserSettings.Default.OutputDirectory, ".data")); - var manifestPath = Path.Combine(chunksDir.FullName, manifestInfo.Filename); + var manifestPath = Path.Combine(chunksDir.FullName, manifestInfo.FileName); if (File.Exists(manifestPath)) { manifestData = File.ReadAllBytes(manifestPath); @@ -679,19 +687,21 @@ namespace FModel.ViewModels export.Owner.Name.EndsWith($"/RenderSwitch_Materials/{export.Name}", StringComparison.OrdinalIgnoreCase) || export.Owner.Name.EndsWith($"/MI_BPTile/{export.Name}", StringComparison.OrdinalIgnoreCase))): { - Application.Current.Dispatcher.InvokeAsync(() => + Application.Current.Dispatcher.Invoke(async () => { var modelViewer = Helper.GetWindow("Model Viewer", () => new ModelViewer().Show()); - modelViewer.Load(export); + await Task.Delay(100).ConfigureAwait(true); + await modelViewer.Load(export).ConfigureAwait(true); }); return true; } case UMaterialInstance m when ModelIsSwappingMaterial: { - Application.Current.Dispatcher.InvokeAsync(() => + Application.Current.Dispatcher.Invoke(async () => { var modelViewer = Helper.GetWindow("Model Viewer", () => new ModelViewer().Show()); - modelViewer.Swap(m); + await Task.Delay(100).ConfigureAwait(true); + await modelViewer.Swap(m).ConfigureAwait(true); }); return true; } diff --git a/FModel/ViewModels/ModelViewerViewModel.cs b/FModel/ViewModels/ModelViewerViewModel.cs index 3bbf7c4b..b4062f00 100644 --- a/FModel/ViewModels/ModelViewerViewModel.cs +++ b/FModel/ViewModels/ModelViewerViewModel.cs @@ -3,29 +3,40 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using System.Linq; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Data; using System.Windows.Media.Media3D; + using CUE4Parse.UE4.Assets.Exports; using CUE4Parse.UE4.Assets.Exports.Material; using CUE4Parse.UE4.Assets.Exports.SkeletalMesh; using CUE4Parse.UE4.Assets.Exports.StaticMesh; using CUE4Parse.UE4.Assets.Exports.Texture; using CUE4Parse.UE4.Objects.Core.Math; + using CUE4Parse_Conversion.Meshes; using CUE4Parse_Conversion.Meshes.PSK; using CUE4Parse_Conversion.Textures; + +using FModel.Extensions; using FModel.Framework; using FModel.Services; using FModel.Settings; using FModel.Views.Resources.Controls; + using HelixToolkit.SharpDX.Core; using HelixToolkit.Wpf.SharpDX; + using Ookii.Dialogs.Wpf; + using Serilog; + using SharpDX; + using SkiaSharp; + using Camera = HelixToolkit.Wpf.SharpDX.Camera; using Geometry3D = HelixToolkit.SharpDX.Core.Geometry3D; using PerspectiveCamera = HelixToolkit.Wpf.SharpDX.PerspectiveCamera; @@ -141,8 +152,8 @@ namespace FModel.ViewModels } bool valid = false; - await _threadWorkerView.Begin(_ => - { + //await _threadWorkerView.Begin(_ => + //{ valid = export switch { UStaticMesh st => TryLoadStaticMesh(st, p), @@ -150,7 +161,7 @@ namespace FModel.ViewModels UMaterialInstance mi => TryLoadMaterialInstance(mi, p), _ => throw new ArgumentOutOfRangeException(nameof(export)) }; - }); + //}).ConfigureAwait(true); if (!valid) return; SelectedModel = p; } @@ -247,7 +258,7 @@ namespace FModel.ViewModels { var (material, _, _) = LoadMaterial(materialInstance); m = material; - }); + }).ConfigureAwait(true); if (m == null) return false; model.SelectedGeometry.Material = m; diff --git a/FModel/ViewModels/ThreadWorkerViewModel.cs b/FModel/ViewModels/ThreadWorkerViewModel.cs index 2782a144..b74ae2ea 100644 --- a/FModel/ViewModels/ThreadWorkerViewModel.cs +++ b/FModel/ViewModels/ThreadWorkerViewModel.cs @@ -1,10 +1,12 @@ -using FModel.Framework; -using FModel.Services; using System; using System.Threading; using System.Threading.Tasks; + using FModel.Extensions; +using FModel.Framework; +using FModel.Services; using FModel.Views.Resources.Controls; + using Serilog; namespace FModel.ViewModels @@ -57,7 +59,7 @@ namespace FModel.ViewModels CurrentCancellationTokenSource ??= new CancellationTokenSource(); _jobs.Enqueue(action); - await ProcessQueues(); + await ProcessQueues().ConfigureAwait(true); } public void Cancel() @@ -76,12 +78,12 @@ namespace FModel.ViewModels if (_jobs.Count > 0) { _applicationView.Status = EStatusKind.Loading; - await foreach (var job in _jobs) + await foreach (var job in _jobs.ConfigureAwait(true)) { try { // will end in "catch" if canceled - await Task.Run(() => job(CurrentCancellationTokenSource.Token)); + await Task.Run(() => job(CurrentCancellationTokenSource.Token)).ConfigureAwait(true); } catch (OperationCanceledException) { diff --git a/FModel/Views/ModelViewer.xaml.cs b/FModel/Views/ModelViewer.xaml.cs index b122672a..e4a26d0b 100644 --- a/FModel/Views/ModelViewer.xaml.cs +++ b/FModel/Views/ModelViewer.xaml.cs @@ -1,12 +1,16 @@ using System.ComponentModel; +using System.Threading.Tasks; using System.Windows; using System.Windows.Input; + using AdonisUI.Controls; + using CUE4Parse.UE4.Assets.Exports; using CUE4Parse.UE4.Assets.Exports.Material; + using FModel.Services; -using FModel.Settings; using FModel.ViewModels; + using MessageBox = AdonisUI.Controls.MessageBox; using MessageBoxImage = AdonisUI.Controls.MessageBoxImage; @@ -23,10 +27,10 @@ namespace FModel.Views InitializeComponent(); } - public async void Load(UObject export) => await _applicationView.ModelViewer.LoadExport(export); - public async void Swap(UMaterialInstance materialInstance) + public async Task Load(UObject export) => await _applicationView.ModelViewer.LoadExport(export).ConfigureAwait(true); + public async Task Swap(UMaterialInstance materialInstance) { - var sucess = await _applicationView.ModelViewer.TryChangeSelectedMaterial(materialInstance); + var sucess = await _applicationView.ModelViewer.TryChangeSelectedMaterial(materialInstance).ConfigureAwait(true); if (sucess) { _applicationView.CUE4Parse.ModelIsSwappingMaterial = false; From 235f663ea5973714e941147a637bea8c148d61bc Mon Sep 17 00:00:00 2001 From: Not Officer Date: Sun, 21 Nov 2021 15:32:40 +0100 Subject: [PATCH 56/58] vs 2022 --- FModel/FModel.sln | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FModel/FModel.sln b/FModel/FModel.sln index a53a4881..7de93e7b 100644 --- a/FModel/FModel.sln +++ b/FModel/FModel.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30804.86 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31912.275 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FModel", "FModel.csproj", "{B1F494EA-90A6-4C24-800E-2F724A1884CA}" EndProject From d846750ac6fc9b170886c691d0be606334fbc135 Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Sun, 21 Nov 2021 16:35:14 +0100 Subject: [PATCH 57/58] revert d37c5a922f19211a5a774d9ee8696164f5ad2e44 --- CUE4Parse | 2 +- FModel/ViewModels/CUE4ParseViewModel.cs | 18 ++++-------------- FModel/ViewModels/ModelViewerViewModel.cs | 19 ++++--------------- FModel/ViewModels/ThreadWorkerViewModel.cs | 8 +++----- FModel/Views/ModelViewer.xaml.cs | 17 ++++++----------- 5 files changed, 18 insertions(+), 46 deletions(-) diff --git a/CUE4Parse b/CUE4Parse index c1fbac1c..d2163de3 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit c1fbac1c5729fb541d36546f4ff32cbfa347e741 +Subproject commit d2163de354e97a0e62222221b96666a678255884 diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 5b57665e..dea08f3b 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -6,9 +6,7 @@ using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Windows; - using AdonisUI.Controls; - using CUE4Parse.Encryption.Aes; using CUE4Parse.FileProvider; using CUE4Parse.FileProvider.Vfs; @@ -28,13 +26,10 @@ using CUE4Parse.UE4.Oodle.Objects; using CUE4Parse.UE4.Shaders; using CUE4Parse.UE4.Versions; using CUE4Parse.UE4.Wwise; - using CUE4Parse_Conversion; using CUE4Parse_Conversion.Sounds; using CUE4Parse_Conversion.Textures; - using EpicManifestParser.Objects; - using FModel.Creator; using FModel.Extensions; using FModel.Framework; @@ -42,11 +37,8 @@ using FModel.Services; using FModel.Settings; using FModel.Views; using FModel.Views.Resources.Controls; - using Newtonsoft.Json; - using Serilog; - using SkiaSharp; namespace FModel.ViewModels @@ -687,21 +679,19 @@ namespace FModel.ViewModels export.Owner.Name.EndsWith($"/RenderSwitch_Materials/{export.Name}", StringComparison.OrdinalIgnoreCase) || export.Owner.Name.EndsWith($"/MI_BPTile/{export.Name}", StringComparison.OrdinalIgnoreCase))): { - Application.Current.Dispatcher.Invoke(async () => + Application.Current.Dispatcher.InvokeAsync(() => { var modelViewer = Helper.GetWindow("Model Viewer", () => new ModelViewer().Show()); - await Task.Delay(100).ConfigureAwait(true); - await modelViewer.Load(export).ConfigureAwait(true); + modelViewer.Load(export); }); return true; } case UMaterialInstance m when ModelIsSwappingMaterial: { - Application.Current.Dispatcher.Invoke(async () => + Application.Current.Dispatcher.InvokeAsync(() => { var modelViewer = Helper.GetWindow("Model Viewer", () => new ModelViewer().Show()); - await Task.Delay(100).ConfigureAwait(true); - await modelViewer.Swap(m).ConfigureAwait(true); + modelViewer.Swap(m); }); return true; } diff --git a/FModel/ViewModels/ModelViewerViewModel.cs b/FModel/ViewModels/ModelViewerViewModel.cs index b4062f00..3bbf7c4b 100644 --- a/FModel/ViewModels/ModelViewerViewModel.cs +++ b/FModel/ViewModels/ModelViewerViewModel.cs @@ -3,40 +3,29 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using System.Linq; -using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Data; using System.Windows.Media.Media3D; - using CUE4Parse.UE4.Assets.Exports; using CUE4Parse.UE4.Assets.Exports.Material; using CUE4Parse.UE4.Assets.Exports.SkeletalMesh; using CUE4Parse.UE4.Assets.Exports.StaticMesh; using CUE4Parse.UE4.Assets.Exports.Texture; using CUE4Parse.UE4.Objects.Core.Math; - using CUE4Parse_Conversion.Meshes; using CUE4Parse_Conversion.Meshes.PSK; using CUE4Parse_Conversion.Textures; - -using FModel.Extensions; using FModel.Framework; using FModel.Services; using FModel.Settings; using FModel.Views.Resources.Controls; - using HelixToolkit.SharpDX.Core; using HelixToolkit.Wpf.SharpDX; - using Ookii.Dialogs.Wpf; - using Serilog; - using SharpDX; - using SkiaSharp; - using Camera = HelixToolkit.Wpf.SharpDX.Camera; using Geometry3D = HelixToolkit.SharpDX.Core.Geometry3D; using PerspectiveCamera = HelixToolkit.Wpf.SharpDX.PerspectiveCamera; @@ -152,8 +141,8 @@ namespace FModel.ViewModels } bool valid = false; - //await _threadWorkerView.Begin(_ => - //{ + await _threadWorkerView.Begin(_ => + { valid = export switch { UStaticMesh st => TryLoadStaticMesh(st, p), @@ -161,7 +150,7 @@ namespace FModel.ViewModels UMaterialInstance mi => TryLoadMaterialInstance(mi, p), _ => throw new ArgumentOutOfRangeException(nameof(export)) }; - //}).ConfigureAwait(true); + }); if (!valid) return; SelectedModel = p; } @@ -258,7 +247,7 @@ namespace FModel.ViewModels { var (material, _, _) = LoadMaterial(materialInstance); m = material; - }).ConfigureAwait(true); + }); if (m == null) return false; model.SelectedGeometry.Material = m; diff --git a/FModel/ViewModels/ThreadWorkerViewModel.cs b/FModel/ViewModels/ThreadWorkerViewModel.cs index b74ae2ea..f4a236e5 100644 --- a/FModel/ViewModels/ThreadWorkerViewModel.cs +++ b/FModel/ViewModels/ThreadWorkerViewModel.cs @@ -1,12 +1,10 @@ using System; using System.Threading; using System.Threading.Tasks; - using FModel.Extensions; using FModel.Framework; using FModel.Services; using FModel.Views.Resources.Controls; - using Serilog; namespace FModel.ViewModels @@ -59,7 +57,7 @@ namespace FModel.ViewModels CurrentCancellationTokenSource ??= new CancellationTokenSource(); _jobs.Enqueue(action); - await ProcessQueues().ConfigureAwait(true); + await ProcessQueues(); } public void Cancel() @@ -78,12 +76,12 @@ namespace FModel.ViewModels if (_jobs.Count > 0) { _applicationView.Status = EStatusKind.Loading; - await foreach (var job in _jobs.ConfigureAwait(true)) + await foreach (var job in _jobs) { try { // will end in "catch" if canceled - await Task.Run(() => job(CurrentCancellationTokenSource.Token)).ConfigureAwait(true); + await Task.Run(() => job(CurrentCancellationTokenSource.Token)); } catch (OperationCanceledException) { diff --git a/FModel/Views/ModelViewer.xaml.cs b/FModel/Views/ModelViewer.xaml.cs index e4a26d0b..55c729ce 100644 --- a/FModel/Views/ModelViewer.xaml.cs +++ b/FModel/Views/ModelViewer.xaml.cs @@ -1,16 +1,11 @@ using System.ComponentModel; -using System.Threading.Tasks; using System.Windows; using System.Windows.Input; - using AdonisUI.Controls; - using CUE4Parse.UE4.Assets.Exports; using CUE4Parse.UE4.Assets.Exports.Material; - using FModel.Services; using FModel.ViewModels; - using MessageBox = AdonisUI.Controls.MessageBox; using MessageBoxImage = AdonisUI.Controls.MessageBoxImage; @@ -27,10 +22,10 @@ namespace FModel.Views InitializeComponent(); } - public async Task Load(UObject export) => await _applicationView.ModelViewer.LoadExport(export).ConfigureAwait(true); - public async Task Swap(UMaterialInstance materialInstance) + public async void Load(UObject export) => await _applicationView.ModelViewer.LoadExport(export); + public async void Swap(UMaterialInstance materialInstance) { - var sucess = await _applicationView.ModelViewer.TryChangeSelectedMaterial(materialInstance).ConfigureAwait(true); + var sucess = await _applicationView.ModelViewer.TryChangeSelectedMaterial(materialInstance); if (sucess) { _applicationView.CUE4Parse.ModelIsSwappingMaterial = false; @@ -66,9 +61,9 @@ namespace FModel.Views case Key.H: _applicationView.ModelViewer.RenderingToggle(); break; - case Key.D: - _applicationView.ModelViewer.DiffuseOnlyToggle(); - break; + // case Key.D: + // _applicationView.ModelViewer.DiffuseOnlyToggle(); + // break; case Key.Decimal: _applicationView.ModelViewer.FocusOnSelectedMesh(); break; From 9224207aebba2cb631c7b4d1531929b13a6b1784 Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Sun, 21 Nov 2021 18:02:12 +0100 Subject: [PATCH 58/58] FModel v4.1 --- FModel/ViewModels/ApiEndpoints/FModelApi.cs | 18 +++++++++--------- README.md | 6 ++---- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/FModel/ViewModels/ApiEndpoints/FModelApi.cs b/FModel/ViewModels/ApiEndpoints/FModelApi.cs index 0f677a9f..07d3bd7d 100644 --- a/FModel/ViewModels/ApiEndpoints/FModelApi.cs +++ b/FModel/ViewModels/ApiEndpoints/FModelApi.cs @@ -27,7 +27,7 @@ namespace FModel.ViewModels.ApiEndpoints private Game _game; private readonly IDictionary _communityDesigns = new Dictionary(); private ApplicationViewModel _applicationView => ApplicationService.ApplicationView; - + public FModelApi(IRestClient client) : base(client) { } @@ -70,7 +70,7 @@ namespace FModel.ViewModels.ApiEndpoints { return _backups ??= GetBackupsAsync(token, gameName).GetAwaiter().GetResult(); } - + public async Task GetGamesAsync(CancellationToken token, string gameName) { var request = new RestRequest($"https://api.fmodel.app/v1/games/{gameName}", Method.GET); @@ -78,7 +78,7 @@ namespace FModel.ViewModels.ApiEndpoints Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource); return response.Data; } - + public Game GetGames(CancellationToken token, string gameName) { return _game ??= GetGamesAsync(token, gameName).GetAwaiter().GetResult(); @@ -101,14 +101,14 @@ namespace FModel.ViewModels.ApiEndpoints _communityDesigns[designName] = communityDesign; return communityDesign; } - + public void CheckForUpdates(EUpdateMode updateMode) { AutoUpdater.ParseUpdateInfoEvent += ParseUpdateInfoEvent; AutoUpdater.CheckForUpdateEvent += CheckForUpdateEvent; AutoUpdater.Start($"https://api.fmodel.app/v1/infos/{updateMode}"); } - + private void ParseUpdateInfoEvent(ParseUpdateInfoEventArgs args) { _infos = JsonConvert.DeserializeObject(args.RemoteData); @@ -122,7 +122,7 @@ namespace FModel.ViewModels.ApiEndpoints }; } } - + private void CheckForUpdateEvent(UpdateInfoEventArgs args) { if (args is {CurrentVersion: { }}) @@ -144,7 +144,7 @@ namespace FModel.ViewModels.ApiEndpoints Buttons = MessageBoxButtons.YesNo(), IsSoundEnabled = false }; - + MessageBox.Show(messageBox); if (messageBox.Result != MessageBoxResult.Yes) return; @@ -175,11 +175,11 @@ namespace FModel.ViewModels.ApiEndpoints var request = new RestRequest(args.ChangelogURL, Method.GET); var response = _client.Execute(request); if (string.IsNullOrEmpty(response.Content)) return; - + _applicationView.CUE4Parse.TabControl.AddTab($"Release Notes: {args.CurrentVersion}"); _applicationView.CUE4Parse.TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector("changelog"); _applicationView.CUE4Parse.TabControl.SelectedTab.SetDocumentText(response.Content, false); UserSettings.Default.ShowChangelog = false; } } -} \ No newline at end of file +} diff --git a/README.md b/README.md index 0a68a699..48027068 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,12 @@ # FModel [![Discord](https://discordapp.com/api/guilds/637265123144237061/widget.png?style=shield)](https://discord.gg/fdkNYYQ) -    Open-source software for exploring Unreal Engine games' files. From seeing the properties of an asset to listening to your favorite audio files, it has never been easier to navigate inside a game's assets. FModel supports tens of file types and asset types, to display the most information possible and it also has the ability to let you CTRL+LMB on an asset path to display its properties too. +Beginner-friendly and open-source software for data-mining games made with Unreal Engine. FModel ## Installation -To use FModel, you need to install the **[.NET 6](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-6.0.0-windows-x64-installer)** runtime on your computer -* **[Download](https://github.com/iAmAsval/FModel/releases/latest/download/FModel.zip)** the latest release. -* **Extract FModel.exe** somewhere on your PC and launch it +Follow [our documentation](https://fmodel.app/docs#installation) ## Authors