@@ -577,7 +577,7 @@ void UFlowGraphNode::CreateAttachAddOnSubMenu(UToolMenu* Menu, UEdGraph* Graph)
577
577
{
578
578
UFlowGraphNode* MutableThis = const_cast <UFlowGraphNode*>(this );
579
579
580
- TSharedRef<SGraphEditorActionMenuFlow> Widget =
580
+ const TSharedRef<SGraphEditorActionMenuFlow> Widget =
581
581
SNew (SGraphEditorActionMenuFlow)
582
582
.GraphObj (Graph)
583
583
.GraphNode (MutableThis)
@@ -593,7 +593,28 @@ bool UFlowGraphNode::CanUserDeleteNode() const
593
593
594
594
bool UFlowGraphNode::CanDuplicateNode () const
595
595
{
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 ;
597
618
}
598
619
599
620
TSharedPtr<SGraphNode> UFlowGraphNode::CreateVisualWidget ()
@@ -1024,7 +1045,7 @@ void UFlowGraphNode::RefreshContextPins(const bool bReconstructNode)
1024
1045
// We don't have contextual pins to account for; or the contextual pins have not changed. We can skip now.
1025
1046
return ;
1026
1047
}
1027
-
1048
+
1028
1049
const FScopedTransaction Transaction (LOCTEXT (" RefreshContextPins" , " Refresh Context Pins" ));
1029
1050
Modify ();
1030
1051
@@ -1264,7 +1285,7 @@ void UFlowGraphNode::LogError(const FString& MessageToLog, const UFlowNodeBase*
1264
1285
1265
1286
bool UFlowGraphNode::HavePinsChanged ()
1266
1287
{
1267
- const UFlowNode* FlowNodeInstance = Cast<UFlowNode>(NodeInstance);
1288
+ const UFlowNode* FlowNodeInstance = Cast<UFlowNode>(NodeInstance);
1268
1289
if (!IsValid (FlowNodeInstance))
1269
1290
{
1270
1291
// 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()
1288
1309
// There is a different number of EdGraphPins and Flow Node pins; something changed.
1289
1310
return true ;
1290
1311
}
1291
-
1312
+
1292
1313
TArray<FName> PinNames;
1293
1314
for (const UEdGraphPin* Pin : Pins)
1294
1315
{
@@ -1306,7 +1327,7 @@ bool UFlowGraphNode::HavePinsChanged()
1306
1327
}
1307
1328
1308
1329
// Nothing changed
1309
- return false ;
1330
+ return false ;
1310
1331
}
1311
1332
1312
1333
void UFlowGraphNode::ResetNodeOwner ()
@@ -1720,7 +1741,7 @@ void UFlowGraphNode::ValidateGraphNode(FFlowMessageLog& MessageLog) const
1720
1741
for (UEdGraphPin* const ConnectedPin : EdGraphPin->LinkedTo )
1721
1742
{
1722
1743
const FPinConnectionResponse Response = Schema->CanCreateConnection (ConnectedPin, EdGraphPin);
1723
-
1744
+
1724
1745
if (!Response.CanSafeConnect ())
1725
1746
{
1726
1747
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
1765
1786
{
1766
1787
*OutReasonString = TEXT (" Cannot be a AddOn of one of our own AddOns" );
1767
1788
}
1768
-
1789
+
1769
1790
return false ;
1770
1791
}
1771
1792
0 commit comments