void UK2Node_Select::PostReconstructNode() { bReconstructNode = false; const UEdGraphSchema_K2* Schema = Cast<UEdGraphSchema_K2>(GetSchema()); UEdGraphPin* ReturnPin = GetReturnValuePin(); PinConnectionListChanged(ReturnPin); const bool bFillTypeFromReturn = Schema && ReturnPin && (ReturnPin->PinType.PinCategory != Schema->PC_Wildcard); TArray<UEdGraphPin*> OptionPins; GetOptionPins(OptionPins); for (auto It = OptionPins.CreateConstIterator(); It; It++) { UEdGraphPin* Pin = *It; const bool bTypeShouldBeFilled = Schema && Pin && (Pin->PinType.PinCategory == Schema->PC_Wildcard); if (bTypeShouldBeFilled && bFillTypeFromReturn) { Pin->Modify(); Pin->PinType = ReturnPin->PinType; UEdGraphSchema_K2::ValidateExistingConnections(Pin); } PinConnectionListChanged(*It); } //After ReconstructNode we must be sure, that no additional reconstruction is required bReconstructNode = false; }
void UK2Node_CallArrayFunction::PostReconstructNode() { // cannot use a ranged for here, as PinConnectionListChanged() might end up // collapsing split pins (subtracting elements from Pins) for (int32 PinIndex = 0; PinIndex < Pins.Num(); ++PinIndex) { UEdGraphPin* Pin = Pins[PinIndex]; if (Pin->LinkedTo.Num() > 0) { PinConnectionListChanged(Pin); } } }
void UK2Node_EnumEquality::PostReconstructNode() { // Do type determination before enum fixup PinConnectionListChanged(GetInput1Pin()); PinConnectionListChanged(GetInput2Pin()); Super::PostReconstructNode(); // const UEdGraphSchema_K2* Schema = GetDefault<UEdGraphSchema_K2>(); // // UEdGraphPin* Input1Pin = GetInput1Pin(); // UEdGraphPin* Input2Pin = GetInput2Pin(); // // if ((Input1Pin->LinkedTo.Num() == 0) && (Input2Pin->LinkedTo.Num() == 0)) // { // // Restore the wildcard status // Input1Pin->PinType.PinCategory = Schema->PC_Wildcard; // Input1Pin->PinType.PinSubCategory = TEXT(""); // Input1Pin->PinType.PinSubCategoryObject = NULL; // Input2Pin->PinType.PinCategory = Schema->PC_Wildcard; // Input2Pin->PinType.PinSubCategory = TEXT(""); // Input2Pin->PinType.PinSubCategoryObject = NULL; // } }
void UK2Node_Select::ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins) { Super::ReallocatePinsDuringReconstruction(OldPins); const UEdGraphSchema_K2* Schema = GetDefault<UEdGraphSchema_K2>(); // See if this node was saved in the old version with a boolean as the condition UEdGraphPin* OldConditionPin = NULL; UEdGraphPin* OldIndexPin = NULL; for (auto It = OldPins.CreateConstIterator(); It; It++) { if ((*It)->PinName == TEXT("bPickOption0")) { OldConditionPin = (*It); } else if ((*It)->PinName == TEXT("Index")) { OldIndexPin = (*It); } } UEdGraphPin* IndexPin = GetIndexPin(); // If we are fixing up an old bool node (swap the options and copy the condition links) if (OldConditionPin) { // Set the index pin type IndexPinType.PinCategory = Schema->PC_Boolean; IndexPinType.PinSubCategory = TEXT(""); IndexPinType.PinSubCategoryObject = NULL; // Set the pin type and Copy the pin IndexPin->PinType = IndexPinType; Schema->CopyPinLinks(*OldConditionPin, *IndexPin); // If we copy links, we need to send a notification if (IndexPin->LinkedTo.Num() > 0) { PinConnectionListChanged(IndexPin); } UEdGraphPin* OptionPin0 = FindPin("Option 0"); UEdGraphPin* OptionPin1 = FindPin("Option 1"); for (auto It = OldPins.CreateConstIterator(); It; It++) { UEdGraphPin* OldPin = (*It); if (OldPin->PinName == OptionPin0->PinName) { Schema->MovePinLinks(*OldPin, *OptionPin1); } else if (OldPin->PinName == OptionPin1->PinName) { Schema->MovePinLinks(*OldPin, *OptionPin0); } } } // If the index pin has links or a default value but is a wildcard, this is an old int pin so convert it if (OldIndexPin && IndexPinType.PinCategory == Schema->PC_Wildcard && (OldIndexPin->LinkedTo.Num() > 0 || OldIndexPin->DefaultValue != TEXT(""))) { IndexPinType.PinCategory = Schema->PC_Int; IndexPinType.PinSubCategory = TEXT(""); IndexPinType.PinSubCategoryObject = NULL; IndexPin->PinType = IndexPinType; } }