Files
UnrealEngineUWP/Engine/Source/Editor/GraphEditor/Private/KismetNodes/SGraphNodeK2Event.cpp
Patrick Boutot 383815f480 Slate: Convert SWidget's Enabled and Visibility flag to SlateAttribute.
#jira UE-106515, UE-112897
#rb vincent.gauthier
#preflight 606f3fcd97c8220001315871
#preflight 60749a870adbfb0001f0455c

[CL 15982898 by Patrick Boutot in ue5-main branch]
2021-04-12 16:13:38 -04:00

55 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "KismetNodes/SGraphNodeK2Event.h"
#include "SGraphPin.h"
#include "K2Node_Event.h"
void SGraphNodeK2Event::AddPin( const TSharedRef<SGraphPin>& PinToAdd )
{
const UEdGraphPin* PinObj = PinToAdd->GetPinObj();
const bool bDelegateOutput = (PinObj != nullptr) && (UK2Node_Event::DelegateOutputName == PinObj->PinName);
if (bDelegateOutput && TitleAreaWidget.IsValid())
{
PinToAdd->SetOwner(SharedThis(this));
bHasDelegateOutputPin = true;
PinToAdd->SetShowLabel(false);
TitleAreaWidget->AddSlot()
.HAlign(HAlign_Right)
.VAlign(VAlign_Center)
.Padding(FMargin(4))
[
PinToAdd
];
OutputPins.Add(PinToAdd);
}
else
{
SGraphNodeK2Default::AddPin(PinToAdd);
}
}
bool SGraphNodeK2Event::UseLowDetailNodeTitles() const
{
return (!bHasDelegateOutputPin) && ParentUseLowDetailNodeTitles();
}
EVisibility SGraphNodeK2Event::GetTitleVisibility() const
{
return ParentUseLowDetailNodeTitles() ? EVisibility::Hidden : EVisibility::Visible;
}
TSharedRef<SWidget> SGraphNodeK2Event::CreateTitleWidget(TSharedPtr<SNodeTitle> NodeTitle)
{
TSharedRef<SWidget> WidgetRef = SGraphNodeK2Default::CreateTitleWidget(NodeTitle);
WidgetRef->SetVisibility(MakeAttributeSP(this, &SGraphNodeK2Event::GetTitleVisibility));
if (NodeTitle.IsValid())
{
NodeTitle->SetVisibility(MakeAttributeSP(this, &SGraphNodeK2Event::GetTitleVisibility));
}
return WidgetRef;
}