Skip to content

Commit 227df3c

Browse files
author
ikrima
committed
Merge remote-tracking branch 'upstream/master' into bebylon
# Conflicts: # Source/UnrealEnginePython/Private/ConsoleManager/UEPyIConsoleManager.cpp # Source/UnrealEnginePython/Private/Slate/UEPySPythonTreeView.cpp # Source/UnrealEnginePython/Private/Slate/UEPySTreeView.cpp # Source/UnrealEnginePython/Private/Slate/UEPySWidget.cpp # Source/UnrealEnginePython/Private/UEPyEditor.cpp # Source/UnrealEnginePython/Private/UEPyEngine.cpp # Source/UnrealEnginePython/Private/UEPyModule.cpp # Source/UnrealEnginePython/Private/UnrealEnginePython.cpp
2 parents 029577a + e1fbe9f commit 227df3c

File tree

78 files changed

+4551
-934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4551
-934
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Once the plugin is installed and enabled, you get access to the 'PythonConsole'
2121

2222
All of the exposed engine features are under the 'unreal_engine' virtual module (it is completely coded in c into the plugin, so do not expect to run 'import unreal_engine' from a standard python shell)
2323

24-
The currently supported Unreal Engine versions are 4.12, 4.13, 4.14, 4.15, 4.16 and 4.17.
24+
The currently supported Unreal Engine versions are 4.12, 4.13, 4.14, 4.15, 4.16, 4.17 and 4.18.
2525

2626
We support official python.org releases as well as IntelPython and Anaconda distributions.
2727

Source/PythonConsole/Private/SPythonLog.cpp

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "Engine/LocalPlayer.h"
88
#include "GameFramework/GameState.h"
99
#include "SSearchBox.h"
10+
#include "Runtime/Launch/Resources/Version.h"
1011
//#include "UnrealEnginePython.h"
1112
#define LOCTEXT_NAMESPACE "PythonConsole"
1213

@@ -46,7 +47,8 @@ class SPythonConsoleEditableTextBox : public SEditableTextBox
4647
]);
4748
}
4849

49-
void SetPythonBox(SPythonConsoleInputBox *box) {
50+
void SetPythonBox(SPythonConsoleInputBox *box)
51+
{
5052
SPythonConsoleEditableText *PythonEditableText = (SPythonConsoleEditableText *)EditableText.Get();
5153
box->HistoryPosition = 0;
5254
PythonEditableText->PythonConsoleInputBox = box;
@@ -72,15 +74,15 @@ class SPythonConsoleEditableTextBox : public SEditableTextBox
7274
void Construct(const FArguments& InArgs)
7375
{
7476
SEditableText::Construct
75-
(
76-
SEditableText::FArguments()
77-
.HintText(InArgs._HintText)
78-
.OnTextChanged(InArgs._OnTextChanged)
79-
.OnTextCommitted(InArgs._OnTextCommitted)
80-
.ClearKeyboardFocusOnCommit(false)
81-
.IsCaretMovedWhenGainFocus(false)
82-
.MinDesiredWidth(400.0f)
83-
);
77+
(
78+
SEditableText::FArguments()
79+
.HintText(InArgs._HintText)
80+
.OnTextChanged(InArgs._OnTextChanged)
81+
.OnTextCommitted(InArgs._OnTextCommitted)
82+
.ClearKeyboardFocusOnCommit(false)
83+
.IsCaretMovedWhenGainFocus(false)
84+
.MinDesiredWidth(400.0f)
85+
);
8486
}
8587

8688
virtual FReply OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent)
@@ -90,16 +92,20 @@ class SPythonConsoleEditableTextBox : public SEditableTextBox
9092
{
9193
return FReply::Unhandled();
9294
}
93-
else if (InKeyEvent.GetKey() == EKeys::Up) {
94-
if (PythonConsoleInputBox->HistoryPosition > 0) {
95+
else if (InKeyEvent.GetKey() == EKeys::Up)
96+
{
97+
if (PythonConsoleInputBox->HistoryPosition > 0)
98+
{
9599
PythonConsoleInputBox->HistoryPosition--;
96100
this->SetText(FText::FromString(PythonConsoleInputBox->History[PythonConsoleInputBox->HistoryPosition]));
97101
}
98102

99103
return FReply::Handled();
100104
}
101-
else if (InKeyEvent.GetKey() == EKeys::Down) {
102-
if (PythonConsoleInputBox->HistoryPosition < PythonConsoleInputBox->History.Num() - 1) {
105+
else if (InKeyEvent.GetKey() == EKeys::Down)
106+
{
107+
if (PythonConsoleInputBox->HistoryPosition < PythonConsoleInputBox->History.Num() - 1)
108+
{
103109
PythonConsoleInputBox->HistoryPosition++;
104110
this->SetText(FText::FromString(PythonConsoleInputBox->History[PythonConsoleInputBox->HistoryPosition]));
105111
}
@@ -213,25 +219,31 @@ void SPythonConsoleInputBox::OnTextCommitted(const FText& InText, ETextCommit::T
213219
//
214220
FUnrealEnginePythonModule &PythonModule = FModuleManager::GetModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython");
215221

216-
if (IsMultiline) {
217-
if (ExecString.StartsWith(" ")) {
222+
if (IsMultiline)
223+
{
224+
if (ExecString.StartsWith(" "))
225+
{
218226
MultilineString += FString("\n") + ExecString;
219227
}
220-
else {
228+
else
229+
{
221230
IsMultiline = false;
222231
PythonModule.RunString(TCHAR_TO_UTF8(*MultilineString));
223232
}
224233
}
225-
else if (ExecString.EndsWith(":")) {
234+
else if (ExecString.EndsWith(":"))
235+
{
226236
IsMultiline = true;
227237
MultilineString = ExecString;
228238
}
229-
else {
239+
else
240+
{
230241
PythonModule.RunString(TCHAR_TO_UTF8(*ExecString));
231242
}
232243

233244
}
234-
else if (IsMultiline) {
245+
else if (IsMultiline)
246+
{
235247
IsMultiline = false;
236248
FUnrealEnginePythonModule &PythonModule = FModuleManager::GetModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython");
237249
PythonModule.RunString(TCHAR_TO_UTF8(*MultilineString));
@@ -349,7 +361,11 @@ FPythonLogTextLayoutMarshaller::FPythonLogTextLayoutMarshaller(TArray< TSharedPt
349361
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
350362
void SPythonLog::Construct(const FArguments& InArgs)
351363
{
364+
#if ENGINE_MINOR_VERSION < 18
352365
MessagesTextMarshaller = FPythonLogTextLayoutMarshaller::Create(MoveTemp(InArgs._Messages));
366+
#else
367+
MessagesTextMarshaller = FPythonLogTextLayoutMarshaller::Create(InArgs._Messages);
368+
#endif
353369

354370
MessagesTextBox = SNew(SMultiLineEditableTextBox)
355371
.Style(FEditorStyle::Get(), "Log.TextBox")
@@ -485,14 +501,14 @@ void SPythonLog::ExtendTextBoxMenu(FMenuBuilder& Builder)
485501
FUIAction ClearPythonLogAction(
486502
FExecuteAction::CreateRaw(this, &SPythonLog::OnClearLog),
487503
FCanExecuteAction::CreateSP(this, &SPythonLog::CanClearLog)
488-
);
504+
);
489505

490506
Builder.AddMenuEntry(
491507
NSLOCTEXT("PythonConsole", "ClearLogLabel", "Clear Log"),
492508
NSLOCTEXT("PythonConsole", "ClearLogTooltip", "Clears all log messages"),
493509
FSlateIcon(),
494510
ClearPythonLogAction
495-
);
511+
);
496512
}
497513

498514
void SPythonLog::OnClearLog()

0 commit comments

Comments
 (0)