Files
UnrealEngineUWP/Engine/Source/Editor/BlueprintGraph/Private/BlueprintBoundNodeSpawner.cpp
ryan durand 627baf970a Updating copyright for Engine Editor.
#rnx
#rb none


#ROBOMERGE-SOURCE: CL 10869241 via CL 10869527 via CL 10869904
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870586 by ryan durand in Main branch]
2019-12-26 15:33:43 -05:00

78 lines
2.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "BlueprintBoundNodeSpawner.h"
#include "Kismet2/BlueprintEditorUtils.h"
#define LOCTEXT_NAMESPACE "BlueprintBoundNodeSpawner"
/*******************************************************************************
* UBlueprintBoundNodeSpawner
******************************************************************************/
//------------------------------------------------------------------------------
UBlueprintBoundNodeSpawner* UBlueprintBoundNodeSpawner::Create(TSubclassOf<UEdGraphNode> NodeClass, UObject* Outer/* = nullptr*/)
{
if (Outer == nullptr)
{
Outer = GetTransientPackage();
}
UBlueprintBoundNodeSpawner* NodeSpawner = NewObject<UBlueprintBoundNodeSpawner>(Outer);
NodeSpawner->NodeClass = NodeClass;
return NodeSpawner;
}
//------------------------------------------------------------------------------
UBlueprintBoundNodeSpawner::UBlueprintBoundNodeSpawner(FObjectInitializer const& ObjectInitializer)
: Super(ObjectInitializer)
{
}
//------------------------------------------------------------------------------
FBlueprintNodeSignature UBlueprintBoundNodeSpawner::GetSpawnerSignature() const
{
// explicit actions for binding (like this) cannot be reconstructed form a
// signature (since this spawner does not own whatever it will be binding
// to), therefore we return an empty (invalid) signature
return FBlueprintNodeSignature();
}
//------------------------------------------------------------------------------
UEdGraphNode* UBlueprintBoundNodeSpawner::Invoke(UEdGraph* ParentGraph, FBindingSet const& Bindings, FVector2D const Location) const
{
UEdGraphNode* Result = nullptr;
if( FindPreExistingNodeDelegate.IsBound() )
{
UBlueprint* Blueprint = FBlueprintEditorUtils::FindBlueprintForGraphChecked(ParentGraph);
Result = FindPreExistingNodeDelegate.Execute( Blueprint, Bindings );
}
if( Result == nullptr)
{
Result = UBlueprintNodeSpawner::Invoke( ParentGraph, Bindings, Location );
}
return Result;
}
//------------------------------------------------------------------------------
bool UBlueprintBoundNodeSpawner::IsBindingCompatible(FBindingObject BindingCandidate) const
{
if(CanBindObjectDelegate.IsBound())
{
return CanBindObjectDelegate.Execute(BindingCandidate.Get<UObject>());
}
return false;
}
//------------------------------------------------------------------------------
bool UBlueprintBoundNodeSpawner::BindToNode(UEdGraphNode* Node, FBindingObject Binding) const
{
if(OnBindObjectDelegate.IsBound())
{
return OnBindObjectDelegate.Execute(Node, Binding.Get<UObject>());
}
return false;
}
#undef LOCTEXT_NAMESPACE