Skip to content

Commit

Permalink
2.0.1 backports
Browse files Browse the repository at this point in the history
  • Loading branch information
landelare committed Nov 12, 2024
1 parent 9d88def commit 72e28d9
Show file tree
Hide file tree
Showing 29 changed files with 93 additions and 50 deletions.
8 changes: 6 additions & 2 deletions Docs/GAS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ abilities using a C++ coroutine.
Instead of overriding ActivateAbility, override the new ExecuteAbility instead.
**Overriding ExecuteAbility with a subroutine is undefined behavior.**

Every instancing policy is supported, including it dynamically changing at
runtime.
Every instancing policy is supported on Unreal Engine 5.3 and 5.4, including it
dynamically changing at runtime.

Starting with 5.5, NonInstanced is not supported.
Using the `AbilitySystem.Fix.AllowNonInstancedAbilities` CVar to get it back is
possible, but not recommended due to engine issues.

The following events are turned into interactions with the ExecuteAbility
coroutine:
Expand Down
13 changes: 11 additions & 2 deletions Plugins/UE5Coro/Source/UE5Coro/Public/UE5Coro/CoroutinePrivate.inl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#pragma once

#include "Misc/EngineVersionComparison.h"
#include "UObject/GCObjectScopeGuard.h"

namespace UE5Coro::Private
Expand All @@ -45,14 +46,22 @@ struct TWeak : std::false_type { };
template<typename T>
struct TWeak<T*> : std::bool_constant<std::is_convertible_v<T*, const UObject*>>
{
using strong = TGCObjectScopeGuard<T>;
#if UE_VERSION_OLDER_THAN(5, 5, 0)
using strong = TGCObjectScopeGuard<std::remove_pointer_t<T>>;
#else
using strong = TStrongObjectPtr<std::remove_pointer_t<T>>;
#endif
using weak = TWeakObjectPtr<T>;
using ptr = std::enable_if_t<TWeak::value, T*>;
static strong Strengthen(const weak& Weak)
{
#if UE_VERSION_OLDER_THAN(5, 5, 0)
FGCScopeGuard _;
// There's no API to convert a weak ptr to a strong one...
return strong(Weak.Get()); // relying on C++17 mandatory RVO
return strong(Weak.Get());
#else
return Weak.Pin();
#endif
}
static ptr Get(const strong& Strong) { return Strong.Get(); }
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "BlueprintActionDatabaseRegistrar.h"
#include "BlueprintNodeSpawner.h"
#include "EdGraphSchema_K2.h"
#include "Misc/EngineVersionComparison.h"
#include "UE5Coro/AsyncCoroutine.h"
#include "UObject/Class.h"
#include "UObject/Field.h"
Expand All @@ -41,6 +42,12 @@

#define LOCTEXT_NAMESPACE "UE5Coro"

#if UE_VERSION_OLDER_THAN(5, 5, 0)
using ObjectTools = UK2Node_CallFunction;
#else
#include "ObjectTools.h"
#endif

void UK2Node_UE5CoroCallCoroutine::CustomizeNode(UEdGraphNode* NewNode, bool,
UFunction* Function)
{
Expand Down Expand Up @@ -74,7 +81,8 @@ void UK2Node_UE5CoroCallCoroutine::GetMenuActions(
Menu.Category = GetDefaultCategoryForFunction(Fn, FText::GetEmpty());
if (Menu.Category.IsEmpty())
Menu.Category = LOCTEXT("CallCoroutine", "Call Coroutine");
Menu.Tooltip = FText::FromString(GetDefaultTooltipForFunction(Fn));
Menu.Tooltip = FText::FromString(
ObjectTools::GetDefaultTooltipForFunction(Fn));
Menu.Keywords = GetKeywordsForFunction(Fn);
Menu.Icon = GetIconAndTint(Menu.IconTint);
Menu.DocLink = GetDocumentationLink();
Expand Down
1 change: 1 addition & 0 deletions Plugins/UE5Coro/Source/UE5CoroK2/UE5CoroK2.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public UE5CoroK2(ReadOnlyTargetRules Target)
{
"BlueprintGraph",
"UE5Coro",
"UnrealEd",
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ using namespace UE5Coro;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAggregateAsyncTest, "UE5Coro.Aggregate.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAggregateLatentTest, "UE5Coro.Aggregate.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ using namespace UE5Coro::Private;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAsyncAwaiterTest, "UE5Coro.Async.TrueAsync",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAsyncInLatentTest, "UE5Coro.Async.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAsyncStressTest, "UE5Coro.Async.Stress",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::MediumPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
4 changes: 2 additions & 2 deletions Plugins/UE5Coro/Source/UE5CoroTests/Private/AsyncLoadTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ using namespace UE5Coro;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAsyncLoadTestLatent, "UE5Coro.AsyncLoad.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAsyncLoadTestAsync, "UE5Coro.AsyncLoad.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ using namespace UE5Coro::Private;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAsyncQueryTestAsync, "UE5Coro.AsyncQuery.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAsyncQueryTestLatent, "UE5Coro.AsyncQuery.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ using namespace UE5Coro;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FEventAsyncTest, "UE5Coro.Threading.Event.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::CriticalPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FEventLatentTest, "UE5Coro.Threading.Event.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::CriticalPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ using namespace UE5Coro;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FSemaAsyncTest, "UE5Coro.Threading.Semaphore.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::CriticalPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FSemaLatentTest, "UE5Coro.Threading.Semaphore.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::CriticalPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ using namespace UE5Coro::Private;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FCancelTestAsync, "UE5Coro.Cancel.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FCancelTestLatent, "UE5Coro.Cancel.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ using namespace UE5Coro::Private;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FHandleTestAsync, "UE5Coro.Handle.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FHandleTestLatent, "UE5Coro.Handle.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ using namespace UE5Coro::Private;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FDelegateTestCore, "UE5Coro.Delegate.Core",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::CriticalPriority |
EAutomationTestFlags::SmokeFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FDelegateTestAsync, "UE5Coro.Delegate.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FDelegateTestLatent, "UE5Coro.Delegate.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ using namespace UE5Coro::Private::Test;
#if !PLATFORM_EXCEPTIONS_DISABLED

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FExceptionTest, "UE5Coro.Exceptions",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
4 changes: 2 additions & 2 deletions Plugins/UE5Coro/Source/UE5CoroTests/Private/FutureTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ using namespace UE5Coro::Private;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FFutureAsync, "UE5Coro.Future.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FFutureLatent, "UE5Coro.Future.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "TestWorld.h"
#include "Misc/AutomationTest.h"
#include "UE5Coro/Generator.h"

using namespace UE5Coro;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FGeneratorTest, "UE5Coro.Generator",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::CriticalPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ using namespace UE5Coro;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FHttpAsyncTest, "UE5Coro.Http.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FHttpLatentTest, "UE5Coro.Http.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ using namespace UE5Coro;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FLatentAwaiterTest, "UE5Coro.Latent.TrueLatent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FLatentInAsyncTest, "UE5Coro.Latent.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ using namespace UE5Coro;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FLatentCallbackTest, "UE5Coro.Latent.Callbacks",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ using namespace UE5Coro::Private;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAsyncChainCancelTest, "UE5Coro.Chain.Cancel.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FLatentChainCancelTest, "UE5Coro.Chain.Cancel.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ using namespace UE5Coro;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAsyncChainTest, "UE5Coro.Chain.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FLatentChainTest, "UE5Coro.Chain.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ using namespace UE5Coro::Private;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FLatentReturnTest, "UE5Coro.Return.Latent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FAsyncReturnTest, "UE5Coro.Return.Async",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
8 changes: 4 additions & 4 deletions Plugins/UE5Coro/Source/UE5CoroTests/Private/TaskTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ using namespace UE5Coro;
using namespace UE5Coro::Private::Test;

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FTaskCreateAsync, "UE5Coro.Tasks.CreateAsync",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FTaskCreateLatent, "UE5Coro.Tasks.CreateLatent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FTaskConsumeAsync, "UE5Coro.Tasks.ConsumeAsync",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FTaskConsumeLatent, "UE5Coro.Tasks.ConsumeLatent",
EAutomationTestFlags::ApplicationContextMask |
EAutomationTestFlags_ApplicationContextMask |
EAutomationTestFlags::HighPriority |
EAutomationTestFlags::ProductFilter)

Expand Down
Loading

0 comments on commit 72e28d9

Please sign in to comment.