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