From 73317a5aa3da11d8495da71a8e0100d3eb93b6a1 Mon Sep 17 00:00:00 2001 From: Marshall Date: Wed, 22 Jul 2026 11:05:48 -0400 Subject: [PATCH 1/2] Fix: Rework redundant loops causing errors when compiling under Clang --- Source/Flow/Private/FlowSubsystem.cpp | 7 +- .../Private/Graph/FlowGraphEditor.cpp | 69 +++++++++++-------- 2 files changed, 44 insertions(+), 32 deletions(-) diff --git a/Source/Flow/Private/FlowSubsystem.cpp b/Source/Flow/Private/FlowSubsystem.cpp index c2996aa97..c60261d0b 100644 --- a/Source/Flow/Private/FlowSubsystem.cpp +++ b/Source/Flow/Private/FlowSubsystem.cpp @@ -750,12 +750,13 @@ void UFlowSubsystem::FindComponents(const FGameplayTagContainer& Tags, const EGa else // EGameplayContainerMatchType::All { TSet> ComponentsWithAnyTag; - for (const FGameplayTag& Tag : Tags) + + // Seed the candidate pool using just the first tag, then filter down to only those that have all tags. + if (!Tags.IsEmpty()) { TArray> ComponentsPerTag; - FindComponents(Tag, bExactMatch, ComponentsPerTag); + FindComponents(Tags.GetByIndex(0), bExactMatch, ComponentsPerTag); ComponentsWithAnyTag.Append(ComponentsPerTag); - break; } for (const TWeakObjectPtr& Component : ComponentsWithAnyTag) diff --git a/Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp b/Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp index f07a3296f..55c0f65c0 100644 --- a/Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp +++ b/Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp @@ -1103,9 +1103,11 @@ void SFlowGraphEditor::ReconstructNode() const bool SFlowGraphEditor::CanReconstructNode() const { - if (CanEdit() && GetSelectedFlowNodes().Num() == 1) + TSet SelectedNodes = GetSelectedFlowNodes(); + if (CanEdit() && SelectedNodes.Num() == 1) { - for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes()) + UFlowGraphNode* SelectedNode = *SelectedNodes.CreateConstIterator(); + if (SelectedNode != nullptr) { return SelectedNode->SupportsContextPins(); } @@ -1124,9 +1126,11 @@ void SFlowGraphEditor::AddInput() const bool SFlowGraphEditor::CanAddInput() const { - if (CanEdit() && GetSelectedFlowNodes().Num() == 1) + TSet SelectedFlowNodes = GetSelectedFlowNodes(); + if (CanEdit() && SelectedFlowNodes.Num() == 1) { - for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes()) + UFlowGraphNode* SelectedNode = *SelectedFlowNodes.CreateConstIterator(); + if (SelectedNode != nullptr) { return SelectedNode->CanUserAddInput(); } @@ -1145,9 +1149,11 @@ void SFlowGraphEditor::AddOutput() const bool SFlowGraphEditor::CanAddOutput() const { - if (CanEdit() && GetSelectedFlowNodes().Num() == 1) + TSet SelectedFlowNodes = GetSelectedFlowNodes(); + if (CanEdit() && SelectedFlowNodes.Num() == 1) { - for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes()) + UFlowGraphNode* SelectedNode = *SelectedFlowNodes.CreateConstIterator(); + if (SelectedNode != nullptr) { return SelectedNode->CanUserAddOutput(); } @@ -1518,9 +1524,14 @@ bool SFlowGraphEditor::CanSetSignalMode(const EFlowSignalMode Mode) const return false; } - for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes()) + TSet SelectedNodes = GetSelectedFlowNodes(); + if (SelectedNodes.Num() == 1) { - return SelectedNode->CanSetSignalMode(Mode); + UFlowGraphNode* SelectedNode = *SelectedNodes.CreateConstIterator(); + if (SelectedNode != nullptr) + { + return SelectedNode->CanSetSignalMode(Mode); + } } return false; @@ -1539,30 +1550,31 @@ void SFlowGraphEditor::OnForcePinActivation() void SFlowGraphEditor::FocusViewport() const { - // Iterator used but should only contain one node - for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes()) + const TSet SelectedNodes = GetSelectedFlowNodes(); + if (SelectedNodes.IsEmpty()) { - const UFlowNode* FlowNode = Cast(SelectedNode->GetFlowNodeBase()); - if (UFlowNode* InspectedInstance = FlowNode->GetInspectedInstance()) + return; + } + + const UFlowGraphNode* SelectedNode = *SelectedNodes.CreateConstIterator(); + const UFlowNode* FlowNode = Cast(SelectedNode->GetFlowNodeBase()); + if (UFlowNode* InspectedInstance = FlowNode->GetInspectedInstance()) + { + if (AActor* ActorToFocus = InspectedInstance->GetActorToFocus()) { - if (AActor* ActorToFocus = InspectedInstance->GetActorToFocus()) - { - GEditor->SelectNone(false, false, false); - GEditor->SelectActor(ActorToFocus, true, true, true); - GEditor->NoteSelectionChange(); + GEditor->SelectNone(false, false, false); + GEditor->SelectActor(ActorToFocus, true, true, true); + GEditor->NoteSelectionChange(); - GEditor->MoveViewportCamerasToActor(*ActorToFocus, false); + GEditor->MoveViewportCamerasToActor(*ActorToFocus, false); - const FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked("LevelEditor"); - const TSharedPtr LevelEditorTab = LevelEditorModule.GetLevelEditorInstanceTab().Pin(); - if (LevelEditorTab.IsValid()) - { - LevelEditorTab->DrawAttention(); - } + const FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked("LevelEditor"); + const TSharedPtr LevelEditorTab = LevelEditorModule.GetLevelEditorInstanceTab().Pin(); + if (LevelEditorTab.IsValid()) + { + LevelEditorTab->DrawAttention(); } } - - return; } } @@ -1573,11 +1585,10 @@ bool SFlowGraphEditor::CanFocusViewport() const void SFlowGraphEditor::JumpToNodeDefinition() const { - // Iterator used but should only contain one node - for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes()) + UFlowGraphNode* SelectedNode = *GetSelectedFlowNodes().CreateConstIterator(); + if (SelectedNode != nullptr) { SelectedNode->JumpToDefinition(); - return; } } From 44496d47215b16ef894a271be67ac4e819602d17 Mon Sep 17 00:00:00 2001 From: Marshall Date: Wed, 22 Jul 2026 11:23:33 -0400 Subject: [PATCH 2/2] Fix: Add missing Num guard to SFlowGraphEditor::JumpToNodeDefinition --- .../FlowEditor/Private/Graph/FlowGraphEditor.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp b/Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp index 55c0f65c0..3f8b10061 100644 --- a/Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp +++ b/Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp @@ -266,7 +266,7 @@ void SFlowGraphEditor::BindGraphCommands() CommandList->MapAction(FlowGraphCommands.EnableAllBreakpoints, FExecuteAction::CreateSP(this, &SFlowGraphEditor::EnableAllBreakpoints), FCanExecuteAction::CreateSP(this, &SFlowGraphEditor::HasAnyDisabledBreakpoints)); - + CommandList->MapAction(FlowGraphCommands.DisableAllBreakpoints, FExecuteAction::CreateSP(this, &SFlowGraphEditor::DisableAllBreakpoints), FCanExecuteAction::CreateSP(this, &SFlowGraphEditor::HasAnyEnabledBreakpoints)); @@ -1585,11 +1585,15 @@ bool SFlowGraphEditor::CanFocusViewport() const void SFlowGraphEditor::JumpToNodeDefinition() const { - UFlowGraphNode* SelectedNode = *GetSelectedFlowNodes().CreateConstIterator(); - if (SelectedNode != nullptr) - { - SelectedNode->JumpToDefinition(); - } + TSet SelectedNodes = GetSelectedFlowNodes(); + if (SelectedNodes.Num() == 1) + { + UFlowGraphNode* SelectedNode = *SelectedNodes.CreateConstIterator(); + if (SelectedNode != nullptr) + { + SelectedNode->JumpToDefinition(); + } + } } bool SFlowGraphEditor::CanJumpToNodeDefinition() const