@@ -577,7 +577,7 @@ void UFlowGraphNode::CreateAttachAddOnSubMenu(UToolMenu* Menu, UEdGraph* Graph)
577577{
578578 UFlowGraphNode* MutableThis = const_cast <UFlowGraphNode*>(this );
579579
580- TSharedRef<SGraphEditorActionMenuFlow> Widget =
580+ const TSharedRef<SGraphEditorActionMenuFlow> Widget =
581581 SNew (SGraphEditorActionMenuFlow)
582582 .GraphObj (Graph)
583583 .GraphNode (MutableThis)
@@ -593,7 +593,28 @@ bool UFlowGraphNode::CanUserDeleteNode() const
593593
594594bool UFlowGraphNode::CanDuplicateNode () const
595595{
596- return NodeInstance ? NodeInstance->bCanDuplicate : Super::CanDuplicateNode ();
596+ if (NodeInstance)
597+ {
598+ return NodeInstance->bCanDuplicate ;
599+ }
600+
601+ // support code paths calling this method on CDO, where there's no Flow Node Instance
602+ if (AssignedNodeClasses.Num () > 0 )
603+ {
604+ // we simply allow action if any Assigned Node Class accepts it, as the action is disallowed in special node likes StartNode
605+ for (const UClass* Class : AssignedNodeClasses)
606+ {
607+ const UFlowNode* NodeDefaults = Class->GetDefaultObject <UFlowNode>();
608+ if (NodeDefaults && NodeDefaults->bCanDuplicate )
609+ {
610+ return true ;
611+ }
612+ }
613+
614+ return false ;
615+ }
616+
617+ return true ;
597618}
598619
599620TSharedPtr<SGraphNode> UFlowGraphNode::CreateVisualWidget ()
@@ -1024,7 +1045,7 @@ void UFlowGraphNode::RefreshContextPins(const bool bReconstructNode)
10241045 // We don't have contextual pins to account for; or the contextual pins have not changed. We can skip now.
10251046 return ;
10261047 }
1027-
1048+
10281049 const FScopedTransaction Transaction (LOCTEXT (" RefreshContextPins" , " Refresh Context Pins" ));
10291050 Modify ();
10301051
@@ -1264,7 +1285,7 @@ void UFlowGraphNode::LogError(const FString& MessageToLog, const UFlowNodeBase*
12641285
12651286bool UFlowGraphNode::HavePinsChanged ()
12661287{
1267- const UFlowNode* FlowNodeInstance = Cast<UFlowNode>(NodeInstance);
1288+ const UFlowNode* FlowNodeInstance = Cast<UFlowNode>(NodeInstance);
12681289 if (!IsValid (FlowNodeInstance))
12691290 {
12701291 // default to having changed because we don't have a way to confirm that the pins have remained intact.
@@ -1288,7 +1309,7 @@ bool UFlowGraphNode::HavePinsChanged()
12881309 // There is a different number of EdGraphPins and Flow Node pins; something changed.
12891310 return true ;
12901311 }
1291-
1312+
12921313 TArray<FName> PinNames;
12931314 for (const UEdGraphPin* Pin : Pins)
12941315 {
@@ -1306,7 +1327,7 @@ bool UFlowGraphNode::HavePinsChanged()
13061327 }
13071328
13081329 // Nothing changed
1309- return false ;
1330+ return false ;
13101331}
13111332
13121333void UFlowGraphNode::ResetNodeOwner ()
@@ -1720,7 +1741,7 @@ void UFlowGraphNode::ValidateGraphNode(FFlowMessageLog& MessageLog) const
17201741 for (UEdGraphPin* const ConnectedPin : EdGraphPin->LinkedTo )
17211742 {
17221743 const FPinConnectionResponse Response = Schema->CanCreateConnection (ConnectedPin, EdGraphPin);
1723-
1744+
17241745 if (!Response.CanSafeConnect ())
17251746 {
17261747 MessageLog.Error <UFlowNodeBase>(*FString::Printf (TEXT (" Pin %s has invalid connection: %s" ), *EdGraphPin->GetName (), *Response.Message .ToString ()), NodeInstance);
@@ -1765,7 +1786,7 @@ bool UFlowGraphNode::CanAcceptSubNodeAsChild(const UFlowGraphNode& SubNodeToCons
17651786 {
17661787 *OutReasonString = TEXT (" Cannot be a AddOn of one of our own AddOns" );
17671788 }
1768-
1789+
17691790 return false ;
17701791 }
17711792
0 commit comments