From b846878e541f55e230f155b35da157d45cf730e5 Mon Sep 17 00:00:00 2001 From: Asval Date: Thu, 14 Nov 2024 17:34:59 +0100 Subject: [PATCH] shoes icon + fixed gameplay tags + show metadata --- CUE4Parse | 2 +- FModel/Creator/Bases/FN/BaseIcon.cs | 9 +++++++++ FModel/Creator/CreatorPackage.cs | 1 + FModel/MainWindow.xaml | 15 +++++++++++++++ FModel/ViewModels/CUE4ParseViewModel.cs | 15 +++++++++++++++ .../ViewModels/Commands/RightClickMenuCommand.cs | 8 ++++++++ FModel/ViewModels/TabControlViewModel.cs | 2 +- .../Controls/Aed/GamePathVisualLineText.cs | 5 ++++- 8 files changed, 54 insertions(+), 3 deletions(-) diff --git a/CUE4Parse b/CUE4Parse index 0b9616c8..49c8306d 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 0b9616c806ba53c112cf2805ad3f9f823dbb35d6 +Subproject commit 49c8306da345d31f9140cdc4d0188a99a71c4853 diff --git a/FModel/Creator/Bases/FN/BaseIcon.cs b/FModel/Creator/Bases/FN/BaseIcon.cs index 1ea4ce2c..8c935764 100644 --- a/FModel/Creator/Bases/FN/BaseIcon.cs +++ b/FModel/Creator/Bases/FN/BaseIcon.cs @@ -88,6 +88,8 @@ public class BaseIcon : UCreator { ParseForReward(UserSettings.Default.CosmeticDisplayAsset); + if (Object.TryGetValue(out FInstancedStruct[] dataList, "DataList")) + CheckGameplayTags(dataList); if (Object.TryGetValue(out FGameplayTagContainer gameplayTags, "GameplayTags")) CheckGameplayTags(gameplayTags); if (Object.TryGetValue(out FPackageIndex cosmeticItem, "cosmetic_item")) @@ -262,6 +264,13 @@ public class BaseIcon : UCreator return Utils.RemoveHtmlTags(string.Format(introduced, d)); } + private void CheckGameplayTags(FInstancedStruct[] dataList) + { + if (dataList.FirstOrDefault(d => d.NonConstStruct?.TryGetValue(out FGameplayTagContainer _, "Tags") ?? false) is { NonConstStruct: not null } tags) + { + CheckGameplayTags(tags.NonConstStruct.Get("Tags")); + } + } private void CheckGameplayTags(FGameplayTagContainer gameplayTags) { if (gameplayTags.TryGetGameplayTag("Cosmetics.Source.", out var source)) diff --git a/FModel/Creator/CreatorPackage.cs b/FModel/Creator/CreatorPackage.cs index d61cf4bf..e93caf19 100644 --- a/FModel/Creator/CreatorPackage.cs +++ b/FModel/Creator/CreatorPackage.cs @@ -44,6 +44,7 @@ public class CreatorPackage : IDisposable case "AthenaCharacterItemDefinition": case "AthenaMapMarkerItemDefinition": case "AthenaBackpackItemDefinition": + case "CosmeticShoesItemDefinition": case "AthenaPickaxeItemDefinition": case "AthenaGadgetItemDefinition": case "AthenaGliderItemDefinition": diff --git a/FModel/MainWindow.xaml b/FModel/MainWindow.xaml index 57d1b200..3eabad34 100644 --- a/FModel/MainWindow.xaml +++ b/FModel/MainWindow.xaml @@ -486,6 +486,21 @@ + + + + + + + + + + + + + + + diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 5652fe44..ef4928c9 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -53,6 +53,7 @@ using CUE4Parse.UE4.Wwise; using CUE4Parse_Conversion; using CUE4Parse_Conversion.Sounds; +using CUE4Parse.UE4.Assets; using EpicManifestParser; using FModel.Creator; @@ -956,6 +957,20 @@ public class CUE4ParseViewModel : ViewModel } } + public void ShowMetadata(string fullPath) + { + var package = Provider.LoadPackage(fullPath); + + var directory = fullPath.SubstringBeforeLast('/'); + var fileName = $"{fullPath.SubstringAfterLast('/')} (Metadata)"; + + if (TabControl.CanAddTabs) TabControl.AddTab(fileName, directory); + else TabControl.SelectedTab.SoftReset(fileName, directory); + TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector(""); + + TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(package, Formatting.Indented), false, false); + } + private void SaveAndPlaySound(string fullPath, string ext, byte[] data) { if (fullPath.StartsWith("/")) fullPath = fullPath[1..]; diff --git a/FModel/ViewModels/Commands/RightClickMenuCommand.cs b/FModel/ViewModels/Commands/RightClickMenuCommand.cs index acb48897..c74b27c9 100644 --- a/FModel/ViewModels/Commands/RightClickMenuCommand.cs +++ b/FModel/ViewModels/Commands/RightClickMenuCommand.cs @@ -35,6 +35,14 @@ public class RightClickMenuCommand : ViewModelCommand contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, true); } break; + case "Assets_Show_Metadata": + foreach (var asset in assetItems) + { + Thread.Yield(); + cancellationToken.ThrowIfCancellationRequested(); + contextViewModel.CUE4Parse.ShowMetadata(asset.FullPath); + } + break; case "Assets_Export_Data": foreach (var asset in assetItems) { diff --git a/FModel/ViewModels/TabControlViewModel.cs b/FModel/ViewModels/TabControlViewModel.cs index 1afe5c77..a09c1596 100644 --- a/FModel/ViewModels/TabControlViewModel.cs +++ b/FModel/ViewModels/TabControlViewModel.cs @@ -106,7 +106,7 @@ public class TabItem : ViewModel set => SetProperty(ref _directory, value); } - public string FullPath => this.Directory + "/" + this.Header; + public string FullPath => this.Directory + "/" + this.Header.SubstringBeforeLast(" ("); private bool _hasSearchOpen; public bool HasSearchOpen diff --git a/FModel/Views/Resources/Controls/Aed/GamePathVisualLineText.cs b/FModel/Views/Resources/Controls/Aed/GamePathVisualLineText.cs index d0dedb59..1e2a344f 100644 --- a/FModel/Views/Resources/Controls/Aed/GamePathVisualLineText.cs +++ b/FModel/Views/Resources/Controls/Aed/GamePathVisualLineText.cs @@ -70,7 +70,10 @@ public class GamePathVisualLineText : VisualLineText var obj = gamePath.SubstringAfterLast('.'); var package = gamePath.SubstringBeforeLast('.'); var fullPath = _applicationView.CUE4Parse.Provider.FixPath(package, StringComparison.Ordinal); - if (a.ParentVisualLine.Document.FileName.Equals(fullPath.SubstringBeforeLast('.'), StringComparison.OrdinalIgnoreCase)) + + var firstLine = a.ParentVisualLine.Document.GetLineByNumber(2); + if (a.ParentVisualLine.Document.FileName.Equals(fullPath.SubstringBeforeLast('.'), StringComparison.OrdinalIgnoreCase) && + !a.ParentVisualLine.Document.GetText(firstLine.Offset, firstLine.Length).Equals(" \"Summary\": {")) // Show Metadata case { int lineNumber; DocumentLine line;