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..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)); @@ -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()) + { + return; + } + + const UFlowGraphNode* SelectedNode = *SelectedNodes.CreateConstIterator(); + const UFlowNode* FlowNode = Cast(SelectedNode->GetFlowNodeBase()); + if (UFlowNode* InspectedInstance = FlowNode->GetInspectedInstance()) { - 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,12 +1585,15 @@ bool SFlowGraphEditor::CanFocusViewport() const void SFlowGraphEditor::JumpToNodeDefinition() const { - // Iterator used but should only contain one node - for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes()) - { - SelectedNode->JumpToDefinition(); - return; - } + TSet SelectedNodes = GetSelectedFlowNodes(); + if (SelectedNodes.Num() == 1) + { + UFlowGraphNode* SelectedNode = *SelectedNodes.CreateConstIterator(); + if (SelectedNode != nullptr) + { + SelectedNode->JumpToDefinition(); + } + } } bool SFlowGraphEditor::CanJumpToNodeDefinition() const