Refactor Format Message, step 1
This commit is contained in:
@@ -43,20 +43,6 @@
|
||||
|
||||
// All argument pins will have Names that start with "A:"
|
||||
|
||||
static bool IsArgumentPin(const UEdGraphPin *Pin) {
|
||||
TCHAR pname[FName::StringBufferSize];
|
||||
Pin->PinName.ToString(pname);
|
||||
return pname[0] == 'A' && pname[1] == ':';
|
||||
}
|
||||
|
||||
static FName ArgumentNameAddPrefix(const FString &name) {
|
||||
FString Prefixed = FString("A:") + name;
|
||||
return FName(*Prefixed);
|
||||
}
|
||||
|
||||
static FString ArgumentNameRemovePrefix(const FName &name) {
|
||||
return name.ToString().Mid(2, FName::StringBufferSize);
|
||||
}
|
||||
|
||||
static const FName VerbosityPinName(TEXT("Verbosity"));
|
||||
static bool IsVerbosityPin(const UEdGraphPin *Pin) {
|
||||
@@ -121,9 +107,9 @@ void UK2Node_FormatMessage::CreateCorrectPins()
|
||||
for (auto It = Pins.CreateIterator(); It; ++It)
|
||||
{
|
||||
UEdGraphPin* CheckPin = *It;
|
||||
if (IsArgumentPin(CheckPin))
|
||||
if (HasPrefix(CheckPin->PinName, 'A'))
|
||||
{
|
||||
OldPins.Add(ArgumentNameRemovePrefix(CheckPin->PinName), CheckPin);
|
||||
OldPins.Add(RemovePrefix(CheckPin->PinName).ToString(), CheckPin);
|
||||
It.RemoveCurrent();
|
||||
}
|
||||
}
|
||||
@@ -137,7 +123,7 @@ void UK2Node_FormatMessage::CreateCorrectPins()
|
||||
Pins.Emplace(*OldPin);
|
||||
OldPins.Remove(Name);
|
||||
} else {
|
||||
FName PrefixedName = ArgumentNameAddPrefix(Name);
|
||||
FName PrefixedName = AddPrefix(Name, 'A');
|
||||
CreatePin(EGPD_Input, UEdGraphSchema_K2::PC_Wildcard, PrefixedName);
|
||||
}
|
||||
}
|
||||
@@ -155,7 +141,7 @@ void UK2Node_FormatMessage::CreateCorrectPins()
|
||||
|
||||
void UK2Node_FormatMessage::SynchronizeArgumentPinType(UEdGraphPin* Pin)
|
||||
{
|
||||
if (IsArgumentPin(Pin))
|
||||
if (HasPrefix(Pin->PinName, 'A'))
|
||||
{
|
||||
const UEdGraphSchema_K2* K2Schema = Cast<const UEdGraphSchema_K2>(GetSchema());
|
||||
|
||||
@@ -227,8 +213,8 @@ FText UK2Node_FormatMessage::GetPinDisplayName(const UEdGraphPin* Pin) const
|
||||
}
|
||||
|
||||
// For argument pins, we must strip off the Argument Pin Prefix.
|
||||
if (IsArgumentPin(Pin)) {
|
||||
return FText::FromString(ArgumentNameRemovePrefix(Pin->PinName));
|
||||
if (HasPrefix(Pin->PinName, 'A')) {
|
||||
return FText::FromName(RemovePrefix(Pin->PinName));
|
||||
}
|
||||
|
||||
// Otherwise, just return the Pin Name the normal way.
|
||||
@@ -385,7 +371,7 @@ void UK2Node_FormatMessage::ExpandNode(class FKismetCompilerContext& CompilerCon
|
||||
for(int32 ArgIdx = 0; ArgIdx < PinNames.Num(); ++ArgIdx)
|
||||
{
|
||||
FString OriginalName = PinNames[ArgIdx];
|
||||
UEdGraphPin* ArgumentPin = FindPin(ArgumentNameAddPrefix(OriginalName), EGPD_Input);
|
||||
UEdGraphPin* ArgumentPin = FindPin(AddPrefix(OriginalName, 'A'), EGPD_Input);
|
||||
|
||||
|
||||
// Find a function that can convert the input into an FFormatArgumentData.
|
||||
@@ -508,7 +494,7 @@ bool UK2Node_FormatMessage::IsConnectionDisallowed(const UEdGraphPin* MyPin, con
|
||||
}
|
||||
|
||||
// Argument input pins may only be connected to Byte, Integer, Float, Text, and ETextGender pins...
|
||||
if (IsArgumentPin(MyPin))
|
||||
if (HasPrefix(MyPin->PinName, 'A'))
|
||||
{
|
||||
const UEdGraphSchema_K2* K2Schema = Cast<const UEdGraphSchema_K2>(GetSchema());
|
||||
const FName& OtherPinCategory = OtherPin->PinType.PinCategory;
|
||||
|
||||
Reference in New Issue
Block a user