Skip to content

Commit

Permalink
Merge branch 'p4/tq2-code' into ue5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jreich-grimloregames committed Mar 3, 2024
2 parents ac87f48 + 37a53c5 commit 04cff89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/OUURuntime/Public/GameplayTags/TypedGameplayTag.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ struct TTypedGameplayTag
TIsDerivedFrom<BlueprintTagType, FGameplayTag>::Value,
"BlueprintStructType must be derived from FGameplayTag");

// I did not find a cross-compiler way to implement this check yet, but if all the tag usage is fine with
// Windows / MSVC, it should also be ok on other platforms.
#if PLATFORM_WINDOWS
static_assert(
TOr<TIsChildTagOf<ParamTagType, InRootLiteralTagTypes>...>::Value,
"Can only assign from a literal gameplay tag that is nested under any of the InRootLiteralTagTypes");
#endif

return true;
}
Expand Down
14 changes: 14 additions & 0 deletions Source/OUURuntime/Public/Templates/InterfaceUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "Templates/Casts.h"
#include "UObject/ScriptInterface.h"
#include "UObject/WeakInterfacePtr.h"

/**
* Call a function on a blueprint implementable interface object.
Expand Down Expand Up @@ -86,6 +87,13 @@ UObject* GetInterfaceObject(TScriptInterface<T> InterfaceObject)
return InterfaceObject.GetObject();
}

/** Get the underlying object from an interface so you can call Execute_* functions on it */
template <typename T, typename = TIsIInterface_T<T>>
UObject* GetInterfaceObject(TWeakInterfacePtr<T> InterfaceObject)
{
return InterfaceObject.GetObject();
}

/**
* Validate an interface object based on it's underlying UObject, extending IsValid(UObject*) functionality.
* Also checks if the object actually implements the target interface.
Expand Down Expand Up @@ -122,6 +130,12 @@ FORCEINLINE bool IsValidInterface(TScriptInterface<T>& InterfaceObject)
return bResult;
}

template <typename T, typename = TIsIInterface_T<T>>
FORCEINLINE bool IsValidInterface(const TWeakInterfacePtr<T>& InterfaceObject)
{
return InterfaceObject.IsValid();
}

/** Override to throw compile time error for using const TScriptInterface<T> or const TScriptInterface<T>& */
template <typename T, typename = TIsIInterface_T<T>>
FORCEINLINE bool IsValidInterface(const TScriptInterface<T>& InterfaceObject)
Expand Down

0 comments on commit 04cff89

Please sign in to comment.