From a11c910500a960a8a9e71d04300df2521d497705 Mon Sep 17 00:00:00 2001 From: mrhid6 Date: Fri, 25 Oct 2024 14:16:41 +0100 Subject: [PATCH] Update ItemTooltipSubsystem.cpp --- .../SML/Source/SML/Private/Tooltip/ItemTooltipSubsystem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Mods/SML/Source/SML/Private/Tooltip/ItemTooltipSubsystem.cpp b/Mods/SML/Source/SML/Private/Tooltip/ItemTooltipSubsystem.cpp index 42209550a8..bbd554858f 100644 --- a/Mods/SML/Source/SML/Private/Tooltip/ItemTooltipSubsystem.cpp +++ b/Mods/SML/Source/SML/Private/Tooltip/ItemTooltipSubsystem.cpp @@ -3,6 +3,7 @@ #include "Patching/BlueprintHookHelper.h" #include "Patching/BlueprintHookManager.h" #include "Components/TextBlock.h" +#include "Components/VerticalBox.h" #include "Components/PanelWidget.h" #include "Engine/Engine.h" #include "Engine/GameInstance.h" @@ -18,11 +19,14 @@ void UItemTooltipSubsystem::ApplyItemOverridesToTooltip(UWidget* TooltipWidget, FObjectProperty* DescriptionWidgetProperty = CastField(TooltipWidgetClass->FindPropertyByName(TEXT("mDescription"))); check(TitleWidgetProperty && DescriptionWidgetProperty); + //Retrieve references to some stuff UTextBlock* NameBlock = Cast(TitleWidgetProperty->GetObjectPropertyValue_InContainer(TooltipWidget)); UTextBlock* DescriptionBlock = Cast(DescriptionWidgetProperty->GetObjectPropertyValue_InContainer(TooltipWidget)); //Retrieve parent panel, it will hold name, description and recipe blocks UPanelWidget* ParentPanel = NameBlock->GetParent(); + UVerticalBox* VerticalBoxPanel = Cast(DescriptionBlock->GetParent()); + check(VerticalBoxPanel); //Spawn custom widget in parent panel and add it UItemStackContextWidget* ContextWidget = NewObject(ParentPanel); @@ -38,7 +42,7 @@ void UItemTooltipSubsystem::ApplyItemOverridesToTooltip(UWidget* TooltipWidget, //Append custom widgets to description TArray Widgets = CreateDescriptionWidgets(OwningPlayer, InventoryStack); for (UWidget* Widget : Widgets) { - ParentPanel->AddChild(Widget); + VerticalBoxPanel->AddChild(Widget); } }