void UK2Node_Event::AllocateDefaultPins() { const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>(); CreatePin(EGPD_Output, K2Schema->PC_Delegate, TEXT(""), NULL, false, false, DelegateOutputName); CreatePin(EGPD_Output, K2Schema->PC_Exec, TEXT(""), NULL, false, false, K2Schema->PN_Then); const UFunction* Function = FindEventSignatureFunction(); if (Function != NULL) { CreatePinsForFunctionEntryExit(Function, /*bIsFunctionEntry=*/ true); } Super::AllocateDefaultPins(); }
void UK2Node_CustomEvent::ReconstructNode() { const UEdGraphPin* DelegateOutPin = FindPin(DelegateOutputName); const UK2Node_BaseMCDelegate* OtherNode = (DelegateOutPin && DelegateOutPin->LinkedTo.Num() && DelegateOutPin->LinkedTo[0]) ? Cast<const UK2Node_BaseMCDelegate>(DelegateOutPin->LinkedTo[0]->GetOwningNode()) : NULL; const UFunction* DelegateSignature = OtherNode ? OtherNode->GetDelegateSignature() : NULL; const bool bUseDelegateSignature = (NULL == FindEventSignatureFunction()) && DelegateSignature; if (bUseDelegateSignature) { UserDefinedPins.Empty(); const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>(); for (TFieldIterator<UProperty> PropIt(DelegateSignature); PropIt && (PropIt->PropertyFlags & CPF_Parm); ++PropIt) { const UProperty* Param = *PropIt; if (!Param->HasAnyPropertyFlags(CPF_OutParm) || Param->HasAnyPropertyFlags(CPF_ReferenceParm)) { FEdGraphPinType PinType; K2Schema->ConvertPropertyToPinType(Param, /*out*/ PinType); FString NewPinName = Param->GetName(); int32 Index = 1; while ((DelegateOutputName == NewPinName) || (K2Schema->PN_Then == NewPinName)) { ++Index; NewPinName += FString::FromInt(Index); } TSharedPtr<FUserPinInfo> NewPinInfo = MakeShareable( new FUserPinInfo() ); NewPinInfo->PinName = NewPinName; NewPinInfo->PinType = PinType; UserDefinedPins.Add(NewPinInfo); } } } Super::ReconstructNode(); }