I’m creating a custom K2Node, and would like to have it have an output pin in its header, just like event nodes have an output delegate pin in their headers.
The node I’m making has nothing to do with events or delegates, but a pin in the header would make sense for this node, so if possible I would like to have one there.
I looked through the source code of
UK2Node_Event, and I did locate where the output delegate pin is created, but it just looks like any other pin. I found nothing that resembles an instruction to have it generated in the header.
I tried implementing
IK2Node_EventNodeInterface in my node and generating a delegate output pin first thing in
AllocateDefaultPins to see if it magically appeared in the header, but it just generated as a normal output pin in the node’s body.
Any help would be appreciated. Thanks in advance!
Hi, Go to unreal ricght click on the custom node event/ copy en paste it in a notepad there you will see the code of the node and how its build. its the output delegate part in de code. hope it helps
Thank you for the reply, had no idea this was a feature. I tried this, but as far as I can tell, there is no info on the delegate pin (or anywhere else in the node) that indicates the pin should go on the header.
Here is the pin’s data (with GUIDs removed):
PinId=PinGUID,
PinName="OutputDelegate",
Direction="EGPD_Output",
PinType.PinCategory="delegate",
PinType.PinSubCategory="",
PinType.PinSubCategoryObject=None,
PinType.PinSubCategoryMemberReference=(MemberParent="/Script/Engine.BlueprintGeneratedClass'/Game/GameContent/MyBlueprint.MyBlueprint_C'",MemberName="CustomEvent",MemberGuid=NodeGUID),
PinType.PinValueType=(),
PinType.ContainerType=None,
PinType.bIsReference=False,
PinType.bIsConst=False,
PinType.bIsWeakPointer=False,
PinType.bIsUObjectWrapper=False,
PinType.bSerializeAsSinglePrecisionFloat=False,
PersistentGuid=00000000000000000000000000000000,
bHidden=False,
bNotConnectable=False,
bDefaultValueIsReadOnly=False,
bDefaultValueIsIgnored=False,
bAdvancedView=False,
bOrphanedPin=False,
Listen buddy, while I do appreciate the effort, posting AI-generated images with unreadable blurry text written in a language most people on this forum can’t understand is not going to be of much help.
From what I could decipher of your second image, it seems you’re suggesting a custom Slate class derived from SGraphNodeK2Base? Since posting my initial question, I have learned this is one way to customize a node’s appearance, but given the customization I want already exists in Unreal in the form of event nodes, I was hoping I could simply reuse their implementation.
When I have access to my work PC again, I’ll see if I can locate the SGraphNodeK2Base used for event nodes, and whether it is reusable as-is.
Here’s what I managed to find.
For event nodes, the instructions to draw the output delegate pin in the header are indeed in the node’s custom Slate class (SGraphNodeK2Event), specifically in SGraphNodeK2Event::AddPin:
void SGraphNodeK2Event::AddPin( const TSharedRef<SGraphPin>& PinToAdd )
{
const UEdGraphPin* PinObj = PinToAdd->GetPinObj();
const bool bDelegateOutput = (PinObj != nullptr) && (UK2Node_Event::DelegateOutputName == PinObj->PinName);
if (bDelegateOutput && TitleAreaWidget.IsValid())
{
PinToAdd->SetOwner(SharedThis(this));
bHasDelegateOutputPin = true;
PinToAdd->SetShowLabel(false);
TitleAreaWidget->AddSlot()
.HAlign(HAlign_Right)
.VAlign(VAlign_Center)
.Padding(4.0f, 0.0f)
[
PinToAdd
];
OutputPins.Add(PinToAdd);
}
else
{
SGraphNodeK2Default::AddPin(PinToAdd);
}
}
From what I understand, whenever a pin is generated on the node, this function is called. If the pin’s name is the standard output delegate pin name defined in the event node (UK2Node_Event::DelegateOutputName), the pin is added to the header widget (TitleAreaWidget) instead of the node’s body.
Unfortunately, because the above name check is hard-coded, this class is unusable as-is for my purposes, so I created a separate SGraphNodeK2Base-derived class with mostly copy-pasted code from SGraphNodeK2Event, and it worked perfectly.