Last active
August 4, 2022 15:17
-
-
Save BaeMinCheon/109b251f1c88ae3f7e73dd711d0cc153 to your computer and use it in GitHub Desktop.
Custom RichTextBlockDecorator example code #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://baemincheon.github.io/2022/07/28/how-the-rich-text-block-works-in-unrealengine/ | |
#pragma once | |
#include "CoreMinimal.h" | |
#include "UObject/ObjectMacros.h" | |
#include "UObject/Object.h" | |
#include "Fonts/SlateFontInfo.h" | |
#include "Styling/SlateTypes.h" | |
#include "Framework/Text/TextLayout.h" | |
#include "Framework/Text/ISlateRun.h" | |
#include "Framework/Text/ITextDecorator.h" | |
#include "Components/RichTextBlockDecorator.h" | |
#include "Engine/DataTable.h" | |
#include "RichTextBlockSomeWidgetDecorator.generated.h" | |
class ISlateStyle; | |
USTRUCT(Blueprintable, BlueprintType) | |
struct FRichSomeWidgetRow : public FTableRowBase | |
{ | |
GENERATED_BODY() | |
public: | |
UPROPERTY(EditAnywhere, Category = Appearance) | |
FSlateBrush Brush; | |
UPROPERTY(EditAnywhere, Category = Appearance) | |
FText Text; | |
}; | |
UCLASS(Abstract, Blueprintable) | |
class URichTextBlockSomeWidgetDecorator : public URichTextBlockDecorator | |
{ | |
GENERATED_BODY() | |
public: | |
URichTextBlockSomeWidgetDecorator(const FObjectInitializer& ObjectInitializer); | |
virtual TSharedPtr<ITextDecorator> CreateDecorator(URichTextBlock* InOwner) override; | |
virtual const FRichSomeWidgetRow* FindSomeWidgetRow(FName TagOrId, bool bWarnIfMissing); | |
protected: | |
FRichSomeWidgetRow* FindRow(FName TagOrId, bool bWarnIfMissing); | |
UPROPERTY(EditAnywhere, Category=Appearance, meta = (RequiredAssetDataTags = "RowStructure=RichSomeWidgetRow")) | |
TObjectPtr<class UDataTable> ImageSet; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment