From f64151b0eea4914bb8268f74835bec41435f856e Mon Sep 17 00:00:00 2001 From: Lyndsey Winter <51070189+lyndseyy@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:18:01 -0400 Subject: [PATCH] add support for ComponentContainer (#454) --- FModel/Creator/Bases/FN/BaseIcon.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/FModel/Creator/Bases/FN/BaseIcon.cs b/FModel/Creator/Bases/FN/BaseIcon.cs index be3316c4..884050c3 100644 --- a/FModel/Creator/Bases/FN/BaseIcon.cs +++ b/FModel/Creator/Bases/FN/BaseIcon.cs @@ -31,6 +31,7 @@ public class BaseIcon : UCreator { // rarity if (Object.TryGetValue(out FPackageIndex series, "Series")) GetSeries(series); + else if (Object.TryGetValue(out FStructFallback componentContainer, "ComponentContainer")) GetSeries(componentContainer); else GetRarity(Object.GetOrDefault("Rarity", EFortRarity.Uncommon)); // default is uncommon // preview @@ -127,6 +128,21 @@ public class BaseIcon : UCreator GetSeries(export); } + private void GetSeries(FStructFallback s) + { + if (!s.TryGetValue(out FPackageIndex[] components, "Components")) return; + + foreach (var component in components) + { + if (!component.TryLoad(out var componentObj) || + !componentObj!.TryGetValue(out UObject componentSeriesDef, "Series")) + continue; + + GetSeries(componentSeriesDef); + break; + } + } + protected void GetSeries(UObject uObject) { if (uObject is UTexture2D texture2D)