2014-03-14 14:13:41 -04:00
|
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "BlueprintGraphPrivatePCH.h"
|
2014-08-11 03:23:38 -04:00
|
|
|
#include "Engine/ComponentDelegateBinding.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-04-23 18:30:37 -04:00
|
|
|
#define LOCTEXT_NAMESPACE "K2Node"
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
UK2Node_ComponentBoundEvent::UK2Node_ComponentBoundEvent(const class FPostConstructInitializeProperties& PCIP)
|
|
|
|
|
: Super(PCIP)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-23 18:30:37 -04:00
|
|
|
FText UK2Node_ComponentBoundEvent::GetNodeTitle(ENodeTitleType::Type TitleType) const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-09-02 19:08:09 -04:00
|
|
|
if (CachedNodeTitle.IsOutOfDate())
|
|
|
|
|
{
|
|
|
|
|
FFormatNamedArguments Args;
|
|
|
|
|
Args.Add(TEXT("DelegatePropertyName"), FText::FromName(DelegatePropertyName));
|
|
|
|
|
Args.Add(TEXT("ComponentPropertyName"), FText::FromName(ComponentPropertyName));
|
|
|
|
|
|
|
|
|
|
// FText::Format() is slow, so we cache this to save on performance
|
|
|
|
|
CachedNodeTitle = FText::Format(LOCTEXT("ComponentBoundEvent_Title", "{DelegatePropertyName} ({ComponentPropertyName})"), Args);
|
|
|
|
|
}
|
|
|
|
|
return CachedNodeTitle;
|
2014-04-23 18:30:37 -04:00
|
|
|
}
|
|
|
|
|
|
2014-08-26 16:25:42 -04:00
|
|
|
void UK2Node_ComponentBoundEvent::InitializeComponentBoundEventParams(UObjectProperty const* InComponentProperty, const UMulticastDelegateProperty* InDelegateProperty)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
if( InComponentProperty && InDelegateProperty )
|
|
|
|
|
{
|
|
|
|
|
ComponentPropertyName = InComponentProperty->GetFName();
|
|
|
|
|
DelegatePropertyName = InDelegateProperty->GetFName();
|
|
|
|
|
EventSignatureName = InDelegateProperty->SignatureFunction->GetFName();
|
|
|
|
|
EventSignatureClass = CastChecked<UClass>(InDelegateProperty->SignatureFunction->GetOuter());
|
|
|
|
|
CustomFunctionName = FName( *FString::Printf(TEXT("BndEvt__%s_%s_%s"), *InComponentProperty->GetName(), *GetName(), *EventSignatureName.ToString()) );
|
|
|
|
|
bOverrideFunction = false;
|
|
|
|
|
bInternalEvent = true;
|
2014-09-10 16:14:07 -04:00
|
|
|
CachedNodeTitle.MarkDirty();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UClass* UK2Node_ComponentBoundEvent::GetDynamicBindingClass() const
|
|
|
|
|
{
|
|
|
|
|
return UComponentDelegateBinding::StaticClass();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UK2Node_ComponentBoundEvent::RegisterDynamicBinding(UDynamicBlueprintBinding* BindingObject) const
|
|
|
|
|
{
|
|
|
|
|
UComponentDelegateBinding* ComponentBindingObject = CastChecked<UComponentDelegateBinding>(BindingObject);
|
|
|
|
|
|
|
|
|
|
FBlueprintComponentDelegateBinding Binding;
|
|
|
|
|
Binding.ComponentPropertyName = ComponentPropertyName;
|
|
|
|
|
Binding.DelegatePropertyName = DelegatePropertyName;
|
|
|
|
|
Binding.FunctionNameToBind = CustomFunctionName;
|
|
|
|
|
|
2014-09-10 16:14:07 -04:00
|
|
|
CachedNodeTitle.MarkDirty();
|
2014-03-14 14:13:41 -04:00
|
|
|
ComponentBindingObject->ComponentDelegateBindings.Add(Binding);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UK2Node_ComponentBoundEvent::IsUsedByAuthorityOnlyDelegate() const
|
|
|
|
|
{
|
|
|
|
|
UMulticastDelegateProperty* TargetDelegateProp = GetTargetDelegateProperty();
|
|
|
|
|
return (TargetDelegateProp && TargetDelegateProp->HasAnyPropertyFlags(CPF_BlueprintAuthorityOnly));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UMulticastDelegateProperty* UK2Node_ComponentBoundEvent::GetTargetDelegateProperty() const
|
|
|
|
|
{
|
|
|
|
|
return Cast<UMulticastDelegateProperty>(FindField<UMulticastDelegateProperty>(EventSignatureClass, DelegatePropertyName));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-09-03 18:14:09 -04:00
|
|
|
FText UK2Node_ComponentBoundEvent::GetTooltipText() const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
UMulticastDelegateProperty* TargetDelegateProp = GetTargetDelegateProperty();
|
|
|
|
|
if (TargetDelegateProp)
|
|
|
|
|
{
|
2014-09-03 18:14:09 -04:00
|
|
|
return TargetDelegateProp->GetToolTipText();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-09-03 18:14:09 -04:00
|
|
|
return FText::FromName(DelegatePropertyName);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FString UK2Node_ComponentBoundEvent::GetDocumentationLink() const
|
|
|
|
|
{
|
|
|
|
|
if (EventSignatureClass)
|
|
|
|
|
{
|
|
|
|
|
return FString::Printf(TEXT("Shared/GraphNodes/Blueprint/%s%s"), EventSignatureClass->GetPrefixCPP(), *EventSignatureClass->GetName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FString UK2Node_ComponentBoundEvent::GetDocumentationExcerptName() const
|
|
|
|
|
{
|
|
|
|
|
return DelegatePropertyName.ToString();
|
2014-04-23 18:30:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|