You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|||
|
|
|
|||
|
|
#include "DataInterfaceGraph_EdGraphSchema.h"
|
|||
|
|
#include "Editor.h"
|
|||
|
|
|
|||
|
|
void UDataInterfaceGraph_EdGraphSchema::TrySetDefaultValue(UEdGraphPin& InPin, const FString& InNewDefaultValue, bool bMarkAsModified) const
|
|||
|
|
{
|
|||
|
|
#if WITH_EDITOR
|
|||
|
|
if (GEditor)
|
|||
|
|
{
|
|||
|
|
GEditor->CancelTransaction(0);
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
FString UseDefaultValue;
|
|||
|
|
TObjectPtr<UObject> UseDefaultObject = nullptr;
|
|||
|
|
FText UseDefaultText;
|
|||
|
|
|
|||
|
|
GetDefault<UEdGraphSchema_K2>()->GetPinDefaultValuesFromString(InPin.PinType, InPin.GetOwningNodeUnchecked(), InNewDefaultValue, UseDefaultValue, UseDefaultObject, UseDefaultText, /*bPreserveTextIdentity*/false);
|
|||
|
|
|
|||
|
|
// Check the default value and make it an error if it's bogus
|
|||
|
|
if (GetDefault<UEdGraphSchema_K2>()->DefaultValueSimpleValidation(InPin.PinType, InPin.PinName, UseDefaultValue, UseDefaultObject, UseDefaultText))
|
|||
|
|
{
|
|||
|
|
InPin.DefaultObject = UseDefaultObject;
|
|||
|
|
InPin.DefaultValue = UseDefaultValue;
|
|||
|
|
InPin.DefaultTextValue = UseDefaultText;
|
|||
|
|
|
|||
|
|
UEdGraphNode* Node = InPin.GetOwningNode();
|
|||
|
|
Node->PinDefaultValueChanged(&InPin);
|
|||
|
|
|
|||
|
|
// If the default value is manually set then treat it as if the value was reset to default and remove the orphaned InPin
|
|||
|
|
if (InPin.bOrphanedPin && InPin.DoesDefaultValueMatchAutogenerated())
|
|||
|
|
{
|
|||
|
|
Node->PinConnectionListChanged(&InPin);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (bMarkAsModified)
|
|||
|
|
{
|
|||
|
|
Node->MarkPackageDirty();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|