x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Painting::DrawLines Adding Thickness Variable

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!

Product Version: UE 4.18
Tags:
more ▼

asked Nov 21 '17 at 04:46 PM in Blueprint Scripting

avatar image

nienglish
11 1 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question