Skip to content

Commit f71b830

Browse files
author
Nako Sung
committed
Spline drawing function
1 parent ad84875 commit f71b830

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

Plugins/UnrealJS/Source/JavascriptUMG/JavascriptUMGBlueprintLibrary.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,23 @@ FSlateColor UJavascriptUMGBlueprintLibrary::SlateColor_UseForeground()
99
FSlateColor UJavascriptUMGBlueprintLibrary::SlateColor_UseSubduedForeground()
1010
{
1111
return FSlateColor::UseSubduedForeground();
12+
}
13+
14+
void UJavascriptUMGBlueprintLibrary::DrawSpaceSpline(UPARAM(ref) FPaintContext& Context, FVector2D InStart, FVector2D InStartDir, FVector2D InEnd, FVector2D InEndDir, float InThickness, FLinearColor InTint)
15+
{
16+
Context.MaxLayer++;
17+
18+
auto Transform = Context.AllottedGeometry.GetAccumulatedLayoutTransform();
19+
20+
FSlateDrawElement::MakeDrawSpaceSpline(
21+
Context.OutDrawElements,
22+
Context.MaxLayer,
23+
Transform.TransformPoint(InStart),
24+
Transform.TransformVector(InStartDir),
25+
Transform.TransformPoint(InEnd),
26+
Transform.TransformVector(InEndDir),
27+
Context.MyClippingRect,
28+
InThickness * Transform.GetScale(),
29+
ESlateDrawEffect::None,
30+
InTint);
1231
}

Plugins/UnrealJS/Source/JavascriptUMG/JavascriptUMGBlueprintLibrary.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*/
88
UCLASS()
9-
class JAVASCRIPTUMG_API UJavascriptUMGBlueprintLibrary : public UUserWidget
9+
class JAVASCRIPTUMG_API UJavascriptUMGBlueprintLibrary : public UBlueprintFunctionLibrary
1010
{
1111
GENERATED_BODY()
1212

@@ -16,4 +16,7 @@ class JAVASCRIPTUMG_API UJavascriptUMGBlueprintLibrary : public UUserWidget
1616

1717
UFUNCTION(BlueprintCallable, Category = "Scripting | Javascript")
1818
static FSlateColor SlateColor_UseSubduedForeground();
19+
20+
UFUNCTION(BlueprintCallable, Category = "Painting")
21+
static void DrawSpaceSpline(UPARAM(ref) FPaintContext& Context, FVector2D InStart, FVector2D InStartDir, FVector2D InEnd, FVector2D InEndDir, float InThickness, FLinearColor InTint);
1922
};

Plugins/UnrealJS/Source/V8/Private/FunctionCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace v8
6363
if (bHasAnyOutParams)
6464
{
6565
FIsolateHelper I(isolate);
66-
if (!value->IsObject())
66+
if (value.IsEmpty() || !value->IsObject())
6767
{
6868
I.Throw(TEXT("..."));
6969
return;

Plugins/UnrealJS/Source/V8/Public/JavascriptLibrary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,5 @@ class V8_API UJavascriptLibrary : public UBlueprintFunctionLibrary
120120
static UModel* GetModel(UWorld* World);
121121

122122
UFUNCTION(BlueprintCallable, Category = "Scripting | Javascript")
123-
static ULevel* GetLevel(AActor* Actor);
123+
static ULevel* GetLevel(AActor* Actor);
124124
};

0 commit comments

Comments
 (0)