Skip to content

Commit c0a0089

Browse files
author
David
committed
More updates to fix 4.25 deprecations.
1 parent 482355c commit c0a0089

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎Source/PythonEditor/Private/PythonProjectEditorCommands.cpp‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ FPythonProjectEditorCommands::FPythonProjectEditorCommands()
1414

1515
void FPythonProjectEditorCommands::RegisterCommands()
1616
{
17+
#if ENGINE_MINOR_VERSION >= 25
18+
UI_COMMAND(New, "New", "New Python Script.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::N));
19+
UI_COMMAND(NewDirectory, "New Directory", "New Directory.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::N));
20+
UI_COMMAND(Delete, "Delete", "Delete Python Script.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::D));
21+
22+
UI_COMMAND(Save, "Save", "Save the currently active document.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::S));
23+
UI_COMMAND(SaveAll, "Save All", "Save all open documents.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::S));
24+
UI_COMMAND(Execute, "Execute", "Execute Current Python File.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::Enter));
25+
#if PLATFORM_MAC
26+
UI_COMMAND(ExecuteInMainThread, "Execute In Main Thread", "Execute Current Python File in the Main Thread.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::Enter));
27+
#endif
28+
UI_COMMAND(PEP8ize, "PEP8-ize", "Enforce PEP8 to the current code.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::P));
29+
#else
1730
UI_COMMAND(New, "New", "New Python Script.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control, EKeys::N));
1831
UI_COMMAND(NewDirectory, "New Directory", "New Directory.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::N));
1932
UI_COMMAND(Delete, "Delete", "Delete Python Script.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control, EKeys::D));
@@ -25,6 +38,7 @@ void FPythonProjectEditorCommands::RegisterCommands()
2538
UI_COMMAND(ExecuteInMainThread, "Execute In Main Thread", "Execute Current Python File in the Main Thread.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::Enter));
2639
#endif
2740
UI_COMMAND(PEP8ize, "PEP8-ize", "Enforce PEP8 to the current code.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::P));
41+
#endif
2842

2943
}
3044

‎Source/UnrealEnginePython/Private/Slate/UEPySlate.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,10 +1020,17 @@ class FPythonSlateCommands : public TCommands<FPythonSlateCommands>
10201020
virtual void RegisterCommands() override
10211021
{
10221022
commands = MakeShareable(new FUICommandList);
1023+
#if ENGINE_MINOR_VERSION >= 25
1024+
// probabaly not the way to do this Runtime/Slate/Public/Framework/Commands/Commands.h says to use FUICommandInfo::MakeCommandInfo
1025+
// - apparently only the macros are used for localization - ie this will not get localized
1026+
// not clear why the UI_COMMAND macro is not used here - which simply expands to the following call
1027+
MakeUICommand_InternalUseOnly(this, command, nullptr, *name, *name, TCHAR_TO_UTF8(*name), *name, *name, EUserInterfaceActionType::Button, FInputChord());
1028+
#else
10231029
#if ENGINE_MINOR_VERSION >= 23
10241030
MakeUICommand_InternalUseOnly(this, command, nullptr, *name, *name, TCHAR_TO_UTF8(*name), *name, *name, EUserInterfaceActionType::Button, FInputGesture());
10251031
#else
10261032
UI_COMMAND_Function(this, command, nullptr, *name, *name, TCHAR_TO_UTF8(*name), *name, *name, EUserInterfaceActionType::Button, FInputGesture());
1033+
#endif
10271034
#endif
10281035
commands->MapAction(command, FExecuteAction::CreateRaw(this, &FPythonSlateCommands::Callback), FCanExecuteAction());
10291036
}

‎Source/UnrealEnginePython/Private/UObject/UEPyCapture.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,12 @@ struct FInEditorMultiCapture : TSharedFromThis<FInEditorMultiCapture>
212212
PlayInEditorSettings->LaunchConfiguration = EPlayOnLaunchConfiguration::LaunchConfig_Default;
213213
PlayInEditorSettings->SetPlayNetMode(EPlayNetMode::PIE_Standalone);
214214
PlayInEditorSettings->SetRunUnderOneProcess(true);
215+
#if ENGINE_MINOR_VERSION >= 25
216+
// I hope this is equivalent ie play dedicated is same as launching a separate server
217+
PlayInEditorSettings->bLaunchSeparateServer = false;
218+
#else
215219
PlayInEditorSettings->SetPlayNetDedicated(false);
220+
#endif
216221
PlayInEditorSettings->SetPlayNumberOfClients(1);
217222
}
218223

‎Source/UnrealEnginePython/Private/UObject/UEPyPlayer.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ PyObject *py_ue_create_player(ue_PyUObject *self, PyObject * args)
155155
if (!controller)
156156
return PyErr_Format(PyExc_Exception, "unable to create a new player from controller %d", controller_id);
157157

158+
#if ENGINE_MINOR_VERSION >= 25
159+
return PyLong_FromLong(controller->PlayerState->GetPlayerId());
160+
#else
158161
return PyLong_FromLong(controller->PlayerState->PlayerId);
162+
#endif
159163
}
160164

161165
PyObject *py_ue_get_num_players(ue_PyUObject *self, PyObject * args)

0 commit comments

Comments
 (0)