2019-12-26 23:01:54 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
|
|
|
|
|
#include "SLogWidget.h"
|
|
|
|
|
#include "Framework/Text/SlateTextRun.h"
|
2021-11-07 23:43:01 -05:00
|
|
|
#include "Framework/Commands/UIAction.h"
|
|
|
|
|
#include "Framework/MultiBox/MultiBoxBuilder.h"
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
#include "LiveCodingConsoleStyle.h"
|
|
|
|
|
#include "SlateOptMacros.h"
|
2020-08-11 01:36:57 -04:00
|
|
|
#include "HAL/FileManager.h"
|
|
|
|
|
#include "ISourceCodeAccessModule.h"
|
|
|
|
|
#include "ISourceCodeAccessor.h"
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
|
|
|
|
|
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "LiveCoding"
|
|
|
|
|
|
|
|
|
|
//// FLogWidgetTextLayoutMarshaller ////
|
|
|
|
|
|
|
|
|
|
FLogWidgetTextLayoutMarshaller::FLogWidgetTextLayoutMarshaller()
|
|
|
|
|
: TextLayout(nullptr)
|
|
|
|
|
{
|
|
|
|
|
DefaultStyle = FTextBlockStyle()
|
|
|
|
|
.SetFont( FCoreStyle::GetDefaultFontStyle( "Mono", 9 ) )
|
|
|
|
|
.SetColorAndOpacity( FLinearColor::White )
|
|
|
|
|
.SetSelectedBackgroundColor( FLinearColor(0.9f, 0.9f, 0.9f) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FLogWidgetTextLayoutMarshaller::~FLogWidgetTextLayoutMarshaller()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FLogWidgetTextLayoutMarshaller::SetText(const FString& SourceString, FTextLayout& TargetTextLayout)
|
|
|
|
|
{
|
|
|
|
|
TextLayout = &TargetTextLayout;
|
|
|
|
|
|
|
|
|
|
for(const TSharedRef<FString>& Line : Lines)
|
|
|
|
|
{
|
|
|
|
|
TextLayout->AddLine(FSlateTextLayout::FNewLineData(Line, TArray<TSharedRef<IRun>>()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FLogWidgetTextLayoutMarshaller::GetText(FString& TargetString, const FTextLayout& SourceTextLayout)
|
|
|
|
|
{
|
|
|
|
|
SourceTextLayout.GetAsText(TargetString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FLogWidgetTextLayoutMarshaller::Clear()
|
|
|
|
|
{
|
|
|
|
|
Lines.Empty();
|
|
|
|
|
MakeDirty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FLogWidgetTextLayoutMarshaller::AppendLine(const FSlateColor& Color, const FString& Line)
|
|
|
|
|
{
|
|
|
|
|
TSharedRef<FString> NewLine = MakeShared<FString>(Line);
|
|
|
|
|
Lines.Add(NewLine);
|
|
|
|
|
|
|
|
|
|
if(TextLayout)
|
|
|
|
|
{
|
|
|
|
|
// Remove the "default" line that's added for an empty text box.
|
|
|
|
|
if(Lines.Num() == 1)
|
|
|
|
|
{
|
|
|
|
|
TextLayout->ClearLines();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FTextBlockStyle Style = DefaultStyle;
|
|
|
|
|
Style.ColorAndOpacity = Color;
|
|
|
|
|
|
|
|
|
|
TArray<TSharedRef<IRun>> Runs;
|
|
|
|
|
Runs.Add(FSlateTextRun::Create(FRunInfo(), NewLine, Style));
|
|
|
|
|
TextLayout->AddLine(FSlateTextLayout::FNewLineData(NewLine, Runs));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int32 FLogWidgetTextLayoutMarshaller::GetNumLines() const
|
|
|
|
|
{
|
|
|
|
|
return Lines.Num();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//// SLogWidget ////
|
|
|
|
|
|
|
|
|
|
SLogWidget::SLogWidget()
|
2019-04-19 16:04:27 -04:00
|
|
|
: bIsUserScrolledX(false)
|
|
|
|
|
, bIsUserScrolledY(false)
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SLogWidget::~SLogWidget()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SLogWidget::Construct(const FArguments& InArgs)
|
|
|
|
|
{
|
|
|
|
|
MessagesTextMarshaller = MakeShared<FLogWidgetTextLayoutMarshaller>();
|
|
|
|
|
|
|
|
|
|
ChildSlot
|
|
|
|
|
[
|
2019-04-19 16:04:27 -04:00
|
|
|
SNew(SBorder)
|
|
|
|
|
[
|
|
|
|
|
SAssignNew(MessagesTextBox, SMultiLineEditableTextBox)
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
.Style(FLiveCodingConsoleStyle::Get(), "Log.TextBox")
|
2019-04-19 16:04:27 -04:00
|
|
|
.Marshaller(MessagesTextMarshaller)
|
|
|
|
|
.IsReadOnly(true)
|
|
|
|
|
.AlwaysShowScrollbars(true)
|
2020-09-01 14:07:48 -04:00
|
|
|
.SelectWordOnMouseDoubleClick(false)
|
2019-04-19 16:04:27 -04:00
|
|
|
.OnHScrollBarUserScrolled(this, &SLogWidget::OnScrollX)
|
|
|
|
|
.OnVScrollBarUserScrolled(this, &SLogWidget::OnScrollY)
|
2021-06-08 18:02:34 -04:00
|
|
|
.ContextMenuExtender(this, &SLogWidget::ExtendTextBoxMenu)
|
2019-04-19 16:04:27 -04:00
|
|
|
]
|
|
|
|
|
];
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
|
|
|
|
|
RegisterActiveTimer(0.03f, FWidgetActiveTimerDelegate::CreateSP(this, &SLogWidget::OnTimerElapsed));
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-08 18:02:34 -04:00
|
|
|
void SLogWidget::ExtendTextBoxMenu(FMenuBuilder& Builder)
|
|
|
|
|
{
|
|
|
|
|
FUIAction ClearOutputLogAction(
|
|
|
|
|
FExecuteAction::CreateRaw(this, &SLogWidget::OnClearLog),
|
|
|
|
|
FCanExecuteAction::CreateSP(this, &SLogWidget::CanClearLog)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Builder.AddMenuEntry(
|
|
|
|
|
NSLOCTEXT("OutputLog", "ClearLogLabel", "Clear Log"),
|
|
|
|
|
NSLOCTEXT("OutputLog", "ClearLogTooltip", "Clears all log messages"),
|
|
|
|
|
FSlateIcon(),
|
|
|
|
|
ClearOutputLogAction
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SLogWidget::OnClearLog()
|
|
|
|
|
{
|
|
|
|
|
// Make sure the cursor is back at the start of the log before we clear it
|
|
|
|
|
MessagesTextBox->GoTo(FTextLocation(0));
|
|
|
|
|
|
|
|
|
|
Clear();
|
|
|
|
|
MessagesTextBox->Refresh();
|
|
|
|
|
bIsUserScrolledX = false;
|
|
|
|
|
bIsUserScrolledY = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SLogWidget::CanClearLog() const
|
|
|
|
|
{
|
|
|
|
|
return MessagesTextMarshaller->GetNumLines() > 0;
|
|
|
|
|
}
|
|
|
|
|
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
void SLogWidget::Clear()
|
|
|
|
|
{
|
|
|
|
|
MessagesTextMarshaller->Clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SLogWidget::ScrollToEnd()
|
|
|
|
|
{
|
|
|
|
|
MessagesTextBox->ScrollTo(FTextLocation(MessagesTextMarshaller->GetNumLines() - 1));
|
2019-04-19 16:04:27 -04:00
|
|
|
bIsUserScrolledX = false;
|
|
|
|
|
bIsUserScrolledY = false;
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SLogWidget::AppendLine(const FSlateColor& Color, const FString& Text)
|
|
|
|
|
{
|
2021-06-09 14:10:35 -04:00
|
|
|
// Split any multi line text block into multiple lines while removing the \r\n or \n from the string.
|
|
|
|
|
// The ParseIntoArray method will either leave the trailing blank line or eliminate all contained blank
|
|
|
|
|
// lines so we use a hand written algorithm.
|
|
|
|
|
for (const TCHAR* Cur = *Text, *End = Cur + Text.Len(); Cur != End;)
|
|
|
|
|
{
|
|
|
|
|
const TCHAR* LineStart = Cur;
|
2021-06-10 08:45:15 -04:00
|
|
|
const TCHAR* LineEnd = End;
|
2021-06-09 14:10:35 -04:00
|
|
|
for (; Cur != End; ++Cur)
|
|
|
|
|
{
|
|
|
|
|
if (*Cur == '\n')
|
|
|
|
|
{
|
|
|
|
|
LineEnd = Cur;
|
|
|
|
|
++Cur;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (*Cur == '\r')
|
|
|
|
|
{
|
|
|
|
|
LineEnd = Cur;
|
|
|
|
|
++Cur;
|
|
|
|
|
if (Cur != End && *Cur == '\n')
|
|
|
|
|
{
|
|
|
|
|
++Cur;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
FScopeLock Lock(&CriticalSection);
|
|
|
|
|
QueuedLines.Add(FLine{ Color, FString(LineEnd - LineStart, LineStart) });
|
|
|
|
|
}
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
}
|
|
|
|
|
|
2019-04-19 16:04:27 -04:00
|
|
|
void SLogWidget::OnScrollX(float ScrollOffset)
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
{
|
2019-04-19 16:04:27 -04:00
|
|
|
bIsUserScrolledX = ScrollOffset > 0.0 && !FMath::IsNearlyEqual(ScrollOffset, 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SLogWidget::OnScrollY(float ScrollOffset)
|
|
|
|
|
{
|
|
|
|
|
bIsUserScrolledY = ScrollOffset < 1.0 && !FMath::IsNearlyEqual(ScrollOffset, 1.0f);
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EActiveTimerReturnType SLogWidget::OnTimerElapsed(double CurrentTime, float DeltaTime)
|
|
|
|
|
{
|
|
|
|
|
FScopeLock Lock(&CriticalSection);
|
|
|
|
|
for(const FLine& QueuedLine : QueuedLines)
|
|
|
|
|
{
|
|
|
|
|
MessagesTextMarshaller->AppendLine(QueuedLine.Color, QueuedLine.Text);
|
|
|
|
|
}
|
2019-04-19 16:04:27 -04:00
|
|
|
if(!bIsUserScrolledX && !bIsUserScrolledY)
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
{
|
|
|
|
|
ScrollToEnd();
|
|
|
|
|
}
|
|
|
|
|
QueuedLines.Empty();
|
|
|
|
|
return EActiveTimerReturnType::Continue;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 01:36:57 -04:00
|
|
|
bool ExtractFilepathAndLineNumber(FString& PotentialFilePath, int32& LineNumber)
|
|
|
|
|
{
|
|
|
|
|
// Extract filename and line number using regex
|
|
|
|
|
#if PLATFORM_WINDOWS
|
|
|
|
|
const FRegexPattern SourceCodeRegexPattern(TEXT("([a-zA-Z]:/[^:\\n\\r()]+(h|cpp))\\s?\\(([0-9]+)\\)"));
|
|
|
|
|
const int32 LineNumberCaptureGroupID = 3;
|
|
|
|
|
#else
|
|
|
|
|
const FRegexPattern SourceCodeRegexPattern(TEXT("((//([^:/\\n]+[/])*)([^/]+)(h|cpp))\\s?\\(([0-9]+)\\)"));
|
|
|
|
|
const int32 LineNumberCaptureGroupID = 6;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
FRegexMatcher SourceCodeRegexMatcher(SourceCodeRegexPattern, PotentialFilePath);
|
|
|
|
|
if (SourceCodeRegexMatcher.FindNext())
|
|
|
|
|
{
|
|
|
|
|
PotentialFilePath = SourceCodeRegexMatcher.GetCaptureGroup(1);
|
|
|
|
|
LineNumber = FCString::Strtoi(*SourceCodeRegexMatcher.GetCaptureGroup(LineNumberCaptureGroupID), nullptr, 10);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FReply SLogWidget::OnMouseButtonDoubleClick(const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent)
|
|
|
|
|
{
|
|
|
|
|
if (InMouseEvent.GetEffectingButton() == EKeys::LeftMouseButton)
|
|
|
|
|
{
|
|
|
|
|
// grab cursor location's line of text
|
|
|
|
|
FString PotentialCodeFilePath;
|
|
|
|
|
MessagesTextBox->GetCurrentTextLine(PotentialCodeFilePath);
|
|
|
|
|
|
|
|
|
|
// Extract potential .cpp./h files file path & line number
|
|
|
|
|
int32 LineNumber = 0;
|
|
|
|
|
PotentialCodeFilePath = IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*PotentialCodeFilePath);
|
|
|
|
|
if (ExtractFilepathAndLineNumber(PotentialCodeFilePath, LineNumber) && PotentialCodeFilePath.Len() && IFileManager::Get().FileSize(*PotentialCodeFilePath) != INDEX_NONE)
|
|
|
|
|
{
|
|
|
|
|
ISourceCodeAccessModule& SourceCodeAccessModule = FModuleManager::LoadModuleChecked<ISourceCodeAccessModule>("SourceCodeAccess");
|
|
|
|
|
SourceCodeAccessModule.GetAccessor().OpenFileAtLine(PotentialCodeFilePath, LineNumber);
|
|
|
|
|
}
|
2020-09-01 14:07:48 -04:00
|
|
|
|
|
|
|
|
return FReply::Handled();
|
2020-08-11 01:36:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FReply::Unhandled();
|
|
|
|
|
}
|
|
|
|
|
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
#undef LOCTEXT_NAMESPACE
|
|
|
|
|
|
|
|
|
|
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|