Fix some issues

This commit is contained in:
GMatrixGames 2024-06-13 13:57:48 -04:00
parent 3aa1d60901
commit 3e200bd5d0
No known key found for this signature in database
GPG Key ID: 685EB7EF9A26807C
2 changed files with 9 additions and 6 deletions

View File

@ -24,7 +24,7 @@ public class BaseIcon : UCreator
protected string ShortDescription { get; set; }
protected string CosmeticSource { get; set; }
protected Dictionary<string, SKBitmap> UserFacingFlags { get; set; }
private FInstancedStruct[] DataList { get; set; }
protected FInstancedStruct[] DataList { get; set; }
public BaseIcon(UObject uObject, EIconStyle style) : base(uObject, style) { }

View File

@ -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<FSoftObjectPath>("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<FSoftObjectPath>("Icon"));
}
return null;