Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added BlueprintCallable function to trigger a custom input on a FlowComponent. #214

Open
wants to merge 1 commit into
base: 5.x
Choose a base branch
from
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
13 changes: 13 additions & 0 deletions Source/Flow/Private/FlowComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,19 @@ void UFlowComponent::StartRootFlow()
}
}

void UFlowComponent::TriggerRootFlowCustomInput(const FName& EventName)
{
if (!RootFlow || !IsFlowNetMode(RootFlowMode)) return;

if (UFlowSubsystem* FlowSubsystem = GetFlowSubsystem())
{
if(auto Flow = FlowSubsystem->GetRootFlow(this); IsValid(Flow))
{
Flow->TriggerCustomInput(EventName);
}
}
}

void UFlowComponent::FinishRootFlow(UFlowAsset* TemplateAsset, const EFlowFinishPolicy FinishPolicy)
{
if (UFlowSubsystem* FlowSubsystem = GetFlowSubsystem())
Expand Down
4 changes: 4 additions & 0 deletions Source/Flow/Public/FlowComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ class FLOW_API UFlowComponent : public UActorComponent, public IFlowOwnerInterfa
UFUNCTION(BlueprintCallable, Category = "RootFlow")
void StartRootFlow();

// This will trigger a specific CustomInput on this components root flow
UFUNCTION(BlueprintCallable, Category = "RootFlow")
void TriggerRootFlowCustomInput(const FName& EventName);

// This will destroy instantiated Flow Asset - created from asset assigned on this component.
UFUNCTION(BlueprintCallable, Category = "RootFlow")
void FinishRootFlow(UFlowAsset* TemplateAsset, const EFlowFinishPolicy FinishPolicy);
Expand Down