From 3e200bd5d0a792c98ae2540ddbc052a8bd38d210 Mon Sep 17 00:00:00 2001 From: GMatrixGames Date: Thu, 13 Jun 2024 13:57:48 -0400 Subject: [PATCH] Fix some issues --- FModel/Creator/Bases/FN/BaseIcon.cs | 2 +- FModel/Creator/Utils.cs | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/FModel/Creator/Bases/FN/BaseIcon.cs b/FModel/Creator/Bases/FN/BaseIcon.cs index 00eda4aa..bce42590 100644 --- a/FModel/Creator/Bases/FN/BaseIcon.cs +++ b/FModel/Creator/Bases/FN/BaseIcon.cs @@ -24,7 +24,7 @@ public class BaseIcon : UCreator protected string ShortDescription { get; set; } protected string CosmeticSource { get; set; } protected Dictionary UserFacingFlags { get; set; } - private FInstancedStruct[] DataList { get; set; } + protected FInstancedStruct[] DataList { get; set; } public BaseIcon(UObject uObject, EIconStyle style) : base(uObject, style) { } diff --git a/FModel/Creator/Utils.cs b/FModel/Creator/Utils.cs index 071fc1b5..9d79ae31 100644 --- a/FModel/Creator/Utils.cs +++ b/FModel/Creator/Utils.cs @@ -72,6 +72,7 @@ public static class Utils return GetBitmap(material); default: { + if (export.TryGetValue(out FInstancedStruct[] dataList, "DataList")) return GetBitmap(dataList); if (export.TryGetValue(out FSoftObjectPath previewImage, "LargePreviewImage", "SmallPreviewImage")) return GetBitmap(previewImage); if (export.TryGetValue(out string largePreview, "LargePreviewImage")) return GetBitmap(largePreview); if (export.TryGetValue(out FPackageIndex smallPreview, "SmallPreviewImage")) @@ -88,12 +89,14 @@ public static class Utils public static SKBitmap GetBitmap(FInstancedStruct[] structs) { - foreach (var struc in structs) + if (structs.FirstOrDefault(d => d.NonConstStruct?.TryGetValue(out FSoftObjectPath p, "LargeIcon") == true && !p.AssetPathName.IsNone) is { NonConstStruct: not null } isl) { - if (struc.NonConstStruct?.TryGetValue(out FSoftObjectPath icon, "LargeIcon", "Icon") == true && !icon.AssetPathName.IsNone) - { - return GetBitmap(icon); - } + return GetBitmap(isl.NonConstStruct.Get("LargeIcon")); + } + + if (structs.FirstOrDefault(d => d.NonConstStruct?.TryGetValue(out FSoftObjectPath p, "Icon") == true && !p.AssetPathName.IsNone) is { NonConstStruct: not null } isi) + { + return GetBitmap(isi.NonConstStruct.Get("Icon")); } return null;