2019-12-26 15:33:43 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "Debugging/SKismetDebuggingView.h"
|
2021-10-12 21:21:22 -04:00
|
|
|
#include "Debugging/SKismetDebugTreeView.h"
|
2021-08-12 12:14:12 -04:00
|
|
|
#include "BlueprintEditor.h"
|
2021-08-05 13:38:38 -04:00
|
|
|
#include "ClassViewerFilter.h"
|
|
|
|
|
#include "ClassViewerModule.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "EdGraph/EdGraphPin.h"
|
|
|
|
|
#include "Engine/Blueprint.h"
|
|
|
|
|
#include "Textures/SlateIcon.h"
|
|
|
|
|
#include "Framework/Commands/UIAction.h"
|
|
|
|
|
#include "Widgets/Images/SImage.h"
|
|
|
|
|
#include "Framework/MultiBox/MultiBoxDefs.h"
|
|
|
|
|
#include "Framework/MultiBox/MultiBoxBuilder.h"
|
|
|
|
|
#include "Widgets/Input/SButton.h"
|
2022-05-09 13:12:28 -04:00
|
|
|
#include "Styling/AppStyle.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "GameFramework/Actor.h"
|
|
|
|
|
#include "Editor/EditorEngine.h"
|
|
|
|
|
#include "EngineGlobals.h"
|
|
|
|
|
#include "Engine/BlueprintGeneratedClass.h"
|
|
|
|
|
#include "Editor.h"
|
2021-08-12 12:14:12 -04:00
|
|
|
#include "GraphEditorSettings.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "Kismet2/KismetEditorUtilities.h"
|
|
|
|
|
#include "K2Node.h"
|
2021-07-26 15:05:16 -04:00
|
|
|
#include "Kismet2/Breakpoint.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "Kismet2/KismetDebugUtilities.h"
|
|
|
|
|
#include "Kismet2/DebuggerCommands.h"
|
|
|
|
|
#include "Widgets/Input/SHyperlink.h"
|
2019-11-04 12:21:36 -05:00
|
|
|
#include "ToolMenus.h"
|
2021-08-05 13:38:38 -04:00
|
|
|
#include "PropertyEditor/Private/SDetailsView.h"
|
|
|
|
|
#include "Styling/SlateIconFinder.h"
|
|
|
|
|
#include "Styling/StyleColors.h"
|
2021-08-12 12:14:12 -04:00
|
|
|
#include "Kismet2/BlueprintEditorUtils.h"
|
|
|
|
|
#include "PropertyInfoViewStyle.h"
|
2021-08-25 15:30:56 -04:00
|
|
|
#include "GenericPlatform/GenericPlatformApplicationMisc.h"
|
2021-09-13 21:05:43 -04:00
|
|
|
#include "Widgets/Input/SCheckBox.h"
|
2021-08-20 13:37:19 -04:00
|
|
|
#include "Widgets/Input/SSearchBox.h"
|
2021-08-25 15:30:56 -04:00
|
|
|
#include "HAL/PlatformApplicationMisc.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "DebugViewUI"
|
|
|
|
|
|
|
|
|
|
DEFINE_LOG_CATEGORY_STATIC(LogBlueprintDebuggingView, Log, All);
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
namespace KismetDebugViewConstants
|
|
|
|
|
{
|
2014-11-26 12:46:05 -05:00
|
|
|
const FText ColumnText_Name( NSLOCTEXT("DebugViewUI", "Name", "Name") );
|
|
|
|
|
const FText ColumnText_Value( NSLOCTEXT("DebugViewUI", "Value", "Value") );
|
2021-08-05 13:38:38 -04:00
|
|
|
const FText ColumnText_DebugKey( FText::GetEmpty() );
|
|
|
|
|
const FText ColumnText_Info( NSLOCTEXT("DebugViewUI", "Info", "Info") );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// SKismetDebuggingView
|
|
|
|
|
|
2021-08-05 13:38:38 -04:00
|
|
|
TWeakObjectPtr<const UObject> SKismetDebuggingView::CurrentActiveObject = nullptr;
|
|
|
|
|
|
|
|
|
|
TSharedRef<SHorizontalBox> SKismetDebuggingView::GetDebugLineTypeToggle(FDebugLineItem::EDebugLineType Type, const FText& Text)
|
|
|
|
|
{
|
|
|
|
|
return SNew(SHorizontalBox)
|
2021-08-12 12:14:12 -04:00
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
[
|
|
|
|
|
SNew(SCheckBox)
|
2022-03-10 21:20:55 -05:00
|
|
|
.IsChecked(ECheckBoxState::Checked)
|
2021-08-12 12:14:12 -04:00
|
|
|
.OnCheckStateChanged_Static(&FDebugLineItem::OnDebugLineTypeActiveChanged, Type)
|
|
|
|
|
]
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
.Padding(4.0f, 0.0f, 10.0f, 0.0f)
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
[
|
|
|
|
|
SNew( STextBlock )
|
|
|
|
|
.Text(Text)
|
|
|
|
|
];
|
2021-08-05 13:38:38 -04:00
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2021-10-12 21:21:22 -04:00
|
|
|
void SKismetDebuggingView::OnSearchTextChanged(const FText& Text)
|
2021-08-20 13:37:19 -04:00
|
|
|
{
|
2021-10-12 21:21:22 -04:00
|
|
|
DebugTreeView->ClearExpandedItems();
|
|
|
|
|
OtherTreeView->ClearExpandedItems();
|
|
|
|
|
DebugTreeView->SetSearchText(Text);
|
|
|
|
|
OtherTreeView->SetSearchText(Text);
|
2021-08-20 13:37:19 -04:00
|
|
|
}
|
|
|
|
|
|
2021-08-05 13:38:38 -04:00
|
|
|
FText SKismetDebuggingView::GetTabLabel() const
|
|
|
|
|
{
|
|
|
|
|
return BlueprintToWatchPtr.IsValid() ?
|
|
|
|
|
FText::FromString(BlueprintToWatchPtr->GetName()) :
|
|
|
|
|
NSLOCTEXT("BlueprintExecutionFlow", "TabTitle", "Data Flow");
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2021-09-21 17:25:46 -04:00
|
|
|
void SKismetDebuggingView::TryRegisterDebugToolbar()
|
|
|
|
|
{
|
|
|
|
|
static const FName ToolbarName = "Kismet.DebuggingViewToolBar";
|
|
|
|
|
if (!UToolMenus::Get()->IsMenuRegistered(ToolbarName))
|
|
|
|
|
{
|
|
|
|
|
UToolMenu* ToolBar = UToolMenus::Get()->RegisterMenu(ToolbarName, NAME_None, EMultiBoxType::SlimHorizontalToolBar);
|
|
|
|
|
FToolMenuSection& Section = ToolBar->AddSection("Debug");
|
|
|
|
|
FPlayWorldCommands::BuildToolbar(Section);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-05 13:38:38 -04:00
|
|
|
FText SKismetDebuggingView::GetTopText() const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-08-05 13:38:38 -04:00
|
|
|
return LOCTEXT("ShowDebugForActors", "Showing debug info for instances of the blueprint:");
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2021-11-18 14:37:34 -05:00
|
|
|
FText SKismetDebuggingView::GetToggleAllBreakpointsText() const
|
|
|
|
|
{
|
|
|
|
|
const FBlueprintBreakpoint* EnabledBreakpoint = FKismetDebugUtilities::FindBreakpointByPredicate(BlueprintToWatchPtr.Get(), [](const FBlueprintBreakpoint& Breakpoint)
|
|
|
|
|
{
|
|
|
|
|
return Breakpoint.IsEnabled();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (EnabledBreakpoint)
|
|
|
|
|
{
|
|
|
|
|
return LOCTEXT("DisableAllBreakPoints", "Disable All Breakpoints");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return LOCTEXT("EnableAllBreakPoints", "Enable All Breakpoints");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SKismetDebuggingView::CanToggleAllBreakpoints() const
|
2020-09-11 12:55:08 -04:00
|
|
|
{
|
2021-08-05 13:38:38 -04:00
|
|
|
if(BlueprintToWatchPtr.IsValid())
|
|
|
|
|
{
|
|
|
|
|
return FKismetDebugUtilities::BlueprintHasBreakpoints(BlueprintToWatchPtr.Get());
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2020-09-11 12:55:08 -04:00
|
|
|
}
|
|
|
|
|
|
2021-11-18 14:37:34 -05:00
|
|
|
FReply SKismetDebuggingView::OnToggleAllBreakpointsClicked()
|
2020-09-11 12:55:08 -04:00
|
|
|
{
|
2021-11-18 14:37:34 -05:00
|
|
|
if (UBlueprint* Blueprint = BlueprintToWatchPtr.Get())
|
2020-09-11 12:55:08 -04:00
|
|
|
{
|
2021-11-18 14:37:34 -05:00
|
|
|
const FBlueprintBreakpoint* EnabledBreakpoint = FKismetDebugUtilities::FindBreakpointByPredicate(BlueprintToWatchPtr.Get(), [](const FBlueprintBreakpoint& Breakpoint)
|
2021-10-25 20:05:28 -04:00
|
|
|
{
|
2021-11-18 14:37:34 -05:00
|
|
|
return Breakpoint.IsEnabled();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
bool bHasAnyEnabledBreakpoint = EnabledBreakpoint != nullptr;
|
|
|
|
|
if (BlueprintToWatchPtr.IsValid())
|
|
|
|
|
{
|
|
|
|
|
FKismetDebugUtilities::ForeachBreakpoint(BlueprintToWatchPtr.Get(),
|
|
|
|
|
[bHasAnyEnabledBreakpoint](FBlueprintBreakpoint& Breakpoint)
|
|
|
|
|
{
|
|
|
|
|
FKismetDebugUtilities::SetBreakpointEnabled(Breakpoint, !bHasAnyEnabledBreakpoint);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FReply::Handled();
|
2020-09-11 12:55:08 -04:00
|
|
|
}
|
2021-11-18 14:37:34 -05:00
|
|
|
|
|
|
|
|
return FReply::Unhandled();
|
2020-09-11 12:55:08 -04:00
|
|
|
}
|
|
|
|
|
|
2021-08-05 13:38:38 -04:00
|
|
|
class FBlueprintFilter : public IClassViewerFilter
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FBlueprintFilter() = default;
|
|
|
|
|
|
|
|
|
|
virtual bool IsClassAllowed(const FClassViewerInitializationOptions& InInitOptions, const UClass* InClass, TSharedRef< FClassViewerFilterFuncs > InFilterFuncs ) override
|
|
|
|
|
{
|
|
|
|
|
return InClass && !InClass->HasAnyClassFlags(CLASS_Deprecated) &&
|
|
|
|
|
InClass->HasAllClassFlags(CLASS_CompiledFromBlueprint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual bool IsUnloadedClassAllowed(const FClassViewerInitializationOptions& InInitOptions, const TSharedRef< const IUnloadedBlueprintData > InUnloadedClassData, TSharedRef< FClassViewerFilterFuncs > InFilterFuncs) override
|
|
|
|
|
{
|
|
|
|
|
return !InUnloadedClassData->HasAnyClassFlags(CLASS_Deprecated) &&
|
|
|
|
|
InUnloadedClassData->HasAllClassFlags(CLASS_CompiledFromBlueprint);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void SKismetDebuggingView::OnBlueprintClassPicked(UClass* PickedClass)
|
|
|
|
|
{
|
2021-11-07 23:43:01 -05:00
|
|
|
if (PickedClass)
|
|
|
|
|
{
|
|
|
|
|
BlueprintToWatchPtr = Cast<UBlueprint>(PickedClass->ClassGeneratedBy);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// User selected None Option
|
|
|
|
|
BlueprintToWatchPtr.Reset();
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-12 21:21:22 -04:00
|
|
|
FDebugLineItem::SetBreakpointParentItemBlueprint(BreakpointParentItem, BlueprintToWatchPtr);
|
2021-08-05 13:38:38 -04:00
|
|
|
DebugClassComboButton->SetIsOpen(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedRef<SWidget> SKismetDebuggingView::ConstructBlueprintClassPicker()
|
|
|
|
|
{
|
|
|
|
|
FClassViewerInitializationOptions Options;
|
|
|
|
|
Options.Mode = EClassViewerMode::ClassPicker;
|
|
|
|
|
Options.bShowBackgroundBorder = false;
|
|
|
|
|
Options.ClassFilters.Add(MakeShared<FBlueprintFilter>());
|
|
|
|
|
Options.bIsBlueprintBaseOnly = true;
|
|
|
|
|
Options.bShowUnloadedBlueprints = false;
|
2021-11-07 23:43:01 -05:00
|
|
|
Options.bShowNoneOption = true;
|
2021-08-05 13:38:38 -04:00
|
|
|
|
2021-08-20 13:37:19 -04:00
|
|
|
FClassViewerModule& ClassViewerModule = FModuleManager::LoadModuleChecked<FClassViewerModule>("ClassViewer");
|
2021-08-05 13:38:38 -04:00
|
|
|
|
|
|
|
|
FOnClassPicked OnClassPicked;
|
|
|
|
|
OnClassPicked.BindRaw(this, &SKismetDebuggingView::OnBlueprintClassPicked);
|
2021-08-12 12:14:12 -04:00
|
|
|
return SNew(SBox)
|
2021-08-05 13:38:38 -04:00
|
|
|
.HeightOverride(500.f)
|
|
|
|
|
[
|
|
|
|
|
ClassViewerModule.CreateClassViewer(Options, OnClassPicked)
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
void SKismetDebuggingView::Construct(const FArguments& InArgs)
|
|
|
|
|
{
|
|
|
|
|
BlueprintToWatchPtr = InArgs._BlueprintToWatch;
|
|
|
|
|
|
|
|
|
|
// Build the debug toolbar
|
2019-11-04 12:21:36 -05:00
|
|
|
static const FName ToolbarName = "Kismet.DebuggingViewToolBar";
|
2021-09-21 17:25:46 -04:00
|
|
|
TryRegisterDebugToolbar();
|
2019-11-04 12:21:36 -05:00
|
|
|
FToolMenuContext MenuContext(FPlayWorldCommands::GlobalPlayWorldActions);
|
|
|
|
|
TSharedRef<SWidget> ToolbarWidget = UToolMenus::Get()->GenerateWidget(ToolbarName, MenuContext);
|
2021-08-05 13:38:38 -04:00
|
|
|
|
|
|
|
|
DebugClassComboButton =
|
|
|
|
|
SNew(SComboButton)
|
2021-08-12 12:14:12 -04:00
|
|
|
.OnGetMenuContent_Raw(this, &SKismetDebuggingView::ConstructBlueprintClassPicker)
|
|
|
|
|
.ButtonContent()
|
|
|
|
|
[
|
|
|
|
|
SNew(STextBlock)
|
|
|
|
|
.Text_Lambda([&BlueprintToWatchPtr = BlueprintToWatchPtr]()
|
|
|
|
|
{
|
|
|
|
|
return BlueprintToWatchPtr.IsValid()?
|
|
|
|
|
FText::FromString(BlueprintToWatchPtr->GetName()) :
|
|
|
|
|
LOCTEXT("SelectBlueprint", "Select Blueprint");
|
|
|
|
|
})
|
|
|
|
|
];
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2021-08-05 13:38:38 -04:00
|
|
|
FBlueprintContextTracker::OnEnterScriptContext.AddLambda(
|
|
|
|
|
[](const FBlueprintContextTracker& ContextTracker, const UObject* ContextObject, const UFunction* ContextFunction)
|
|
|
|
|
{
|
|
|
|
|
CurrentActiveObject = ContextObject;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
FBlueprintContextTracker::OnExitScriptContext.AddLambda(
|
|
|
|
|
[](const FBlueprintContextTracker& ContextTracker)
|
|
|
|
|
{
|
|
|
|
|
CurrentActiveObject = nullptr;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
this->ChildSlot
|
|
|
|
|
[
|
|
|
|
|
SNew(SVerticalBox)
|
2021-08-12 12:14:12 -04:00
|
|
|
+ SVerticalBox::Slot()
|
|
|
|
|
.AutoHeight()
|
2014-03-14 14:13:41 -04:00
|
|
|
[
|
2021-08-12 12:14:12 -04:00
|
|
|
SNew(SBorder)
|
2022-05-09 13:12:28 -04:00
|
|
|
.BorderImage( FAppStyle::GetBrush( TEXT("NoBorder") ) )
|
2021-08-12 12:14:12 -04:00
|
|
|
[
|
|
|
|
|
ToolbarWidget
|
|
|
|
|
]
|
2014-03-14 14:13:41 -04:00
|
|
|
]
|
2021-08-05 13:38:38 -04:00
|
|
|
+SVerticalBox::Slot()
|
|
|
|
|
.AutoHeight()
|
2020-09-11 12:55:08 -04:00
|
|
|
[
|
2021-08-12 12:14:12 -04:00
|
|
|
|
|
|
|
|
SNew( SVerticalBox )
|
|
|
|
|
+SVerticalBox::Slot()
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
[
|
|
|
|
|
SNew( STextBlock )
|
|
|
|
|
.Text( this, &SKismetDebuggingView::GetTopText )
|
|
|
|
|
]
|
|
|
|
|
+ SVerticalBox::Slot()
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
[
|
|
|
|
|
SNew( SHorizontalBox )
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.HAlign( HAlign_Left )
|
|
|
|
|
[
|
|
|
|
|
SNew(SBox)
|
|
|
|
|
.WidthOverride(400.f)
|
|
|
|
|
[
|
|
|
|
|
DebugClassComboButton.ToSharedRef()
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.HAlign( HAlign_Right )
|
|
|
|
|
[
|
|
|
|
|
SNew( SButton )
|
2021-11-18 14:37:34 -05:00
|
|
|
.IsEnabled( this, &SKismetDebuggingView::CanToggleAllBreakpoints )
|
|
|
|
|
.Text( this, &SKismetDebuggingView::GetToggleAllBreakpointsText )
|
|
|
|
|
.OnClicked( this, &SKismetDebuggingView::OnToggleAllBreakpointsClicked )
|
2021-08-12 12:14:12 -04:00
|
|
|
]
|
|
|
|
|
]
|
2021-08-20 13:37:19 -04:00
|
|
|
+ SVerticalBox::Slot()
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
[
|
|
|
|
|
SAssignNew(SearchBox, SSearchBox)
|
2021-10-12 21:21:22 -04:00
|
|
|
.OnTextChanged(this, &SKismetDebuggingView::OnSearchTextChanged)
|
2021-08-20 13:37:19 -04:00
|
|
|
]
|
2021-08-12 12:14:12 -04:00
|
|
|
]
|
|
|
|
|
+SVerticalBox::Slot()
|
|
|
|
|
[
|
|
|
|
|
SNew(SSplitter)
|
|
|
|
|
.Orientation(Orient_Vertical)
|
|
|
|
|
+SSplitter::Slot()
|
|
|
|
|
[
|
2021-10-12 21:21:22 -04:00
|
|
|
SAssignNew( DebugTreeView, SKismetDebugTreeView )
|
2021-11-07 23:43:01 -05:00
|
|
|
.InDebuggerTab(true)
|
2021-08-12 12:14:12 -04:00
|
|
|
.HeaderRow
|
|
|
|
|
(
|
|
|
|
|
SNew(SHeaderRow)
|
2021-10-12 21:21:22 -04:00
|
|
|
+ SHeaderRow::Column(SKismetDebugTreeView::ColumnId_Name)
|
2021-08-12 12:14:12 -04:00
|
|
|
.DefaultLabel(KismetDebugViewConstants::ColumnText_Name)
|
2021-10-12 21:21:22 -04:00
|
|
|
+ SHeaderRow::Column(SKismetDebugTreeView::ColumnId_Value)
|
2021-08-12 12:14:12 -04:00
|
|
|
.DefaultLabel(KismetDebugViewConstants::ColumnText_Value)
|
|
|
|
|
)
|
|
|
|
|
]
|
|
|
|
|
+SSplitter::Slot()
|
|
|
|
|
[
|
2021-10-12 21:21:22 -04:00
|
|
|
SAssignNew( OtherTreeView, SKismetDebugTreeView )
|
2021-11-07 23:43:01 -05:00
|
|
|
.InDebuggerTab(true)
|
2021-08-12 12:14:12 -04:00
|
|
|
.HeaderRow
|
|
|
|
|
(
|
|
|
|
|
SNew(SHeaderRow)
|
2021-10-12 21:21:22 -04:00
|
|
|
+ SHeaderRow::Column(SKismetDebugTreeView::ColumnId_Name)
|
2021-08-12 12:14:12 -04:00
|
|
|
.DefaultLabel(KismetDebugViewConstants::ColumnText_DebugKey)
|
2021-10-12 21:21:22 -04:00
|
|
|
+ SHeaderRow::Column(SKismetDebugTreeView::ColumnId_Value)
|
2021-08-12 12:14:12 -04:00
|
|
|
.DefaultLabel(KismetDebugViewConstants::ColumnText_Info)
|
|
|
|
|
)
|
|
|
|
|
]
|
2020-09-11 12:55:08 -04:00
|
|
|
]
|
2021-08-05 13:38:38 -04:00
|
|
|
+ SVerticalBox::Slot()
|
|
|
|
|
.AutoHeight()
|
2020-09-11 12:55:08 -04:00
|
|
|
[
|
2021-08-12 12:14:12 -04:00
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
2021-08-05 13:38:38 -04:00
|
|
|
[
|
2021-08-12 12:14:12 -04:00
|
|
|
GetDebugLineTypeToggle(FDebugLineItem::DLT_Watch, LOCTEXT("Watchpoints", "Watchpoints"))
|
|
|
|
|
]
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
[
|
|
|
|
|
GetDebugLineTypeToggle(FDebugLineItem::DLT_LatentAction, LOCTEXT("LatentActions", "Latent Actions"))
|
|
|
|
|
]
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
[
|
|
|
|
|
GetDebugLineTypeToggle(FDebugLineItem::DLT_BreakpointParent, LOCTEXT("Breakpoints", "Breakpoints"))
|
|
|
|
|
]
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
[
|
|
|
|
|
GetDebugLineTypeToggle(FDebugLineItem::DLT_TraceStackParent, LOCTEXT("ExecutionTrace", "Execution Trace"))
|
2021-08-05 13:38:38 -04:00
|
|
|
]
|
2020-09-11 12:55:08 -04:00
|
|
|
]
|
2014-03-14 14:13:41 -04:00
|
|
|
];
|
|
|
|
|
|
2021-10-12 21:21:22 -04:00
|
|
|
TraceStackItem = SKismetDebugTreeView::MakeTraceStackParentItem();
|
|
|
|
|
BreakpointParentItem = SKismetDebugTreeView::MakeBreakpointParentItem(BlueprintToWatchPtr);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2021-11-07 23:43:01 -05:00
|
|
|
void SKismetDebuggingView::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-08-26 14:26:47 -04:00
|
|
|
// don't update during scroll. this will help make the scroll smoother
|
2021-11-07 23:43:01 -05:00
|
|
|
if (DebugTreeView->IsScrolling() || OtherTreeView->IsScrolling())
|
2021-08-26 14:26:47 -04:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-11-07 23:43:01 -05:00
|
|
|
|
2021-08-26 14:26:47 -04:00
|
|
|
// update less often to avoid lag
|
|
|
|
|
TreeUpdateTimer += InDeltaTime;
|
2021-11-07 23:43:01 -05:00
|
|
|
if (TreeUpdateTimer < UpdateInterval)
|
2021-08-26 14:26:47 -04:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
TreeUpdateTimer = 0.f;
|
2021-11-07 23:43:01 -05:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
// Gather the old root set
|
|
|
|
|
TSet<UObject*> OldRootSet;
|
2021-10-12 21:21:22 -04:00
|
|
|
for (const FDebugTreeItemPtr& Item : DebugTreeView->GetRootTreeItems())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-10-12 21:21:22 -04:00
|
|
|
if (UObject* OldObject = Item->GetParentObject())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
OldRootSet.Add(OldObject);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Gather what we'd like to be the new root set
|
2016-01-22 00:23:21 -05:00
|
|
|
const bool bIsDebugging = GEditor->PlayWorld != nullptr;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
TSet<UObject*> NewRootSet;
|
2021-11-07 23:43:01 -05:00
|
|
|
|
|
|
|
|
const auto TryAddBlueprintToNewRootSet = [&NewRootSet](UBlueprint* InBlueprint)
|
2016-01-22 00:23:21 -05:00
|
|
|
{
|
2021-11-07 23:43:01 -05:00
|
|
|
for (FThreadSafeObjectIterator Iter(InBlueprint->GeneratedClass, /*bOnlyGCedObjects =*/ false, /*AdditionalExclusionFlags =*/ RF_ArchetypeObject | RF_ClassDefaultObject); Iter; ++Iter)
|
|
|
|
|
{
|
|
|
|
|
UObject* Instance = *Iter;
|
|
|
|
|
if (!Instance)
|
2021-08-05 13:38:38 -04:00
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-18 15:25:25 -05:00
|
|
|
// only include instances of objects in a PIE world
|
|
|
|
|
if (UWorld* World = Instance->GetTypedOuter<UWorld>())
|
2021-11-07 23:43:01 -05:00
|
|
|
{
|
2021-11-18 15:25:25 -05:00
|
|
|
if (!World || World->WorldType != EWorldType::PIE)
|
2021-11-07 23:43:01 -05:00
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NewRootSet.Add(Instance);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if(bIsDebugging)
|
|
|
|
|
{
|
|
|
|
|
if (BlueprintToWatchPtr.IsValid())
|
|
|
|
|
{
|
|
|
|
|
// Show blueprint objects of the selected class
|
|
|
|
|
TryAddBlueprintToNewRootSet(BlueprintToWatchPtr.Get());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Show all blueprint objects with watches
|
|
|
|
|
for (FThreadSafeObjectIterator BlueprintIter(UBlueprint::StaticClass(), /*bOnlyGCedObjects =*/ false, /*AdditionalExclusionFlags =*/ RF_ArchetypeObject | RF_ClassDefaultObject); BlueprintIter; ++BlueprintIter)
|
|
|
|
|
{
|
|
|
|
|
UBlueprint* Blueprint = Cast<UBlueprint>(*BlueprintIter);
|
|
|
|
|
if (Blueprint && FKismetDebugUtilities::BlueprintHasPinWatches(Blueprint))
|
|
|
|
|
{
|
|
|
|
|
TryAddBlueprintToNewRootSet(Blueprint);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This will pull anything out of Old that is also New (sticking around), so afterwards Old is a list of things to remove
|
2021-10-12 21:21:22 -04:00
|
|
|
DebugTreeView->ClearTreeItems();
|
|
|
|
|
for (UObject* ObjectToAdd : NewRootSet)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-10-12 21:21:22 -04:00
|
|
|
TWeakObjectPtr<UObject> WeakObject = ObjectToAdd;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2021-08-05 13:38:38 -04:00
|
|
|
// destroyed objects can still appear if they haven't ben GCed yet.
|
|
|
|
|
// weak object pointers will detect it and return nullptr
|
2021-10-12 21:21:22 -04:00
|
|
|
if(!WeakObject.Get())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-08-05 13:38:38 -04:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
if (OldRootSet.Contains(ObjectToAdd))
|
2021-08-05 13:38:38 -04:00
|
|
|
{
|
2014-03-14 14:13:41 -04:00
|
|
|
OldRootSet.Remove(ObjectToAdd);
|
2021-08-20 13:37:19 -04:00
|
|
|
|
2021-10-12 21:21:22 -04:00
|
|
|
const TSharedPtr<FDebugLineItem>& Item = ObjectToTreeItemMap.FindChecked(ObjectToAdd);
|
|
|
|
|
DebugTreeView->AddTreeItemUnique(Item);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-10-12 21:21:22 -04:00
|
|
|
FDebugTreeItemPtr NewPtr = SKismetDebugTreeView::MakeParentItem(ObjectToAdd);
|
2014-03-14 14:13:41 -04:00
|
|
|
ObjectToTreeItemMap.Add(ObjectToAdd, NewPtr);
|
2021-10-12 21:21:22 -04:00
|
|
|
DebugTreeView->AddTreeItemUnique(NewPtr);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove the old root set items that didn't get used again
|
2021-10-12 21:21:22 -04:00
|
|
|
for (UObject* ObjectToRemove : OldRootSet)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
ObjectToTreeItemMap.Remove(ObjectToRemove);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-05 13:38:38 -04:00
|
|
|
// Add a message if there are no active instances of DebugClass
|
2021-10-12 21:21:22 -04:00
|
|
|
if (DebugTreeView->GetRootTreeItems().Num() == 0)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-10-12 21:21:22 -04:00
|
|
|
DebugTreeView->AddTreeItemUnique(SKismetDebugTreeView::MakeMessageItem(
|
2021-08-20 13:37:19 -04:00
|
|
|
bIsDebugging ?
|
|
|
|
|
LOCTEXT("NoInstances", "No instances of this blueprint in existence").ToString() :
|
2021-10-12 21:21:22 -04:00
|
|
|
LOCTEXT("NoPIEorSIE", "run PIE or SIE to see instance debug info").ToString()
|
|
|
|
|
));
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2021-10-12 21:21:22 -04:00
|
|
|
|
2021-08-05 13:38:38 -04:00
|
|
|
// Show Breakpoints
|
|
|
|
|
if(FDebugLineItem::IsDebugLineTypeActive(FDebugLineItem::DLT_BreakpointParent))
|
|
|
|
|
{
|
2021-10-12 21:21:22 -04:00
|
|
|
OtherTreeView->AddTreeItemUnique(BreakpointParentItem);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
OtherTreeView->RemoveTreeItem(BreakpointParentItem);
|
2021-08-05 13:38:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Show the trace stack when debugging
|
|
|
|
|
if (bIsDebugging && FDebugLineItem::IsDebugLineTypeActive(FDebugLineItem::DLT_TraceStackParent))
|
|
|
|
|
{
|
2021-10-12 21:21:22 -04:00
|
|
|
OtherTreeView->AddTreeItemUnique(TraceStackItem);
|
2021-08-05 13:38:38 -04:00
|
|
|
}
|
2021-10-12 21:21:22 -04:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
OtherTreeView->RemoveTreeItem(TraceStackItem);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2021-10-12 21:21:22 -04:00
|
|
|
OtherTreeView->RequestUpdateFilteredItems();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2021-10-25 20:05:28 -04:00
|
|
|
void SKismetDebuggingView::SetBlueprintToWatch(TWeakObjectPtr<UBlueprint> InBlueprintToWatch)
|
|
|
|
|
{
|
|
|
|
|
BlueprintToWatchPtr = InBlueprintToWatch;
|
|
|
|
|
FDebugLineItem::SetBreakpointParentItemBlueprint(BreakpointParentItem, BlueprintToWatchPtr);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
#undef LOCTEXT_NAMESPACE
|