Files
UnrealEngineUWP/Engine/Source/Editor/BlueprintGraph/Private/BlueprintBoundNodeSpawner.cpp
Ben Marsh 149375b14b Update copyright notices to 2015.
[CL 2379638 by Ben Marsh in Main branch]
2014-12-07 19:09:38 -05:00

78 lines
2.6 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "BlueprintGraphPrivatePCH.h"
#include "BlueprintBoundNodeSpawner.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(UObject const* BindingCandidate) const
{
if(CanBindObjectDelegate.IsBound())
{
return CanBindObjectDelegate.Execute(BindingCandidate);
}
return false;
}
//------------------------------------------------------------------------------
bool UBlueprintBoundNodeSpawner::BindToNode(UEdGraphNode* Node, UObject* Binding) const
{
if(OnBindObjectDelegate.IsBound())
{
return OnBindObjectDelegate.Execute(Node, Binding);
}
return false;
}
#undef LOCTEXT_NAMESPACE