You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 2821607 on 2016/01/08 by Mieszko.Zielinski Added a way to limit amount of information logged by vlog by discarding logs from classes from outside of class whitelist #UE4 This feature was followed by refactoring of functions taking FVisualLogEntry pointers to use references instead. Change 2828384 on 2016/01/14 by Mieszko.Zielinski Back out of visual log refactor done as part of CL#2821607 #UE4 Change 2965743 on 2016/05/04 by Tom.Looman Added check to PostActorConstruction to avoid BeginPlay call on pendingkill actor. UE-27528 #rb MarcA Change 2965744 on 2016/05/04 by Marc.Audy VS2015 Shadow Variable fixes Change 2965813 on 2016/05/04 by Tom.Looman Moved UninitializeComponents outside (bActorInitialized) to always uninit components when actors gets destroyed early. UE-27529 #rb MarcA Change 2966564 on 2016/05/04 by Marc.Audy VS2015 shadow variable fixes Change 2967244 on 2016/05/05 by Jon.Nabozny Remove UPROPERTY from members that don't require serialization and aren't user editable. #JIRA UE-30155 Change 2967377 on 2016/05/05 by Lukasz.Furman fixed processing of AIMessages when new message appears during notify loop #ue4 Change 2967437 on 2016/05/05 by Marc.Audy Add a static One to TBigInt Remove numerous local statics and TEncryptionInt specific version in KeyGenerator.cpp Part of fixing shadow variables for VS2015 Change 2967465 on 2016/05/05 by Marc.Audy Fix VS2015 shadow variables fixes Change 2967552 on 2016/05/05 by Marc.Audy Fix compile error in DocumentationCode Change 2967556 on 2016/05/05 by Marc.Audy Enable shadow variable warnings in 2015 Change 2967836 on 2016/05/05 by Marc.Audy Another DocumentationCode project fix Change 2967941 on 2016/05/05 by Marc.Audy Make bShowHUD not config Expose HUD properties to blueprints Cleanup stale entries in BaseGame.ini Deprecate unnecessary colors in AHUD in favor of using FColor statics #jira UE-30045 Change 2969008 on 2016/05/06 by Marc.Audy VS2015 Shadow Variable fixes found by CIS Change 2969315 on 2016/05/06 by John.Abercrombie Duplicating CL 2969279 from //Fortnite/Main/ Behavior tree auxilary nodes, parallel tasks, active tasks, and aborting tasks shouldn't be ticked while the behavior tree is paused -------- Integrated using branch //Fortnite/Main/_to_//UE4/Dev-Framework of change#2969279 by John.Abercrombie on 2016/05/06 14:21:40. Change 2969611 on 2016/05/06 by Marc.Audy Default bShowHUD to true Change 2971041 on 2016/05/09 by Marc.Audy Add Get/Set Actor/Component TickInterval functions and expose to blueprints Change 2971072 on 2016/05/09 by Marc.Audy Fix VS2015 shadow variables warnings Change 2971629 on 2016/05/09 by Marc.Audy PR#1981 (contributed by EverNewJoy) CheatManager is blueprintable (though very basic exposure at this time) and can be set from PlayerController DebugCameraController is now visible and can be subclassed and specified via CheatManager blueprint #jira UE-25901 Change 2971632 on 2016/05/09 by Marc.Audy Missed file from CL# 2971629 [CL 2972828 by Marc Audy in Main branch]
328 lines
8.6 KiB
C++
328 lines
8.6 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "LogVisualizer.h"
|
|
#include "Misc/CoreMisc.h"
|
|
#include "LogVisualizerSettings.h"
|
|
#if WITH_EDITOR
|
|
#include "Editor/EditorEngine.h"
|
|
#include "ISettingsModule.h"
|
|
#include "UnrealEdMisc.h"
|
|
#endif // WITH_EDITOR
|
|
|
|
ULogVisualizerSettings::ULogVisualizerSettings(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
, DebugMeshMaterialFakeLightName(TEXT("/Engine/EngineDebugMaterials/DebugMeshMaterialFakeLight.DebugMeshMaterialFakeLight"))
|
|
{
|
|
TrivialLogsThreshold = 1;
|
|
DefaultCameraDistance = 150;
|
|
bSearchInsideLogs = true;
|
|
GraphsBackgroundColor = FColor(0, 0, 0, 70);
|
|
bResetDataWithNewSession = false;
|
|
bDrawExtremesOnGraphs = false;
|
|
bUsePlayersOnlyForPause = true;
|
|
}
|
|
|
|
class UMaterial* ULogVisualizerSettings::GetDebugMeshMaterial()
|
|
{
|
|
if (DebugMeshMaterialFakeLight == nullptr)
|
|
{
|
|
DebugMeshMaterialFakeLight = LoadObject<UMaterial>(NULL, *DebugMeshMaterialFakeLightName, NULL, LOAD_None, NULL);
|
|
}
|
|
|
|
return DebugMeshMaterialFakeLight;
|
|
}
|
|
|
|
void ULogVisualizerSettings::SavePresistentData()
|
|
{
|
|
if (bPresistentFilters)
|
|
{
|
|
PresistentFilters = FVisualLoggerFilters::Get();
|
|
for (int32 Index = PresistentFilters.Categories.Num() - 1; Index >= 0; --Index)
|
|
{
|
|
FCategoryFilter& Category = PresistentFilters.Categories[Index];
|
|
if (Category.bIsInUse == false)
|
|
{
|
|
PresistentFilters.Categories.RemoveAt(Index);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
PresistentFilters = FVisualLoggerFilters();
|
|
}
|
|
SaveConfig();
|
|
}
|
|
|
|
void ULogVisualizerSettings::ClearPresistentData()
|
|
{
|
|
if (bPresistentFilters)
|
|
{
|
|
PresistentFilters = FVisualLoggerFilters();
|
|
}
|
|
}
|
|
|
|
void ULogVisualizerSettings::LoadPresistentData()
|
|
{
|
|
if (bPresistentFilters)
|
|
{
|
|
for (int32 Index = PresistentFilters.Categories.Num() - 1; Index >= 0; --Index)
|
|
{
|
|
FCategoryFilter& Category = PresistentFilters.Categories[Index];
|
|
Category.bIsInUse = false;
|
|
}
|
|
FVisualLoggerFilters::Get().InitWith(PresistentFilters);
|
|
}
|
|
else
|
|
{
|
|
FVisualLoggerFilters::Get().Reset();
|
|
}
|
|
}
|
|
|
|
#if WITH_EDITOR
|
|
void ULogVisualizerSettings::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
|
|
{
|
|
Super::PostEditChangeProperty(PropertyChangedEvent);
|
|
|
|
const FName Name = (PropertyChangedEvent.Property != nullptr) ? PropertyChangedEvent.Property->GetFName() : NAME_None;
|
|
if (!FUnrealEdMisc::Get().IsDeletePreferences())
|
|
{
|
|
SaveConfig();
|
|
}
|
|
|
|
SettingChangedEvent.Broadcast(Name);
|
|
}
|
|
#endif
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// FVisualLoggerFilters
|
|
//////////////////////////////////////////////////////////////////////////
|
|
TSharedPtr< struct FVisualLoggerFilters > FVisualLoggerFilters::StaticInstance;
|
|
|
|
FVisualLoggerFilters& FVisualLoggerFilters::Get()
|
|
{
|
|
return *StaticInstance;
|
|
}
|
|
|
|
void FVisualLoggerFilters::Initialize()
|
|
{
|
|
StaticInstance = MakeShareable(new FVisualLoggerFilters);
|
|
FVisualLoggerDatabase::Get().GetEvents().OnNewItem.AddRaw(StaticInstance.Get(), &FVisualLoggerFilters::OnNewItemHandler);
|
|
}
|
|
|
|
void FVisualLoggerFilters::Shutdown()
|
|
{
|
|
FVisualLoggerDatabase::Get().GetEvents().OnNewItem.RemoveAll(StaticInstance.Get());
|
|
StaticInstance.Reset();
|
|
}
|
|
|
|
void FVisualLoggerFilters::OnNewItemHandler(const FVisualLoggerDBRow& DBRow, int32 ItemIndex)
|
|
{
|
|
const FVisualLogDevice::FVisualLogEntryItem& Item = DBRow.GetItems()[ItemIndex];
|
|
TArray<FVisualLoggerCategoryVerbosityPair> VisualLoggerCategories;
|
|
FVisualLoggerHelpers::GetCategories(Item.Entry, VisualLoggerCategories);
|
|
for (auto& CategoryAndVerbosity : VisualLoggerCategories)
|
|
{
|
|
AddCategory(CategoryAndVerbosity.CategoryName.ToString(), ELogVerbosity::All);
|
|
}
|
|
|
|
TMap<FString, TArray<FString> > OutCategories;
|
|
FVisualLoggerHelpers::GetHistogramCategories(Item.Entry, OutCategories);
|
|
for (const auto& CurrentCategory : OutCategories)
|
|
{
|
|
for (const auto& CurrentDataName : CurrentCategory.Value)
|
|
{
|
|
const FString GraphFilterName = CurrentCategory.Key + TEXT("$") + CurrentDataName;
|
|
AddCategory(GraphFilterName, ELogVerbosity::All);
|
|
}
|
|
}
|
|
}
|
|
|
|
void FVisualLoggerFilters::AddCategory(FString InName, ELogVerbosity::Type InVerbosity)
|
|
{
|
|
const int32 Num = Categories.Num();
|
|
for (int32 Index = 0; Index < Num; ++Index)
|
|
{
|
|
FCategoryFilter& Filter = Categories[Index];
|
|
if (Filter.CategoryName == InName)
|
|
{
|
|
Filter.bIsInUse = true;
|
|
return;
|
|
}
|
|
}
|
|
|
|
FCategoryFilter Filter;
|
|
Filter.CategoryName = InName;
|
|
Filter.LogVerbosity = InVerbosity;
|
|
Filter.Enabled = true;
|
|
Filter.bIsInUse = true;
|
|
Categories.Add(Filter);
|
|
|
|
FastCategoryFilterMap.Reset(); // we need to recreate cache - pointers can be broken
|
|
FastCategoryFilterMap.Reserve(Categories.Num());
|
|
for (int32 Index = 0; Index < Categories.Num(); Index++)
|
|
{
|
|
FastCategoryFilterMap.Add(*Categories[Index].CategoryName, &Categories[Index]);
|
|
}
|
|
|
|
OnFilterCategoryAdded.Broadcast(InName, InVerbosity);
|
|
}
|
|
|
|
void FVisualLoggerFilters::RemoveCategory(FString InName)
|
|
{
|
|
for (int32 Index = 0; Index < Categories.Num(); ++Index)
|
|
{
|
|
const FCategoryFilter& Filter = Categories[Index];
|
|
if (Filter.CategoryName == InName)
|
|
{
|
|
Categories.RemoveAt(Index);
|
|
FastCategoryFilterMap.Remove(*InName);
|
|
break;
|
|
}
|
|
}
|
|
|
|
OnFilterCategoryRemoved.Broadcast(InName);
|
|
}
|
|
|
|
FCategoryFilter& FVisualLoggerFilters::GetCategoryByName(const FName& InName)
|
|
{
|
|
FCategoryFilter* FilterPtr = FastCategoryFilterMap.Contains(InName) ? FastCategoryFilterMap[InName] : nullptr;
|
|
if (FilterPtr)
|
|
{
|
|
return *FilterPtr;
|
|
}
|
|
|
|
static FCategoryFilter NoCategory;
|
|
return NoCategory;
|
|
}
|
|
|
|
FCategoryFilter& FVisualLoggerFilters::GetCategoryByName(const FString& InName)
|
|
{
|
|
const FName NameAsName = *InName;
|
|
FCategoryFilter* FilterPtr = FastCategoryFilterMap.Contains(NameAsName) ? FastCategoryFilterMap[NameAsName] : nullptr;
|
|
if (FilterPtr)
|
|
{
|
|
return *FilterPtr;
|
|
}
|
|
|
|
static FCategoryFilter NoCategory;
|
|
return NoCategory;
|
|
}
|
|
|
|
bool FVisualLoggerFilters::MatchObjectName(FString String)
|
|
{
|
|
return SelectedClasses.Num() == 0 || SelectedClasses.Find(String) != INDEX_NONE;
|
|
}
|
|
|
|
|
|
void FVisualLoggerFilters::SelectObject(FString ObjectName)
|
|
{
|
|
SelectedClasses.AddUnique(ObjectName);
|
|
}
|
|
|
|
void FVisualLoggerFilters::RemoveObjectFromSelection(FString ObjectName)
|
|
{
|
|
SelectedClasses.Remove(ObjectName);
|
|
}
|
|
|
|
const TArray<FString>& FVisualLoggerFilters::GetSelectedObjects() const
|
|
{
|
|
return SelectedClasses;
|
|
}
|
|
|
|
bool FVisualLoggerFilters::MatchCategoryFilters(FString String, ELogVerbosity::Type Verbosity)
|
|
{
|
|
ULogVisualizerSettings* Settings = ULogVisualizerSettings::StaticClass()->GetDefaultObject<ULogVisualizerSettings>();
|
|
bool bFoundFilter = false;
|
|
for (const FCategoryFilter& Filter : Categories)
|
|
{
|
|
bFoundFilter = Filter.CategoryName == String;
|
|
if (bFoundFilter)
|
|
{
|
|
if (Filter.Enabled)
|
|
{
|
|
const bool bFineWithSearchString = Settings->bSearchInsideLogs == true || (SearchBoxFilter.Len() == 0 || Filter.CategoryName.Find(SearchBoxFilter) != INDEX_NONE);
|
|
return bFineWithSearchString && Verbosity <= Filter.LogVerbosity;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
return bFoundFilter;
|
|
}
|
|
|
|
void FVisualLoggerFilters::DeactivateAllButThis(const FString& InName)
|
|
{
|
|
for (FCategoryFilter& Filter : Categories)
|
|
{
|
|
Filter.Enabled = Filter.CategoryName != InName ? false : true;
|
|
}
|
|
}
|
|
|
|
void FVisualLoggerFilters::EnableAllCategories()
|
|
{
|
|
for (FCategoryFilter& Filter : Categories)
|
|
{
|
|
Filter.Enabled = true;
|
|
}
|
|
}
|
|
|
|
|
|
void FVisualLoggerFilters::Reset()
|
|
{
|
|
if (ULogVisualizerSettings::StaticClass()->GetDefaultObject<ULogVisualizerSettings>()->bResetDataWithNewSession == false)
|
|
{
|
|
for (int32 Index = Categories.Num() - 1; Index >= 0; --Index)
|
|
{
|
|
Categories[Index].bIsInUse = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
FastCategoryFilterMap.Reset();
|
|
Categories.Reset();
|
|
}
|
|
|
|
SearchBoxFilter = FString();
|
|
ObjectNameFilter = FString();
|
|
|
|
SelectedClasses.Reset();
|
|
}
|
|
|
|
void FVisualLoggerFilters::InitWith(const FVisualLoggerFiltersData& NewFiltersData)
|
|
{
|
|
SearchBoxFilter = NewFiltersData.SearchBoxFilter;
|
|
ObjectNameFilter = NewFiltersData.ObjectNameFilter;
|
|
Categories = NewFiltersData.Categories;
|
|
SelectedClasses = NewFiltersData.SelectedClasses;
|
|
|
|
FastCategoryFilterMap.Reset(); // we need to recreate cache - pointers can be broken
|
|
FastCategoryFilterMap.Reserve(Categories.Num());
|
|
for (int32 Index = 0; Index < Categories.Num(); Index++)
|
|
{
|
|
FastCategoryFilterMap.Add(*Categories[Index].CategoryName, &Categories[Index]);
|
|
}
|
|
}
|
|
|
|
void FVisualLoggerFilters::DisableGraphData(FName GraphName, FName DataName, bool SetAsDisabled)
|
|
{
|
|
const FName FullName = *(GraphName.ToString() + TEXT("$") + DataName.ToString());
|
|
if (SetAsDisabled)
|
|
{
|
|
DisabledGraphDatas.AddUnique(FullName);
|
|
}
|
|
else
|
|
{
|
|
DisabledGraphDatas.RemoveSwap(FullName);
|
|
}
|
|
}
|
|
|
|
|
|
bool FVisualLoggerFilters::IsGraphDataDisabled(FName GraphName, FName DataName)
|
|
{
|
|
const FName FullName = *(GraphName.ToString() + TEXT("$") + DataName.ToString());
|
|
return DisabledGraphDatas.Find(FullName) != INDEX_NONE;
|
|
}
|