@@ -18,16 +18,35 @@ enum EPenDataFadeType : uint8 {
1818 PENFADETYPE_Curve = 2 UMETA (DisplayName = " Curve" ),
1919};
2020
21+ UENUM (BlueprintType)
22+ enum class EPenDrawEffect : uint8 {
23+ /* * No effect applied */
24+ PENEFFECT_None = 0 UMETA (DisplayName = " None" ),
25+ /* * Advanced: Draw the element with no blending */
26+ PENEFFECT_NoBlending = 1 << 0 UMETA (DisplayName = " No Blending" ),
27+ /* * Advanced: Blend using pre-multiplied alpha. Ignored if NoBlending is set. */
28+ PENEFFECT_PreMultipliedAlpha = 1 << 1 UMETA (DisplayName = " Pre-Multiplied Alpha" ),
29+ /* * Advanced: No gamma correction should be done */
30+ PENEFFECT_NoGamma = 1 << 2 UMETA (DisplayName = " No Gamma" ),
31+ /* * Advanced: Change the alpha value to 1 - Alpha. */
32+ PENEFFECT_InvertAlpha = 1 << 3 UMETA (DisplayName = " Invert Alpha" ),
33+ };
2134USTRUCT (BlueprintType)
2235struct FCanvasPenData {
2336 GENERATED_BODY ()
2437
2538 FCanvasPenData () {}
2639
2740 /* Brush used to draw the line. THIS IS NOT IMPLEMENTED*/
28- UPROPERTY ( /* EditAnywhere, */ BlueprintReadWrite, Category = " Pen" )
41+ UPROPERTY ( EditAnywhere, BlueprintReadWrite, Category = " Pen" )
2942 TObjectPtr<USlateBrushAsset> Brush = nullptr ;
3043
44+ UPROPERTY ( EditAnywhere, BlueprintReadWrite, Category = " Pen" )
45+ bool bBrushFollowsLine = false ;
46+
47+ UPROPERTY ( EditAnywhere, BlueprintReadWrite, Category = " Pen" )
48+ EPenDrawEffect DrawEffect = EPenDrawEffect::PENEFFECT_None;
49+
3150 /* Distance between each stamp of the brush. */
3251 UPROPERTY (EditAnywhere, BlueprintReadWrite, Category = " Pen" , meta=(EditCondition = " Brush != nullptr" , EditConditionHides))
3352 float StepSize = 1 .f ;
@@ -37,9 +56,13 @@ struct FCanvasPenData {
3756 FLinearColor Tint = FColor::White;
3857
3958 /* Size of the line. */
40- UPROPERTY (EditAnywhere, BlueprintReadWrite, Category = " Pen" , meta=(EditCondition = " Brush = = nullptr" , EditConditionHides))
41- float Size = 1 . f ;
59+ UPROPERTY (EditAnywhere, BlueprintReadWrite, Category = " Pen" , meta=(EditCondition = " Brush ! = nullptr" , EditConditionHides))
60+ FVector2D BrushSize = FVector2D::One () ;
4261
62+ /* Size of the line. */
63+ UPROPERTY (EditAnywhere, BlueprintReadWrite, Category = " Pen" , meta=(EditCondition = " Brush == nullptr" , EditConditionHides))
64+ float LineSize = 1 .f ;
65+
4366 /* Determines how the opacity fades if the board supports fading. */
4467 UPROPERTY (EditAnywhere, BlueprintReadWrite, Category = " Pen|Fading" )
4568 TEnumAsByte<EPenDataFadeType> OpacityFadeType = EPenDataFadeType::PENFADETYPE_Linear;
@@ -55,16 +78,20 @@ struct FCanvasPenData {
5578 /* A curve that makes the line size decrease if the board fades lines. The value used will be an absolute value of -1 to 1. */
5679 UPROPERTY (EditAnywhere, BlueprintReadWrite, Category = " Pen|Fading" , meta=(EditCondition = " SizeFadeType == EPenDataFadeType::PENFADETYPE_Curve" , EditConditionHides))
5780 TObjectPtr<UCurveFloat> SizeFadeCurve = nullptr ;
58-
81+
82+ bool HasNoSize () const { return Brush != nullptr ? BrushSize.GetMin () <= 0 : LineSize <= 0 .f ; }
5983};
6084
6185USTRUCT (BlueprintType)
6286struct FCanvasLineData {
6387 GENERATED_BODY ()
6488
6589 FCanvasLineData () {}
66- FCanvasLineData (FName boardName, int boardID, float time, FVector2D startP, FVector2D startD, FVector2D stopP, FVector2D stopD, FCanvasPenData penData = FCanvasPenData ()) :
67- DrawingPlayer (boardName), BoardID (boardID), DrawnTime (time), StartingPoint (startP), StartingDirection (startD), StoppingPoint (stopP), StoppingDirection (stopD), PenData (penData)
90+ FCanvasLineData (const FCanvasLineData& line, float newTime) :
91+ DrawingPlayer (line.DrawingPlayer ), BoardID (line.BoardID ), DrawnTime (newTime), StartingPoint (line.StartingPoint ), StoppingPoint (line.StoppingPoint ), PenData (line.PenData )
92+ {};
93+ FCanvasLineData (FName drawerName, int boardID, float time, FVector2D startingPoint, FVector2D stoppingPoint, FCanvasPenData penData = FCanvasPenData ()) :
94+ DrawingPlayer (drawerName), BoardID (boardID), DrawnTime (time), StartingPoint (startingPoint), StoppingPoint (stoppingPoint), PenData (penData)
6895 {};
6996
7097 /* Player that drew the line. */
@@ -79,19 +106,14 @@ struct FCanvasLineData {
79106 /* The starting point of the line. */
80107 UPROPERTY (BlueprintReadOnly, Category = " Line" )
81108 FVector2D StartingPoint = FVector2D::ZeroVector;
82- /* The starting direction the cursor was going when the line was started. */
83- UPROPERTY (BlueprintReadOnly, Category = " Line" )
84- FVector2D StartingDirection = FVector2D::ZeroVector;
85- /* Stopping Point of the line. */
109+ /* The stopping point of the line. */
86110 UPROPERTY (BlueprintReadOnly, Category = " Line" )
87111 FVector2D StoppingPoint = FVector2D::ZeroVector;
88- /* The stopping direction the cursor was going when the line was started. */
89- UPROPERTY (BlueprintReadOnly, Category = " Line" )
90- FVector2D StoppingDirection = FVector2D::ZeroVector;
91112 /* Pen data that is used for drawing the line. */
92113 UPROPERTY (BlueprintReadOnly, Category = " Line" )
93114 FCanvasPenData PenData = FCanvasPenData ();
94-
115+
95116 /* Returns how long since the line has been drawn. */
96117 float GetLineLifetime (UObject* worldContext) const ;
118+
97119};
0 commit comments