Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Source/Flow/Private/FlowSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,12 +750,13 @@ void UFlowSubsystem::FindComponents(const FGameplayTagContainer& Tags, const EGa
else // EGameplayContainerMatchType::All
{
TSet<TWeakObjectPtr<UFlowComponent>> 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<TWeakObjectPtr<UFlowComponent>> ComponentsPerTag;
FindComponents(Tag, bExactMatch, ComponentsPerTag);
FindComponents(Tags.GetByIndex(0), bExactMatch, ComponentsPerTag);
ComponentsWithAnyTag.Append(ComponentsPerTag);
break;
}

for (const TWeakObjectPtr<UFlowComponent>& Component : ComponentsWithAnyTag)
Expand Down
81 changes: 48 additions & 33 deletions Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -1103,9 +1103,11 @@ void SFlowGraphEditor::ReconstructNode() const

bool SFlowGraphEditor::CanReconstructNode() const
{
if (CanEdit() && GetSelectedFlowNodes().Num() == 1)
TSet<UFlowGraphNode*> SelectedNodes = GetSelectedFlowNodes();
if (CanEdit() && SelectedNodes.Num() == 1)
{
for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes())
UFlowGraphNode* SelectedNode = *SelectedNodes.CreateConstIterator();
if (SelectedNode != nullptr)
{
return SelectedNode->SupportsContextPins();
}
Expand All @@ -1124,9 +1126,11 @@ void SFlowGraphEditor::AddInput() const

bool SFlowGraphEditor::CanAddInput() const
{
if (CanEdit() && GetSelectedFlowNodes().Num() == 1)
TSet<UFlowGraphNode*> SelectedFlowNodes = GetSelectedFlowNodes();
if (CanEdit() && SelectedFlowNodes.Num() == 1)
{
for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes())
UFlowGraphNode* SelectedNode = *SelectedFlowNodes.CreateConstIterator();
if (SelectedNode != nullptr)
{
return SelectedNode->CanUserAddInput();
}
Expand All @@ -1145,9 +1149,11 @@ void SFlowGraphEditor::AddOutput() const

bool SFlowGraphEditor::CanAddOutput() const
{
if (CanEdit() && GetSelectedFlowNodes().Num() == 1)
TSet<UFlowGraphNode*> SelectedFlowNodes = GetSelectedFlowNodes();
if (CanEdit() && SelectedFlowNodes.Num() == 1)
{
for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes())
UFlowGraphNode* SelectedNode = *SelectedFlowNodes.CreateConstIterator();
if (SelectedNode != nullptr)
{
return SelectedNode->CanUserAddOutput();
}
Expand Down Expand Up @@ -1518,9 +1524,14 @@ bool SFlowGraphEditor::CanSetSignalMode(const EFlowSignalMode Mode) const
return false;
}

for (const UFlowGraphNode* SelectedNode : GetSelectedFlowNodes())
TSet<UFlowGraphNode*> SelectedNodes = GetSelectedFlowNodes();
if (SelectedNodes.Num() == 1)
{
return SelectedNode->CanSetSignalMode(Mode);
UFlowGraphNode* SelectedNode = *SelectedNodes.CreateConstIterator();
if (SelectedNode != nullptr)
{
return SelectedNode->CanSetSignalMode(Mode);
}
}

return false;
Expand All @@ -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<UFlowGraphNode*> SelectedNodes = GetSelectedFlowNodes();
if (SelectedNodes.IsEmpty())
{
return;
}

const UFlowGraphNode* SelectedNode = *SelectedNodes.CreateConstIterator();
const UFlowNode* FlowNode = Cast<UFlowNode>(SelectedNode->GetFlowNodeBase());
if (UFlowNode* InspectedInstance = FlowNode->GetInspectedInstance())
{
const UFlowNode* FlowNode = Cast<UFlowNode>(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<FLevelEditorModule>("LevelEditor");
const TSharedPtr<SDockTab> LevelEditorTab = LevelEditorModule.GetLevelEditorInstanceTab().Pin();
if (LevelEditorTab.IsValid())
{
LevelEditorTab->DrawAttention();
}
const FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
const TSharedPtr<SDockTab> LevelEditorTab = LevelEditorModule.GetLevelEditorInstanceTab().Pin();
if (LevelEditorTab.IsValid())
{
LevelEditorTab->DrawAttention();
}
}

return;
}
}

Expand All @@ -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<UFlowGraphNode*> SelectedNodes = GetSelectedFlowNodes();
if (SelectedNodes.Num() == 1)
{
UFlowGraphNode* SelectedNode = *SelectedNodes.CreateConstIterator();
if (SelectedNode != nullptr)
{
SelectedNode->JumpToDefinition();
}
}
}

bool SFlowGraphEditor::CanJumpToNodeDefinition() const
Expand Down