Hello everyone,
I am using the DrawLines blueprint function, and would like to add the thickness variable to it.
I went into WidgetBlueprintLibrary and added the thickness variable to the header and the cpp file, see below.
Header
/**
* Draws several line segments.
*
* @param Points Line pairs, each line needs to be 2 separate points in the array.
* @param Thickness How many pixels thick this line should be.
* @param Tint Color to render the line.
*/
UFUNCTION(BlueprintCallable, meta=( AdvancedDisplay = "3" ), Category="Painting" )
static void DrawLines(UPARAM(ref) FPaintContext& Context, const TArray<FVector2D>& Points, float Thickness, FLinearColor Tint = FLinearColor::White, bool bAntiAlias = true);
CPP
void UWidgetBlueprintLibrary::DrawLines(UPARAM(ref) FPaintContext& Context, const TArray<FVector2D>& Points, , float Thickness, FLinearColor Tint, bool bAntiAlias)
{
Context.MaxLayer++;
FSlateDrawElement::MakeLines(
Context.OutDrawElements,
Context.MaxLayer,
Context.AllottedGeometry.ToPaintGeometry(),
Points,
Context.MyClippingRect,
ESlateDrawEffect::None,
Tint,
bAntiAlias,
Thickness
);
}
Well - this did not expose the thickness variable to the blueprint node, so I tried to create my own function referencing the FSlateDrawElement::Make Lines.
However, I then got an “Unrecognized type FPaintContext - type must be a UCLASS, USTRUCT or UENUM” error.
I was hoping to use this exercise as a learning experience on how to edit or create my own blueprint nodes, but I feel this might be out of my depth. If it’s an easy fix please let me know, else I’ll just use the HUD DrawLines function instead. Thank you!