|
51 | 51 | #include "Wrappers/UEPyESlateEnums.h" |
52 | 52 |
|
53 | 53 | #include "Wrappers/UEPyFVector.h" |
| 54 | +#include "Wrappers/UEPyFVector2D.h" |
54 | 55 | #include "Wrappers/UEPyFHitResult.h" |
55 | 56 | #include "Wrappers/UEPyFRotator.h" |
56 | 57 | #include "Wrappers/UEPyFTransform.h" |
@@ -1656,6 +1657,7 @@ void unreal_engine_init_py_module() |
1656 | 1657 | } |
1657 | 1658 |
|
1658 | 1659 | ue_python_init_fvector(new_unreal_engine_module); |
| 1660 | + ue_python_init_fvector2d(new_unreal_engine_module); |
1659 | 1661 | ue_python_init_frotator(new_unreal_engine_module); |
1660 | 1662 | ue_python_init_ftransform(new_unreal_engine_module); |
1661 | 1663 | ue_python_init_fhitresult(new_unreal_engine_module); |
@@ -2105,12 +2107,16 @@ PyObject *ue_py_convert_property(UProperty *prop, uint8 *buffer, int32 index) |
2105 | 2107 | { |
2106 | 2108 | if (auto casted_struct = Cast<UScriptStruct>(casted_prop->Struct)) |
2107 | 2109 | { |
2108 | | - // check for FVector |
2109 | 2110 | if (casted_struct == TBaseStructure<FVector>::Get()) |
2110 | 2111 | { |
2111 | 2112 | FVector vec = *casted_prop->ContainerPtrToValuePtr<FVector>(buffer, index); |
2112 | 2113 | return py_ue_new_fvector(vec); |
2113 | 2114 | } |
| 2115 | + if (casted_struct == TBaseStructure<FVector2D>::Get()) |
| 2116 | + { |
| 2117 | + FVector2D vec = *casted_prop->ContainerPtrToValuePtr<FVector2D>(buffer, index); |
| 2118 | + return py_ue_new_fvector2d(vec); |
| 2119 | + } |
2114 | 2120 | if (casted_struct == TBaseStructure<FRotator>::Get()) |
2115 | 2121 | { |
2116 | 2122 | FRotator rot = *casted_prop->ContainerPtrToValuePtr<FRotator>(buffer, index); |
@@ -2516,6 +2522,19 @@ bool ue_py_convert_pyobject(PyObject *py_obj, UProperty *prop, uint8 *buffer, in |
2516 | 2522 | return false; |
2517 | 2523 | } |
2518 | 2524 |
|
| 2525 | + if (ue_PyFVector2D *py_vec = py_ue_is_fvector2d(py_obj)) |
| 2526 | + { |
| 2527 | + if (auto casted_prop = Cast<UStructProperty>(prop)) |
| 2528 | + { |
| 2529 | + if (casted_prop->Struct == TBaseStructure<FVector2D>::Get()) |
| 2530 | + { |
| 2531 | + *casted_prop->ContainerPtrToValuePtr<FVector2D>(buffer, index) = py_vec->vec; |
| 2532 | + return true; |
| 2533 | + } |
| 2534 | + } |
| 2535 | + return false; |
| 2536 | + } |
| 2537 | + |
2519 | 2538 | if (ue_PyFRotator *py_rot = py_ue_is_frotator(py_obj)) |
2520 | 2539 | { |
2521 | 2540 | if (auto casted_prop = Cast<UStructProperty>(prop)) |
@@ -3171,6 +3190,12 @@ UFunction *unreal_engine_add_function(UClass *u_class, char *name, PyObject *py_ |
3171 | 3190 | prop_struct->Struct = TBaseStructure<FVector>::Get(); |
3172 | 3191 | prop = prop_struct; |
3173 | 3192 | } |
| 3193 | + else if ((PyTypeObject *)value == &ue_PyFVector2DType) |
| 3194 | + { |
| 3195 | + UStructProperty *prop_struct = NewObject<UStructProperty>(function, UTF8_TO_TCHAR(p_name), RF_Public); |
| 3196 | + prop_struct->Struct = TBaseStructure<FVector2D>::Get(); |
| 3197 | + prop = prop_struct; |
| 3198 | + } |
3174 | 3199 | else if ((PyTypeObject *)value == &ue_PyFRotatorType) |
3175 | 3200 | { |
3176 | 3201 | UStructProperty *prop_struct = NewObject<UStructProperty>(function, UTF8_TO_TCHAR(p_name), RF_Public); |
@@ -3314,6 +3339,12 @@ UFunction *unreal_engine_add_function(UClass *u_class, char *name, PyObject *py_ |
3314 | 3339 | prop_struct->Struct = TBaseStructure<FVector>::Get(); |
3315 | 3340 | prop = prop_struct; |
3316 | 3341 | } |
| 3342 | + else if ((PyTypeObject *)py_return_value == &ue_PyFVector2DType) |
| 3343 | + { |
| 3344 | + UStructProperty *prop_struct = NewObject<UStructProperty>(function, UTF8_TO_TCHAR(p_name), RF_Public); |
| 3345 | + prop_struct->Struct = TBaseStructure<FVector2D>::Get(); |
| 3346 | + prop = prop_struct; |
| 3347 | + } |
3317 | 3348 | else if ((PyTypeObject *)py_return_value == &ue_PyFRotatorType) |
3318 | 3349 | { |
3319 | 3350 | UStructProperty *prop_struct = NewObject<UStructProperty>(function, UTF8_TO_TCHAR(p_name), RF_Public); |
|
0 commit comments