2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#include "ReferenceViewerPrivatePCH.h"
|
|
|
|
|
#include "AssetThumbnail.h"
|
|
|
|
|
#include "ReferenceViewerActions.h"
|
|
|
|
|
#include "GlobalEditorCommonCommands.h"
|
|
|
|
|
|
2014-11-14 18:23:54 -05:00
|
|
|
#include "Editor/GraphEditor/Public/ConnectionDrawingPolicy.h"
|
2014-11-07 16:06:07 -05:00
|
|
|
|
|
|
|
|
// Overridden connection drawing policy to use less curvy lines between nodes
|
|
|
|
|
class FReferenceViewerConnectionDrawingPolicy : public FConnectionDrawingPolicy
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FReferenceViewerConnectionDrawingPolicy(int32 InBackLayerID, int32 InFrontLayerID, float InZoomFactor, const FSlateRect& InClippingRect, FSlateWindowElementList& InDrawElements)
|
|
|
|
|
: FConnectionDrawingPolicy(InBackLayerID, InFrontLayerID, InZoomFactor, InClippingRect, InDrawElements)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual FVector2D ComputeSplineTangent(const FVector2D& Start, const FVector2D& End) const override
|
|
|
|
|
{
|
|
|
|
|
const int32 Tension = FMath::Abs<int32>(Start.X - End.X);
|
|
|
|
|
return Tension * FVector2D(1.0f, 0);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// UReferenceViewerSchema
|
|
|
|
|
|
2014-10-14 10:29:11 -04:00
|
|
|
UReferenceViewerSchema::UReferenceViewerSchema(const FObjectInitializer& ObjectInitializer)
|
|
|
|
|
: Super(ObjectInitializer)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UReferenceViewerSchema::GetContextMenuActions(const UEdGraph* CurrentGraph, const UEdGraphNode* InGraphNode, const UEdGraphPin* InGraphPin, class FMenuBuilder* MenuBuilder, bool bIsDebugging) const
|
|
|
|
|
{
|
|
|
|
|
MenuBuilder->AddMenuEntry(FGlobalEditorCommonCommands::Get().FindInContentBrowser);
|
2014-05-13 12:56:26 -04:00
|
|
|
MenuBuilder->AddMenuEntry(FReferenceViewerActions::Get().OpenSelectedInAssetEditor);
|
2014-03-14 14:13:41 -04:00
|
|
|
MenuBuilder->AddMenuEntry(FReferenceViewerActions::Get().ReCenterGraph);
|
|
|
|
|
MenuBuilder->AddMenuEntry(FReferenceViewerActions::Get().ListReferencedObjects);
|
|
|
|
|
MenuBuilder->AddMenuEntry(FReferenceViewerActions::Get().ListObjectsThatReference);
|
|
|
|
|
|
|
|
|
|
MenuBuilder->AddSubMenu(NSLOCTEXT("ReferenceViewerSchema","MakeCollectionWithReferencedAssetsTitle", "Make Collection with Referenced Assets"),
|
|
|
|
|
FText::GetEmpty(),
|
|
|
|
|
FNewMenuDelegate::CreateUObject(this, &UReferenceViewerSchema::GetMakeCollectionWithReferencedAssetsSubMenu )
|
|
|
|
|
);
|
|
|
|
|
|
2015-04-22 15:58:21 -04:00
|
|
|
MenuBuilder->AddMenuEntry(FReferenceViewerActions::Get().ShowSizeMap);
|
2014-03-14 14:13:41 -04:00
|
|
|
MenuBuilder->AddMenuEntry(FReferenceViewerActions::Get().ShowReferenceTree);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FLinearColor UReferenceViewerSchema::GetPinTypeColor(const FEdGraphPinType& PinType) const
|
|
|
|
|
{
|
|
|
|
|
return FLinearColor::White;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UReferenceViewerSchema::BreakPinLinks(UEdGraphPin& TargetPin, bool bSendsNodeNotifcation) const
|
|
|
|
|
{
|
|
|
|
|
// Don't allow breaking any links
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UReferenceViewerSchema::BreakSinglePinLink(UEdGraphPin* SourcePin, UEdGraphPin* TargetPin)
|
|
|
|
|
{
|
|
|
|
|
// Don't allow breaking any links
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-23 17:47:19 -04:00
|
|
|
FPinConnectionResponse UReferenceViewerSchema::MovePinLinks(UEdGraphPin& MoveFromPin, UEdGraphPin& MoveToPin, bool bIsItermeadiateMove) const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// Don't allow moving any links
|
|
|
|
|
return FPinConnectionResponse(CONNECT_RESPONSE_DISALLOW, TEXT(""));
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-23 17:47:19 -04:00
|
|
|
FPinConnectionResponse UReferenceViewerSchema::CopyPinLinks(UEdGraphPin& CopyFromPin, UEdGraphPin& CopyToPin, bool bIsItermeadiateCopy) const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// Don't allow copying any links
|
|
|
|
|
return FPinConnectionResponse(CONNECT_RESPONSE_DISALLOW, TEXT(""));
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-07 16:06:07 -05:00
|
|
|
FConnectionDrawingPolicy* UReferenceViewerSchema::CreateConnectionDrawingPolicy(int32 InBackLayerID, int32 InFrontLayerID, float InZoomFactor, const FSlateRect& InClippingRect, class FSlateWindowElementList& InDrawElements, class UEdGraph* InGraphObj) const
|
|
|
|
|
{
|
|
|
|
|
return new FReferenceViewerConnectionDrawingPolicy(InBackLayerID, InFrontLayerID, InZoomFactor, InClippingRect, InDrawElements);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
void UReferenceViewerSchema::GetMakeCollectionWithReferencedAssetsSubMenu( FMenuBuilder& MenuBuilder )
|
|
|
|
|
{
|
|
|
|
|
MenuBuilder.AddMenuEntry(FReferenceViewerActions::Get().MakeLocalCollectionWithReferencedAssets);
|
|
|
|
|
MenuBuilder.AddMenuEntry(FReferenceViewerActions::Get().MakePrivateCollectionWithReferencedAssets);
|
|
|
|
|
MenuBuilder.AddMenuEntry(FReferenceViewerActions::Get().MakeSharedCollectionWithReferencedAssets);
|
|
|
|
|
}
|