You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Change summary: - Moved base definition of UK2Node::HasExternalDependencies() up one level to UEdGraphNode (to avoid blind casts in a context where we may not necessarily have a UK2Node subtype). - Updated subtype headers that override HasExternalDependencies() to relocate the declaration into the class declaration's 'UEdGraphNode overrides' section (for clarity). - Reverted previous UBlueprintNodeSpawner::ImportTarget solution in favor of using node dependencies; this allows auto-import actions to scale more easily to all existing node subtypes and avoids data duplication. - Modified SBlueprintActionMenu::OnActionSelected() to utilize the new method for determining which namespace(s) to auto-import after executing a node spawner action in response to a context menu item selection (UE-146803). - Reverted FBlueprintNamespaceUtilities::GetPropertyValueNamespaces() back to its original 5.0 signature so that it uses a TSet<FString> for the output rather than a TArray<FString>; this fits in better with input to other APIs. - Renamed FBlueprintEditor::FImportNamespaceParameters to FImportNamespaceExParameters (for clarity). - Changed the 'FBlueprintEditor::FImportNamespaceParameters::AdditionalNamespaces' member to a TSet<FString> containing *all* namespaces to import rather than limiting to only additional ones. - Reverted FBlueprintEditor::ImportNamespace() back to its original 5.0 signature and added/implemented FBlueprintEditor::ImportNamespaceEx() as the "extended" version that allows for batched imports and future customizations. - Revised existing FBlueprintEditor::ImportNamespace() call sites to utilize and/or conform to the extended ImportNamespaceEx() API where appropriate. #jira UE-146803 #rb Benjamin.Fox #preflight 623cf3a433709ff50128e8d4 [CL 19505118 by Phillip Kavan in ue5-main branch]
80 lines
2.5 KiB
C++
80 lines
2.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "BlueprintFieldNodeSpawner.h"
|
|
#include "UObject/Package.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "BlueprintFieldNodeSpawner"
|
|
|
|
//------------------------------------------------------------------------------
|
|
UBlueprintFieldNodeSpawner* UBlueprintFieldNodeSpawner::Create(TSubclassOf<UK2Node> NodeClass, FFieldVariant Field, UObject* Outer/* = nullptr*/, UClass const* OwnerClass)
|
|
{
|
|
if (Outer == nullptr)
|
|
{
|
|
Outer = GetTransientPackage();
|
|
}
|
|
UBlueprintFieldNodeSpawner* NodeSpawner = NewObject<UBlueprintFieldNodeSpawner>(Outer);
|
|
NodeSpawner->SetField(Field);
|
|
NodeSpawner->NodeClass = NodeClass;
|
|
NodeSpawner->OwnerClass = OwnerClass;
|
|
|
|
return NodeSpawner;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
UBlueprintFieldNodeSpawner::UBlueprintFieldNodeSpawner(FObjectInitializer const& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
, OwnerClass(nullptr)
|
|
, Field(nullptr)
|
|
{
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
FBlueprintNodeSignature UBlueprintFieldNodeSpawner::GetSpawnerSignature() const
|
|
{
|
|
FBlueprintNodeSignature SpawnerSignature(NodeClass);
|
|
if (Field)
|
|
{
|
|
SpawnerSignature.AddSubObject(Field);
|
|
}
|
|
else
|
|
{
|
|
check(Property.Get());
|
|
SpawnerSignature.AddKeyValue(Property->GetPathName());
|
|
}
|
|
|
|
return SpawnerSignature;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
UEdGraphNode* UBlueprintFieldNodeSpawner::Invoke(UEdGraph* ParentGraph, FBindingSet const& Bindings, FVector2D const Location) const
|
|
{
|
|
auto PostSpawnSetupLambda = [](UEdGraphNode* NewNode, bool bIsTemplateNode, FFieldVariant InField, FSetNodeFieldDelegate SetFieldDelegate, FCustomizeNodeDelegate UserDelegate)
|
|
{
|
|
SetFieldDelegate.ExecuteIfBound(NewNode, InField);
|
|
UserDelegate.ExecuteIfBound(NewNode, bIsTemplateNode);
|
|
};
|
|
|
|
FCustomizeNodeDelegate PostSpawnSetupDelegate = FCustomizeNodeDelegate::CreateStatic(PostSpawnSetupLambda, GetField(), SetNodeFieldDelegate, CustomizeNodeDelegate);
|
|
return Super::SpawnNode<UEdGraphNode>(NodeClass, ParentGraph, Bindings, Location, PostSpawnSetupDelegate);
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
FFieldVariant UBlueprintFieldNodeSpawner::GetField() const
|
|
{
|
|
return Field ? FFieldVariant(Field) : FFieldVariant(Property.Get());
|
|
}
|
|
|
|
void UBlueprintFieldNodeSpawner::SetField(FFieldVariant InField)
|
|
{
|
|
if (InField.IsUObject())
|
|
{
|
|
Field = InField.Get<UField>();
|
|
}
|
|
else
|
|
{
|
|
Property = InField.Get<FProperty>();
|
|
}
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|