bool FNodeHandlingFunctor::ValidateAndRegisterNetIfLiteral(FKismetFunctionContext& Context, UEdGraphPin* Net) { if (Net->LinkedTo.Num() == 0) { // Make sure the default value is valid FString DefaultAllowedResult = CompilerContext.GetSchema()->IsCurrentPinDefaultValid(Net); if (DefaultAllowedResult != TEXT("")) { CompilerContext.MessageLog.Error(*FString::Printf(*LOCTEXT("InvalidDefaultValue_Error", "Default value '%s' for @@ is invalid: '%s'").ToString(), *(Net->GetDefaultAsString()), *DefaultAllowedResult), Net); return false; } FBPTerminal* LiteralTerm = Context.RegisterLiteral(Net); Context.LiteralHackMap.Add(Net, LiteralTerm); } return true; }
void FNodeHandlingFunctor::RegisterNets(FKismetFunctionContext& Context, UEdGraphNode* Node) { for (int32 PinIndex = 0; PinIndex < Node->Pins.Num(); ++PinIndex) { UEdGraphPin* Pin = Node->Pins[PinIndex]; if (!CompilerContext.GetSchema()->IsMetaPin(*Pin) || (CompilerContext.GetSchema()->IsSelfPin(*Pin) && Pin->LinkedTo.Num() == 0 && Pin->DefaultObject) ) { UEdGraphPin* Net = FEdGraphUtilities::GetNetFromPin(Pin); if (Context.NetMap.Find(Net) == NULL) { // New net, resolve the term that will be used to construct it FBPTerminal* Term = NULL; if ((Net->Direction == EGPD_Input) && (Net->LinkedTo.Num() == 0)) { // Make sure the default value is valid FString DefaultAllowedResult = CompilerContext.GetSchema()->IsCurrentPinDefaultValid(Net); if (DefaultAllowedResult != TEXT("")) { CompilerContext.MessageLog.Error(*FString::Printf(*LOCTEXT("InvalidDefaultValue_Error", "Default value '%s' for @@ is invalid: '%s'").ToString(), *(Net->GetDefaultAsString()), *DefaultAllowedResult), Net); // Skip over these properties if they are array or ref properties, because the backend can't emit valid code for them if( Pin->PinType.bIsArray || Pin->PinType.bIsReference ) { continue; } } Term = Context.RegisterLiteral(Net); Context.NetMap.Add(Net, Term); } else { RegisterNet(Context, Pin); } } } } }