2014-09-17 13:01:38 -04:00
|
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "BlueprintGraphPrivatePCH.h"
|
|
|
|
|
#include "BlueprintFieldNodeSpawner.h"
|
|
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "BlueprintFieldNodeSpawner"
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
UBlueprintFieldNodeSpawner* UBlueprintFieldNodeSpawner::Create(TSubclassOf<UK2Node> NodeClass, UField const* const Field, UObject* Outer/* = nullptr*/)
|
|
|
|
|
{
|
|
|
|
|
if (Outer == nullptr)
|
|
|
|
|
{
|
|
|
|
|
Outer = GetTransientPackage();
|
|
|
|
|
}
|
|
|
|
|
UBlueprintFieldNodeSpawner* NodeSpawner = NewObject<UBlueprintFieldNodeSpawner>(Outer);
|
|
|
|
|
NodeSpawner->Field = Field;
|
|
|
|
|
NodeSpawner->NodeClass = NodeClass;
|
|
|
|
|
|
|
|
|
|
return NodeSpawner;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
UBlueprintFieldNodeSpawner::UBlueprintFieldNodeSpawner(class FPostConstructInitializeProperties const& PCIP)
|
|
|
|
|
: Super(PCIP)
|
|
|
|
|
, Field(nullptr)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2014-09-17 17:07:37 -04:00
|
|
|
FBlueprintNodeSignature UBlueprintFieldNodeSpawner::GetSpawnerSignature() const
|
2014-09-17 13:01:38 -04:00
|
|
|
{
|
2014-09-17 17:07:37 -04:00
|
|
|
FBlueprintNodeSignature SpawnerSignature(NodeClass);
|
2014-09-17 13:01:38 -04:00
|
|
|
SpawnerSignature.AddSubObject(Field);
|
|
|
|
|
|
|
|
|
|
return SpawnerSignature;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
UEdGraphNode* UBlueprintFieldNodeSpawner::Invoke(UEdGraph* ParentGraph, FBindingSet const& Bindings, FVector2D const Location) const
|
|
|
|
|
{
|
|
|
|
|
auto PostSpawnSetupLambda = [](UEdGraphNode* NewNode, bool bIsTemplateNode, UField const* Field, FSetNodeFieldDelegate SetFieldDelegate, FCustomizeNodeDelegate UserDelegate)
|
|
|
|
|
{
|
|
|
|
|
SetFieldDelegate.ExecuteIfBound(NewNode, Field);
|
|
|
|
|
UserDelegate.ExecuteIfBound(NewNode, bIsTemplateNode);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FCustomizeNodeDelegate PostSpawnSetupDelegate = FCustomizeNodeDelegate::CreateStatic(PostSpawnSetupLambda, GetField(), SetNodeFieldDelegate, CustomizeNodeDelegate);
|
2014-09-19 17:50:45 -04:00
|
|
|
return Super::SpawnNode(NodeClass, ParentGraph, Bindings, Location, PostSpawnSetupDelegate);
|
2014-09-17 13:01:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
UField const* UBlueprintFieldNodeSpawner::GetField() const
|
|
|
|
|
{
|
|
|
|
|
return Field;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|