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
5 changes: 5 additions & 0 deletions Source/EnhancedCodeFlow/Private/BP/ECFBPLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,9 @@ FString UECFBPLibrary::Conv_ECFInstanceIdToString(const FECFInstanceIdBP& Instan

/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/

FECFHandleBP UECFBPLibrary::FindActionByLabel(const UObject* WorldContextObject, const FString& Label)
{
return FECFHandleBP(FFlow::FindActionByLabel(WorldContextObject, Label));
}

ECF_PRAGMA_ENABLE_OPTIMIZATION
25 changes: 25 additions & 0 deletions Source/EnhancedCodeFlow/Private/ECFSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,31 @@ UECFActionBase* UECFSubsystem::FindAction(const FECFHandle& HandleId) const
return nullptr;
}

FECFHandle UECFSubsystem::FindActionByLabel(const FString& Label) const
{
if (Label.IsEmpty())
{
return FECFHandle();
}
// Search in active actions
for (UECFActionBase* Action : Actions)
{
if (IsActionValid(Action) && Action->Settings.Label == Label)
{
return Action->GetHandleId();
}
}
// Search in pending actions
for (UECFActionBase* PendingAction : PendingAddActions)
{
if (IsActionValid(PendingAction) && PendingAction->Settings.Label == Label)
{
return PendingAction->GetHandleId();
}
}
return FECFHandle();
}

void UECFSubsystem::PauseAction(const FECFHandle& HandleId)
{
if (UECFActionBase* ActionFound = FindAction(HandleId))
Expand Down
7 changes: 7 additions & 0 deletions Source/EnhancedCodeFlow/Private/EnhancedCodeFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,4 +589,11 @@ void FEnhancedCodeFlow::RemoveAllRunAsyncAndWait(const UObject* WorldContextObje
ECF->RemoveActionsOfClass<UECFRunAsyncAndWait>(bComplete, InOwner);
}

FECFHandle FEnhancedCodeFlow::FindActionByLabel(const UObject* WorldContextObject, const FString& Label)
{
if (UECFSubsystem* ECF = UECFSubsystem::Get(WorldContextObject))
return ECF->FindActionByLabel(Label);
return FECFHandle();
}

ECF_PRAGMA_ENABLE_OPTIMIZATION
6 changes: 6 additions & 0 deletions Source/EnhancedCodeFlow/Public/BP/ECFBPLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,5 +261,11 @@ class ENHANCEDCODEFLOW_API UECFBPLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, meta = (DisplayName = "ToString (FECFInstanceIdBP)", CompactNodeTitle = "->", BlueprintAutocast), Category = "ECF")
static FString Conv_ECFInstanceIdToString(const FECFInstanceIdBP& InstanceId);

/**
* Finds the first running or pending action with the given Label and returns its handle (for Blueprints).
*/
UFUNCTION(BlueprintPure, meta = (WorldContext = "WorldContextObject", DisplayName = "ECF - Find Action By Label"), Category = "ECF")
static FECFHandleBP FindActionByLabel(const UObject* WorldContextObject, const FString& Label);

/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
};
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ENHANCEDCODEFLOW_API UECFCustomTimeline : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - custom timeline failed to start. Are you sure Tick Function and Curve are set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] custom timeline failed to start. Are you sure Tick Function and Curve are set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ENHANCEDCODEFLOW_API UECFCustomTimelineLinearColor : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - custom timeline LinearColor failed to start. Are you sure Tick Function and Curve are set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] custom timeline LinearColor failed to start. Are you sure Tick Function and Curve are set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ENHANCEDCODEFLOW_API UECFCustomTimelineVector : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - custom timeline vector failed to start. Are you sure Tick Function and Curve are set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] custom timeline vector failed to start. Are you sure Tick Function and Curve are set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/EnhancedCodeFlow/Public/CodeFlowActions/ECFDelay.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ENHANCEDCODEFLOW_API UECFDelay : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - delay failed to start. Are you sure the DelayTime is not negative and Callback Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] delay failed to start. Are you sure the DelayTime is not negative and Callback Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand All @@ -56,7 +56,7 @@ class ENHANCEDCODEFLOW_API UECFDelay : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - delay failed to start. Are you sure the Callback Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] delay failed to start. Are you sure the Callback Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ENHANCEDCODEFLOW_API UECFDelayTicks : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - delay ticks failed to start. Are you sure the DelayTicks is not negative and Callback Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] delay ticks failed to start. Are you sure the DelayTicks is not negative and Callback Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ENHANCEDCODEFLOW_API UECFDoNTimes : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - DoNTimes failed to start. Are you sure Exec Fuinction and Times number are set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Do N Times failed to start. Are you sure the Exec Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ENHANCEDCODEFLOW_API UECFDoNoMoreThanXTime : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Do No More Than Times failed to start. Are you sure the Lock time and Max Execs Eneueud are greater than 0 and the Exec Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Do No More Than Times failed to start. Are you sure the Lock time and Max Execs Eneueud are greater than 0 and the Exec Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/EnhancedCodeFlow/Public/CodeFlowActions/ECFDoOnce.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ENHANCEDCODEFLOW_API UECFDoOnce : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - do once failed to start. Are you sure the Exec Function is is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] do once failed to start. Are you sure the Exec Function is is set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ENHANCEDCODEFLOW_API UECFRunAsyncThen : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Run Async Task and Run failed to start. Are you sure the AsyncTask and Function are set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Run Async Task and Run failed to start. Are you sure the AsyncTask and Function are set properly?"), *Settings.Label);
#endif
return false;
}
Expand All @@ -100,7 +100,7 @@ class ENHANCEDCODEFLOW_API UECFRunAsyncThen : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Run Async Task and Run failed to start. Are you sure the Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Run Async Task and Run failed to start. Are you sure the Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand All @@ -119,7 +119,7 @@ class ENHANCEDCODEFLOW_API UECFRunAsyncThen : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Run Async Task and Run failed to start. Are you sure the Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Run Async Task and Run failed to start. Are you sure the Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/EnhancedCodeFlow/Public/CodeFlowActions/ECFTicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ENHANCEDCODEFLOW_API UECFTicker : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Ticker(2) failed to start. Are you sure the Ticking time and Ticking Function are set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] ticker failed to start. Are you sure the Ticking time is greater than 0 and Ticking Function are set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ENHANCEDCODEFLOW_API UECFTimeLock : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Timelock failed to start. Are you sure the Lock time is greater than 0 and the Exec Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Timelock failed to start. Are you sure the Lock time is greater than 0 and the Exec Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ENHANCEDCODEFLOW_API UECFTimeline : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Timeline failed to start. Are you sure the Ticking time is greater than 0 and Ticking Function are set properly? /n Remember, that BlendExp must be different than zero and StartValue and StopValue must not be the same!"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Timeline failed to start. Are you sure the Ticking time is greater than 0 and Ticking Function are set properly? /n Remember, that BlendExp must be different than zero and StartValue and StopValue must not be the same!"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ENHANCEDCODEFLOW_API UECFTimelineLinearColor: public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Timeline Linear Color failed to start. Are you sure the Ticking time is greater than 0 and Ticking Function are set properly? /n Remember, that BlendExp must be different than zero and StartValue and StopValue must not be the same!"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Timeline Linear Color failed to start. Are you sure the Ticking time is greater than 0 and Ticking Function are set properly? /n Remember, that BlendExp must be different than zero and StartValue and StopValue must not be the same!"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ENHANCEDCODEFLOW_API UECFTimelineVector : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Timeline Vector failed to start. Are you sure the Ticking time is greater than 0 and Ticking Function are set properly? /n Remember, that BlendExp must be different than zero and StartValue and StopValue must not be the same!"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Timeline Vector failed to start. Are you sure the Ticking time is greater than 0 and Ticking Function are set properly? /n Remember, that BlendExp must be different than zero and StartValue and StopValue must not be the same!"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ENHANCEDCODEFLOW_API UECFWaitAndExecute : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Wait and Execute failed to start. Are you sure the Predicate and Function are set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Wait and Execute failed to start. Are you sure the Predicate and Function are set properly?"), *Settings.Label);
#endif
return false;
}
Expand All @@ -82,7 +82,7 @@ class ENHANCEDCODEFLOW_API UECFWaitAndExecute : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Wait and Execute failed to start. Are you sure the Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Wait and Execute failed to start. Are you sure the Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand All @@ -104,7 +104,7 @@ class ENHANCEDCODEFLOW_API UECFWaitAndExecute : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Wait and Execute failed to start. Are you sure the Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Wait and Execute failed to start. Are you sure the Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand All @@ -131,7 +131,7 @@ class ENHANCEDCODEFLOW_API UECFWaitAndExecute : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Wait and Execute failed to start. Are you sure the Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Wait and Execute failed to start. Are you sure the Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand All @@ -153,7 +153,7 @@ class ENHANCEDCODEFLOW_API UECFWaitAndExecute : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Wait and Execute failed to start. Are you sure the Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Wait and Execute failed to start. Are you sure the Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand All @@ -180,7 +180,7 @@ class ENHANCEDCODEFLOW_API UECFWaitAndExecute : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - Wait and Execute failed to start. Are you sure the Function is set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] Wait and Execute failed to start. Are you sure the Function is set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ENHANCEDCODEFLOW_API UECFWhileTrueExecute : public UECFActionBase
else
{
#if ECF_LOGS
UE_LOG(LogECF, Error, TEXT("ECF - While True Execute failed to start. Are you sure the Predicate and Function are set properly?"));
UE_LOG(LogECF, Error, TEXT("ECF - [%s] While True Execute failed to start. Are you sure the Predicate and Function are set properly?"), *Settings.Label);
#endif
return false;
}
Expand Down
24 changes: 14 additions & 10 deletions Source/EnhancedCodeFlow/Public/ECFActionSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@ struct ENHANCEDCODEFLOW_API FECFActionSettings
FirstDelay(0.f),
bIgnorePause(false),
bIgnoreGlobalTimeDilation(false),
bStartPaused(false)
bStartPaused(false),
Label(TEXT(""))
{

}

FECFActionSettings(float InTickInterval, float InFirstDelay = 0.f, bool InIgnorePause = false, bool InIgnoreTimeDilation = false, bool InStartPaused = false) :
FECFActionSettings(float InTickInterval, float InFirstDelay = 0.f, bool InIgnorePause = false, bool InIgnoreTimeDilation = false, bool InStartPaused = false, const FString& InLabel = TEXT("")) :
TickInterval(InTickInterval),
FirstDelay(InFirstDelay),
bIgnorePause(InIgnorePause),
bIgnoreGlobalTimeDilation(InIgnoreTimeDilation),
bStartPaused(InStartPaused)
bStartPaused(InStartPaused),
Label(InLabel)
{

}

UPROPERTY(BlueprintReadWrite, Category = "ECF")
Expand All @@ -44,11 +45,14 @@ struct ENHANCEDCODEFLOW_API FECFActionSettings

UPROPERTY(BlueprintReadWrite, Category = "ECF")
bool bStartPaused = false;

UPROPERTY(BlueprintReadWrite, Category = "ECF")
FString Label;
};

#define ECF_TICKINTERVAL(_Interval) FECFActionSettings(_Interval, 0.f, false, false, false)
#define ECF_DELAYFIRST(_Delay) FECFActionSettings(0.f, _Delay, false, false, false)
#define ECF_IGNOREPAUSE FECFActionSettings(0.f, 0.f, true, false, false)
#define ECF_IGNORETIMEDILATION FECFActionSettings(0.f, 0.f, false, true, false)
#define ECF_IGNOREPAUSEDILATION FECFActionSettings(0.f, 0.f, true, true, false)
#define ECF_STARTPAUSED FECFActionSettings(0.f, 0.f, false, false, true)
#define ECF_TICKINTERVAL(_Interval) FECFActionSettings(_Interval, 0.f, false, false, false, TEXT(""))
#define ECF_DELAYFIRST(_Delay) FECFActionSettings(0.f, _Delay, false, false, false, TEXT(""))
#define ECF_IGNOREPAUSE FECFActionSettings(0.f, 0.f, true, false, false, TEXT(""))
#define ECF_IGNORETIMEDILATION FECFActionSettings(0.f, 0.f, false, true, false, TEXT(""))
#define ECF_IGNOREPAUSEDILATION FECFActionSettings(0.f, 0.f, true, true, false, TEXT(""))
#define ECF_STARTPAUSED FECFActionSettings(0.f, 0.f, false, false, true, TEXT(""))
4 changes: 4 additions & 0 deletions Source/EnhancedCodeFlow/Public/ECFSubsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ class ENHANCEDCODEFLOW_API UECFSubsystem : public UGameInstanceSubsystem, public
// Try to find running or pending action.
UECFActionBase* FindAction(const FECFHandle& HandleId) const;


// Finds the first running or pending action with the given Label and returns its FECFHandle. Returns invalid handle if not found.
FECFHandle FindActionByLabel(const FString& Label) const;

// Check if the action is running or pending to run.
bool HasAction(const FECFHandle& HandleId) const;

Expand Down