GraphNode_Rename is good
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "K2Node_EditablePinBase.h"
|
||||
#include "EdGraph/EdGraphSchema.h"
|
||||
#include "Kismet2/BlueprintEditorUtils.h"
|
||||
#include "Kismet2/Kismet2NameValidators.h"
|
||||
#include "Kismet2/KismetEditorUtilities.h"
|
||||
#include "UObject/UObjectIterator.h"
|
||||
#include "UObject/UnrealType.h"
|
||||
@@ -379,6 +380,23 @@ bool WingUtils::CheckExactlyNoneNamed(int Count, const TCHAR *Kind, const FStrin
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WingUtils::CheckCanRename(UEdGraphNode* Node, const FString &Name)
|
||||
{
|
||||
if (!Node->bCanRenameNode)
|
||||
{
|
||||
UWingServer::Printf(TEXT("ERROR: Node %s does not support renaming.\n"), *FormatName(Node));
|
||||
return false;
|
||||
}
|
||||
TSharedPtr<INameValidatorInterface> Validator = FNameValidatorFactory::MakeValidator(Node);
|
||||
EValidatorResult Result = Validator->IsValid(Name, false);
|
||||
if (Result != EValidatorResult::Ok && Result != EValidatorResult::ExistingName)
|
||||
{
|
||||
UWingServer::Printf(TEXT("ERROR: %s\n"), *INameValidatorInterface::GetErrorString(Name, Result));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Blueprint helpers
|
||||
// ============================================================
|
||||
|
||||
Reference in New Issue
Block a user