Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[unreal]:增加对未能正确添加变量的情况进行提示 #1748

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions unreal/Puerts/Source/PuertsEditor/Private/PEBlueprintAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include "Kismet2/ComponentEditorUtils.h"
#include "Editor.h"
#include "HAL/PlatformFileManager.h"
#include "Framework/Application/SlateApplication.h"
#include "Misc/MessageDialog.h"

#define LOCTEXT_NAMESPACE "UPEBlueprintAsset"

Expand Down Expand Up @@ -1080,8 +1082,22 @@ void UPEBlueprintAsset::AddMemberVariable(FName NewVarName, FPEGraphPinType InGr
if (VarIndex == INDEX_NONE)
{
CanChangeCheck();
FBlueprintEditorUtils::AddMemberVariable(Blueprint, NewVarName, PinType);
NeedSave = true;
if (NewVarName == NAME_None)
{
FString Message = FString::Printf(TEXT("VariableName is None, unable to add variable"));
FMessageDialog::Open(EAppMsgType::Ok, FText::FromString(Message));
}
else if (FBlueprintEditorUtils::AddMemberVariable(Blueprint, NewVarName, PinType))
{
NeedSave = true;
}
else
{
FString Message = FString::Printf(
TEXT("Failed to add variable: %s. Please check if the parent class already has a variable with the same name."),
*NewVarName.ToString());
FMessageDialog::Open(EAppMsgType::Ok, FText::FromString(Message));
}
}
else
{
Expand Down
Loading