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 #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]
243 lines
6.0 KiB
C++
243 lines
6.0 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "EdGraphNode_Reference.h"
|
|
#include "GenericPlatform/GenericPlatformFile.h"
|
|
#include "EdGraph/EdGraphPin.h"
|
|
#include "HAL/PlatformFilemanager.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "ReferenceViewer"
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// UEdGraphNode_Reference
|
|
|
|
UEdGraphNode_Reference::UEdGraphNode_Reference(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
DependencyPin = NULL;
|
|
ReferencerPin = NULL;
|
|
bIsCollapsed = false;
|
|
bIsPackage = false;
|
|
bUsesThumbnail = false;
|
|
}
|
|
|
|
void UEdGraphNode_Reference::SetupReferenceNode(const FIntPoint& NodeLoc, const TArray<FAssetIdentifier>& NewIdentifiers, const FAssetData& InAssetData)
|
|
{
|
|
check(NewIdentifiers.Num() > 0);
|
|
|
|
NodePosX = NodeLoc.X;
|
|
NodePosY = NodeLoc.Y;
|
|
|
|
Identifiers = NewIdentifiers;
|
|
const FAssetIdentifier& First = NewIdentifiers[0];
|
|
FString ShortPackageName = FPackageName::GetLongPackageAssetName(First.PackageName.ToString());
|
|
|
|
bIsCollapsed = false;
|
|
bIsPackage = true;
|
|
if (NewIdentifiers[0].IsValue())
|
|
{
|
|
ShortPackageName = FString::Printf(TEXT("%s::%s"), *First.ObjectName.ToString(), *First.ValueName.ToString());
|
|
bIsPackage = false;
|
|
}
|
|
|
|
if (NewIdentifiers.Num() == 1 )
|
|
{
|
|
if (bIsPackage)
|
|
{
|
|
NodeComment = First.PackageName.ToString();
|
|
}
|
|
NodeTitle = FText::FromString(ShortPackageName);
|
|
}
|
|
else
|
|
{
|
|
NodeComment = FText::Format(LOCTEXT("ReferenceNodeMultiplePackagesTitle", "{0} nodes"), FText::AsNumber(NewIdentifiers.Num())).ToString();
|
|
NodeTitle = FText::Format(LOCTEXT("ReferenceNodeMultiplePackagesComment", "{0} and {1} others"), FText::FromString(ShortPackageName), FText::AsNumber(NewIdentifiers.Num() - 1));
|
|
}
|
|
|
|
CacheAssetData(InAssetData);
|
|
AllocateDefaultPins();
|
|
}
|
|
|
|
void UEdGraphNode_Reference::SetReferenceNodeCollapsed(const FIntPoint& NodeLoc, int32 InNumReferencesExceedingMax)
|
|
{
|
|
NodePosX = NodeLoc.X;
|
|
NodePosY = NodeLoc.Y;
|
|
|
|
Identifiers.Empty();
|
|
bIsCollapsed = true;
|
|
bUsesThumbnail = false;
|
|
NodeComment = FText::Format(LOCTEXT("ReferenceNodeCollapsedMessage", "{0} other nodes"), FText::AsNumber(InNumReferencesExceedingMax)).ToString();
|
|
|
|
NodeTitle = LOCTEXT("ReferenceNodeCollapsedTitle", "Collapsed nodes");
|
|
CacheAssetData(FAssetData());
|
|
AllocateDefaultPins();
|
|
}
|
|
|
|
void UEdGraphNode_Reference::AddReferencer(UEdGraphNode_Reference* ReferencerNode)
|
|
{
|
|
UEdGraphPin* ReferencerDependencyPin = ReferencerNode->GetDependencyPin();
|
|
|
|
if ( ensure(ReferencerDependencyPin) )
|
|
{
|
|
ReferencerDependencyPin->bHidden = false;
|
|
ReferencerPin->bHidden = false;
|
|
ReferencerPin->MakeLinkTo(ReferencerDependencyPin);
|
|
}
|
|
}
|
|
|
|
FAssetIdentifier UEdGraphNode_Reference::GetIdentifier() const
|
|
{
|
|
if (Identifiers.Num() > 0)
|
|
{
|
|
return Identifiers[0];
|
|
}
|
|
|
|
return FAssetIdentifier();
|
|
}
|
|
|
|
void UEdGraphNode_Reference::GetAllIdentifiers(TArray<FAssetIdentifier>& OutIdentifiers) const
|
|
{
|
|
OutIdentifiers.Append(Identifiers);
|
|
}
|
|
|
|
void UEdGraphNode_Reference::GetAllPackageNames(TArray<FName>& OutPackageNames) const
|
|
{
|
|
for (const FAssetIdentifier& AssetId : Identifiers)
|
|
{
|
|
if (AssetId.PackageName.IsValid() && !AssetId.IsValue())
|
|
{
|
|
OutPackageNames.AddUnique(AssetId.PackageName);
|
|
}
|
|
}
|
|
}
|
|
|
|
UEdGraph_ReferenceViewer* UEdGraphNode_Reference::GetReferenceViewerGraph() const
|
|
{
|
|
return Cast<UEdGraph_ReferenceViewer>( GetGraph() );
|
|
}
|
|
|
|
FText UEdGraphNode_Reference::GetNodeTitle(ENodeTitleType::Type TitleType) const
|
|
{
|
|
return NodeTitle;
|
|
}
|
|
|
|
FLinearColor UEdGraphNode_Reference::GetNodeTitleColor() const
|
|
{
|
|
if (bIsPackage)
|
|
{
|
|
return FLinearColor(0.4f, 0.62f, 1.0f);
|
|
}
|
|
else if (bIsCollapsed)
|
|
{
|
|
return FLinearColor(0.55f, 0.55f, 0.55f);
|
|
}
|
|
else
|
|
{
|
|
return FLinearColor(0.0f, 0.55f, 0.62f);
|
|
}
|
|
}
|
|
|
|
FText UEdGraphNode_Reference::GetTooltipText() const
|
|
{
|
|
FString TooltipString;
|
|
for (const FAssetIdentifier& AssetId : Identifiers)
|
|
{
|
|
if (!TooltipString.IsEmpty())
|
|
{
|
|
TooltipString.Append(TEXT("\n"));
|
|
}
|
|
TooltipString.Append(AssetId.ToString());
|
|
}
|
|
return FText::FromString(TooltipString);
|
|
}
|
|
|
|
void UEdGraphNode_Reference::AllocateDefaultPins()
|
|
{
|
|
ReferencerPin = CreatePin( EEdGraphPinDirection::EGPD_Input, TEXT(""), TEXT(""), NULL, false, false, TEXT("") );
|
|
DependencyPin = CreatePin( EEdGraphPinDirection::EGPD_Output, TEXT(""), TEXT(""), NULL, false, false, TEXT("") );
|
|
|
|
ReferencerPin->bHidden = true;
|
|
DependencyPin->bHidden = true;
|
|
}
|
|
|
|
UObject* UEdGraphNode_Reference::GetJumpTargetForDoubleClick() const
|
|
{
|
|
if (Identifiers.Num() > 0 )
|
|
{
|
|
GetReferenceGraph()->SetGraphRoot(Identifiers, FIntPoint(NodePosX, NodePosY));
|
|
GetReferenceGraph()->RebuildGraph();
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
UEdGraphPin* UEdGraphNode_Reference::GetDependencyPin()
|
|
{
|
|
return DependencyPin;
|
|
}
|
|
|
|
UEdGraphPin* UEdGraphNode_Reference::GetReferencerPin()
|
|
{
|
|
return ReferencerPin;
|
|
}
|
|
|
|
void UEdGraphNode_Reference::CacheAssetData(const FAssetData& AssetData)
|
|
{
|
|
if ( AssetData.IsValid() && IsPackage() )
|
|
{
|
|
bUsesThumbnail = true;
|
|
CachedAssetData = AssetData;
|
|
}
|
|
else
|
|
{
|
|
CachedAssetData = FAssetData();
|
|
bUsesThumbnail = false;
|
|
|
|
if (Identifiers.Num() == 1 )
|
|
{
|
|
const FString PackageNameStr = Identifiers[0].PackageName.ToString();
|
|
if ( FPackageName::IsValidLongPackageName(PackageNameStr, true) )
|
|
{
|
|
if ( PackageNameStr.StartsWith(TEXT("/Script")) )
|
|
{
|
|
CachedAssetData.AssetClass = FName(TEXT("Code"));
|
|
}
|
|
else
|
|
{
|
|
const FString PotentiallyMapFilename = FPackageName::LongPackageNameToFilename(PackageNameStr, FPackageName::GetMapPackageExtension());
|
|
const bool bIsMapPackage = FPlatformFileManager::Get().GetPlatformFile().FileExists(*PotentiallyMapFilename);
|
|
if ( bIsMapPackage )
|
|
{
|
|
CachedAssetData.AssetClass = FName(TEXT("World"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
CachedAssetData.AssetClass = FName(TEXT("Multiple Nodes"));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
FAssetData UEdGraphNode_Reference::GetAssetData() const
|
|
{
|
|
return CachedAssetData;
|
|
}
|
|
|
|
bool UEdGraphNode_Reference::UsesThumbnail() const
|
|
{
|
|
return bUsesThumbnail;
|
|
}
|
|
|
|
bool UEdGraphNode_Reference::IsPackage() const
|
|
{
|
|
return bIsPackage;
|
|
}
|
|
|
|
bool UEdGraphNode_Reference::IsCollapsed() const
|
|
{
|
|
return bIsCollapsed;
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|