Repository navigation
Expand file tree
/
Copy pathPythonComponent.h
More file actions
91 lines (62 loc) · 3.04 KB
/
Copy pathPythonComponent.h
File metadata and controls
91 lines (62 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#pragma once
#include "Components/ActorComponent.h"
#include "PythonComponent.generated.h"
UCLASS(BlueprintType, Blueprintable, ClassGroup = (Python), meta = (BlueprintSpawnableComponent))
class UPythonComponent : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UPythonComponent();
~UPythonComponent();
// Called when the game starts
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual void InitializeComponent() override;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Python")
FString PythonModule;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Python")
FString PythonClass;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Python")
bool PythonTickForceDisabled;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Python")
bool PythonDisableAutoBinding;
UFUNCTION(BlueprintCallable, Category = "Python")
void InitializePythonComponent();
UFUNCTION(BlueprintCallable, Category = "Python")
void CallPythonComponentMethod(FString method_name, FString args);
UFUNCTION(BlueprintCallable, Category = "Python")
bool CallPythonComponentMethodBool(FString method_name, FString args);
UFUNCTION(BlueprintCallable, Category = "Python")
FString CallPythonComponentMethodString(FString method_name, FString args);
UFUNCTION(BlueprintCallable, Category = "Python")
TMap<FString, FString> CallPythonComponentMethodMap(FString method_name, FString args);
UFUNCTION(BlueprintCallable, Category = "Python")
void CallPythonComponentMethodStringArray(FString method_name, FString args, TArray<FString> &output_strings);
UFUNCTION(BlueprintCallable, Category = "Python")
float CallPythonComponentMethodFloat(FString method_name, FString args);
UFUNCTION(BlueprintCallable, Category = "Python")
int CallPythonComponentMethodInt(FString method_name, FString args);
UFUNCTION(BlueprintCallable, Category = "Python")
UObject *CallPythonComponentMethodObject(FString method_name, UObject *arg);
UFUNCTION(BlueprintCallable, Category = "Python")
void SetPythonAttrInt(FString attr, int Integer);
UFUNCTION(BlueprintCallable, Category = "Python")
void SetPythonAttrFloat(FString attr, float Float);
UFUNCTION(BlueprintCallable, Category = "Python")
void SetPythonAttrString(FString attr, FString String);
UFUNCTION(BlueprintCallable, Category = "Python")
void SetPythonAttrBool(FString attr, bool Boolean);
UFUNCTION(BlueprintCallable, Category = "Python")
void SetPythonAttrVector(FString attr, FVector Vector);
UFUNCTION(BlueprintCallable, Category = "Python")
void SetPythonAttrRotator(FString attr, FRotator Rotator);
UFUNCTION(BlueprintCallable, Category = "Python")
void SetPythonAttrObject(FString attr, UObject *Object);
private:
PyObject *py_component_instance;
// mapped uobject, required for debug and advanced reflection
ue_PyUObject *py_uobject;
};