From 01ab3cc6fb0e94f87dfb37daa5daf92b7bd6c111 Mon Sep 17 00:00:00 2001 From: LindyHopperGT <91915878+LindyHopperGT@users.noreply.github.com> Date: Wed, 3 Jun 2026 11:26:49 -0700 Subject: [PATCH] DisplayName & category changes For flow nodes that override GetNodeTitle/GetNodeDescription, only run those overrides for placed nodes in graphs. Preserve the default title and description for the archetype (e.g. in the node selection list) Add flow node category as BP native event for override in angel script --- Source/Flow/Private/FlowAsset.cpp | 5 +++ Source/Flow/Private/Nodes/FlowNodeBase.cpp | 37 ++++++++++++++++++- Source/Flow/Public/FlowAsset.h | 1 + Source/Flow/Public/Nodes/FlowNodeBase.h | 9 +++-- .../Private/Asset/FlowAssetToolbar.cpp | 4 +- 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/Source/Flow/Private/FlowAsset.cpp b/Source/Flow/Private/FlowAsset.cpp index aba46958..c7b86e09 100644 --- a/Source/Flow/Private/FlowAsset.cpp +++ b/Source/Flow/Private/FlowAsset.cpp @@ -1148,6 +1148,11 @@ TWeakObjectPtr UFlowAsset::GetFlowInstance(UFlowNode_SubGraph* SubGr return ActiveSubGraphs.FindRef(SubGraphNode); } +FName UFlowAsset::GetDisplayName() const +{ + return GetFName(); +} + void UFlowAsset::InitializePreloadPolicy() { if (PreloadPolicy.IsValid()) diff --git a/Source/Flow/Private/Nodes/FlowNodeBase.cpp b/Source/Flow/Private/Nodes/FlowNodeBase.cpp index 04aa5364..f9d0de3a 100644 --- a/Source/Flow/Private/Nodes/FlowNodeBase.cpp +++ b/Source/Flow/Private/Nodes/FlowNodeBase.cpp @@ -621,7 +621,7 @@ FString UFlowNodeBase::GetNodeCategory() const } } - return Category; + return K2_GetNodeCategory(); } bool UFlowNodeBase::GetDynamicTitleColor(FLinearColor& OutColor) const @@ -636,6 +636,32 @@ bool UFlowNodeBase::GetDynamicTitleColor(FLinearColor& OutColor) const return false; } +FText UFlowNodeBase::GetNodeTitle() const +{ + if (HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject)) + { + // For the archetype of the node (e.g. in the node selection UI), only use the default value + return UFlowNodeBase::K2_GetNodeTitle_Implementation(); + } + else + { + return K2_GetNodeTitle(); + } +} + +FText UFlowNodeBase::GetNodeToolTip() const +{ + if (HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject)) + { + // For the archetype of the node (e.g. in the node selection UI), only use the default value + return UFlowNodeBase::K2_GetNodeToolTip_Implementation(); + } + else + { + return K2_GetNodeToolTip(); + } +} + FText UFlowNodeBase::GetGeneratedDisplayName() const { static const FName NAME_GeneratedDisplayName(TEXT("GeneratedDisplayName")); @@ -820,6 +846,15 @@ FText UFlowNodeBase::K2_GetNodeToolTip_Implementation() const #endif } +FString UFlowNodeBase::K2_GetNodeCategory_Implementation() const +{ +#if WITH_EDITORONLY_DATA + return Category; +#else + return ""; +#endif +} + FText UFlowNodeBase::GetNodeConfigText() const { #if WITH_EDITORONLY_DATA diff --git a/Source/Flow/Public/FlowAsset.h b/Source/Flow/Public/FlowAsset.h index fa1048b0..18a7d1cb 100644 --- a/Source/Flow/Public/FlowAsset.h +++ b/Source/Flow/Public/FlowAsset.h @@ -392,6 +392,7 @@ class FLOW_API UFlowAsset : public UObject public: UFlowSubsystem* GetFlowSubsystem() const; + FName GetDisplayName() const; UFlowNode_SubGraph* GetNodeOwningThisAssetInstance() const; UFlowAsset* GetParentInstance() const; diff --git a/Source/Flow/Public/Nodes/FlowNodeBase.h b/Source/Flow/Public/Nodes/FlowNodeBase.h index c3c1a4d0..eec1c184 100644 --- a/Source/Flow/Public/Nodes/FlowNodeBase.h +++ b/Source/Flow/Public/Nodes/FlowNodeBase.h @@ -456,8 +456,8 @@ class FLOW_API UFlowNodeBase /* This method allows to have different for every node instance, i.e. Red if node represents enemy, Green if node represents a friend. */ virtual bool GetDynamicTitleColor(FLinearColor& OutColor) const; - virtual FText GetNodeTitle() const { return K2_GetNodeTitle(); } - virtual FText GetNodeToolTip() const { return K2_GetNodeToolTip(); } + virtual FText GetNodeTitle() const; + virtual FText GetNodeToolTip() const; FText GetGeneratedDisplayName() const; @@ -488,7 +488,10 @@ class FLOW_API UFlowNodeBase UFUNCTION(BlueprintNativeEvent, Category = "FlowNode") FText K2_GetNodeToolTip() const; - + + UFUNCTION(BlueprintNativeEvent, Category = "FlowNode") + FString K2_GetNodeCategory() const; + UFUNCTION(BlueprintPure, Category = "FlowNode") virtual FText GetNodeConfigText() const; diff --git a/Source/FlowEditor/Private/Asset/FlowAssetToolbar.cpp b/Source/FlowEditor/Private/Asset/FlowAssetToolbar.cpp index af262a4e..860aeabe 100644 --- a/Source/FlowEditor/Private/Asset/FlowAssetToolbar.cpp +++ b/Source/FlowEditor/Private/Asset/FlowAssetToolbar.cpp @@ -242,7 +242,7 @@ FText SFlowAssetInstanceList::JoinInstanceAndContextTexts(const FObjectKey& Asse { if (const UFlowAsset* Instance = Cast(AssetInstance.ResolveObjectPtr())) { - FText Result = FText::FromName(Instance->GetFName()); + FText Result = FText::FromName(Instance->GetDisplayName()); // add context name if there are multiple contexts present if (InstancesPerContext.Num() > 1) @@ -321,7 +321,7 @@ void SFlowAssetBreadcrumb::FillBreadcrumb() const TWeakObjectPtr Instance = InstancesFromRoot[Index]; TWeakObjectPtr ChildInstance = Index < InstancesFromRoot.Num() - 1 ? InstancesFromRoot[Index + 1] : nullptr; - BreadcrumbTrail->PushCrumb(FText::FromName(Instance->GetFName()), FFlowBreadcrumb(Instance, ChildInstance)); + BreadcrumbTrail->PushCrumb(FText::FromName(Instance->GetDisplayName()), FFlowBreadcrumb(Instance, ChildInstance)); } } }