From 038192d7814d1aee182766028640d238204fefa4 Mon Sep 17 00:00:00 2001 From: Roberto De Ioris Date: Wed, 11 Sep 2019 05:27:13 +0200 Subject: [PATCH] completed porting to 4.23. fixes #777 --- .../Private/Slate/UEPySTextBlock.cpp | 4 ++++ Source/UnrealEnginePython/Private/Slate/UEPySlate.cpp | 5 ++++- Source/UnrealEnginePython/Private/UEPyModule.cpp | 2 ++ .../UnrealEnginePython/Private/UObject/UEPyObject.cpp | 4 ++++ .../Private/Wrappers/UEPyFFoliageInstance.cpp | 11 +++++++++-- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Source/UnrealEnginePython/Private/Slate/UEPySTextBlock.cpp b/Source/UnrealEnginePython/Private/Slate/UEPySTextBlock.cpp index a994186a5..92df02d50 100644 --- a/Source/UnrealEnginePython/Private/Slate/UEPySTextBlock.cpp +++ b/Source/UnrealEnginePython/Private/Slate/UEPySTextBlock.cpp @@ -70,7 +70,11 @@ static int ue_py_stext_block_init(ue_PySTextBlock *self, PyObject *args, PyObjec ue_py_slate_farguments_float("line_height_percentage", LineHeightPercentage); ue_py_slate_farguments_struct("margin", Margin, FMargin); ue_py_slate_farguments_float("min_desired_width", MinDesiredWidth); +#if ENGINE_MINOR_VERSION >= 23 + ue_py_slate_farguments_event("on_double_clicked", OnDoubleClicked, FPointerEventHandler, OnMouseEvent); +#else ue_py_slate_farguments_event("on_double_clicked", OnDoubleClicked, FOnClicked, OnClicked); +#endif ue_py_slate_farguments_flinear_color("shadow_color_and_opacity", ShadowColorAndOpacity); ue_py_slate_farguments_fvector2d("shadow_offset", ShadowOffset); ue_py_slate_farguments_text("text", Text); diff --git a/Source/UnrealEnginePython/Private/Slate/UEPySlate.cpp b/Source/UnrealEnginePython/Private/Slate/UEPySlate.cpp index 0cc988240..2e705a303 100644 --- a/Source/UnrealEnginePython/Private/Slate/UEPySlate.cpp +++ b/Source/UnrealEnginePython/Private/Slate/UEPySlate.cpp @@ -1020,8 +1020,11 @@ class FPythonSlateCommands : public TCommands virtual void RegisterCommands() override { commands = MakeShareable(new FUICommandList); - +#if ENGINE_MINOR_VERSION >= 23 + MakeUICommand_InternalUseOnly(this, command, nullptr, *name, *name, TCHAR_TO_UTF8(*name), *name, *name, EUserInterfaceActionType::Button, FInputGesture()); +#else UI_COMMAND_Function(this, command, nullptr, *name, *name, TCHAR_TO_UTF8(*name), *name, *name, EUserInterfaceActionType::Button, FInputGesture()); +#endif commands->MapAction(command, FExecuteAction::CreateRaw(this, &FPythonSlateCommands::Callback), FCanExecuteAction()); } diff --git a/Source/UnrealEnginePython/Private/UEPyModule.cpp b/Source/UnrealEnginePython/Private/UEPyModule.cpp index b725ae7f0..56954d32e 100644 --- a/Source/UnrealEnginePython/Private/UEPyModule.cpp +++ b/Source/UnrealEnginePython/Private/UEPyModule.cpp @@ -744,7 +744,9 @@ static PyMethodDef ue_PyUObject_methods[] = { { "get_raw_animation_data", (PyCFunction)py_ue_anim_sequence_get_raw_animation_data, METH_VARARGS, "" }, { "get_raw_animation_track", (PyCFunction)py_ue_anim_sequence_get_raw_animation_track, METH_VARARGS, "" }, { "add_new_raw_track", (PyCFunction)py_ue_anim_sequence_add_new_raw_track, METH_VARARGS, "" }, +#if ENGINE_MINOR_VERSION <23 { "update_compressed_track_map_from_raw", (PyCFunction)py_ue_anim_sequence_update_compressed_track_map_from_raw, METH_VARARGS, "" }, +#endif { "update_raw_track", (PyCFunction)py_ue_anim_sequence_update_raw_track, METH_VARARGS, "" }, { "apply_raw_anim_changes", (PyCFunction)py_ue_anim_sequence_apply_raw_anim_changes, METH_VARARGS, "" }, { "add_key_to_sequence", (PyCFunction)py_ue_anim_add_key_to_sequence, METH_VARARGS, "" }, diff --git a/Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp b/Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp index d11031775..3b2983b99 100644 --- a/Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp +++ b/Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp @@ -1084,7 +1084,11 @@ PyObject *py_ue_broadcast(ue_PyUObject *self, PyObject *args) if (auto casted_prop = Cast(u_property)) { +#if ENGINE_MINOR_VERSION >= 23 + FMulticastScriptDelegate multiscript_delegate = *casted_prop->GetMulticastDelegate(self->ue_object); +#else FMulticastScriptDelegate multiscript_delegate = casted_prop->GetPropertyValue_InContainer(self->ue_object); +#endif uint8 *parms = (uint8 *)FMemory_Alloca(casted_prop->SignatureFunction->PropertiesSize); FMemory::Memzero(parms, casted_prop->SignatureFunction->PropertiesSize); diff --git a/Source/UnrealEnginePython/Private/Wrappers/UEPyFFoliageInstance.cpp b/Source/UnrealEnginePython/Private/Wrappers/UEPyFFoliageInstance.cpp index eb48a0631..2ed7ffa2d 100644 --- a/Source/UnrealEnginePython/Private/Wrappers/UEPyFFoliageInstance.cpp +++ b/Source/UnrealEnginePython/Private/Wrappers/UEPyFFoliageInstance.cpp @@ -33,8 +33,7 @@ static FFoliageInstance* get_foliage_instance(ue_PyFFoliageInstance* self) } #if ENGINE_MINOR_VERSION >= 23 - auto FoliageInfo = self->foliage_actor->FoliageInfos[self->foliage_type.Get()]; - FFoliageInfo& info = info; + FFoliageInfo& info = self->foliage_actor->FoliageInfos[self->foliage_type.Get()].Get(); #else FFoliageMeshInfo& info = self->foliage_actor->FoliageMeshes[self->foliage_type.Get()].Get(); @@ -72,7 +71,11 @@ static int py_ue_ffoliage_instance_set_location(ue_PyFFoliageInstance* self, PyO { TArray instances; instances.Add(self->instance_id); +#if ENGINE_MINOR_VERSION >= 23 + FFoliageInfo& info = self->foliage_actor->FoliageInfos[self->foliage_type.Get()].Get(); +#else FFoliageMeshInfo& info = self->foliage_actor->FoliageMeshes[self->foliage_type.Get()].Get(); +#endif info.PreMoveInstances(self->foliage_actor.Get(), instances); instance->Location = vec->vec; info.PostMoveInstances(self->foliage_actor.Get(), instances); @@ -93,7 +96,11 @@ static int py_ue_ffoliage_instance_set_rotation(ue_PyFFoliageInstance* self, PyO { TArray instances; instances.Add(self->instance_id); +#if ENGINE_MINOR_VERSION >= 23 + FFoliageInfo& info = self->foliage_actor->FoliageInfos[self->foliage_type.Get()].Get(); +#else FFoliageMeshInfo& info = self->foliage_actor->FoliageMeshes[self->foliage_type.Get()].Get(); +#endif info.PreMoveInstances(self->foliage_actor.Get(), instances); instance->Rotation = rot->rot; info.PostMoveInstances(self->foliage_actor.Get(), instances);