Added extra execution outputs to "Get Steam Avatar" node

Added in CriErrUA's pull request for equivilant nodes for uniquenetids and then optimized it.


Former-commit-id: 224fcd8a032efaa49f4288837ab1173823cb51f4
This commit is contained in:
mordentral
2017-01-30 10:03:40 -05:00
parent 8da33b1d8d
commit db2ab652b4
16 changed files with 25 additions and 39 deletions

View File

@@ -1 +0,0 @@
74159387ae4c0dfa551782c1a573d879e76e7c94

View File

@@ -1 +0,0 @@
e9c0072ee5f48736c5b6cb9d80f1d42378271f15

View File

@@ -1 +0,0 @@
ae6509d9c9a5a5b53e37150891505d9cebbc4071

View File

@@ -1 +0,0 @@
23b76fcc5841b5a13d093c31596b816e921eb107

View File

@@ -1 +0,0 @@
1f54a896a8f905d9794a64b999ee51afdcf6bdd4

View File

@@ -1 +0,0 @@
23dbc3bb8dea26aeb165cdc493930866032ed598

View File

@@ -1 +0,0 @@
205342f06ff0dfeee1431d6af7534a2d20c9f38f

View File

@@ -1 +0,0 @@
3396b004f2ab8bd88779046049c8cfe099e3a6b9

View File

@@ -1,8 +0,0 @@
{
"Changelist" : 3142249,
"BuildId" : "4ef07da3-e88a-4906-9396-c2b96c225a4a",
"Modules" :
{
"AdvancedSessions" : "UE4Editor-AdvancedSessions-Win64-DebugGame.dll"
}
}

View File

@@ -1,8 +0,0 @@
{
"Changelist" : 3142249,
"BuildId" : "4870daf4-0b02-459b-9258-609d8c5a2c4b",
"Modules" :
{
"AdvancedSessions" : "UE4Editor-AdvancedSessions.dll"
}
}

View File

@@ -62,8 +62,8 @@ public:
static void IsAFriend(APlayerController *PlayerController, const FBPUniqueNetId UniqueNetId, bool &IsFriend); static void IsAFriend(APlayerController *PlayerController, const FBPUniqueNetId UniqueNetId, bool &IsFriend);
// Get a texture of a valid friends avatar, STEAM ONLY, Returns invalid texture if the subsystem hasn't loaded that size of avatar yet // Get a texture of a valid friends avatar, STEAM ONLY, Returns invalid texture if the subsystem hasn't loaded that size of avatar yet
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI") UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI", meta = (ExpandEnumAsExecs = "Result"))
static UTexture2D * GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, SteamAvatarSize AvatarSize = SteamAvatarSize::SteamAvatar_Medium); static UTexture2D * GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize = SteamAvatarSize::SteamAvatar_Medium);
// Preloads the avatar and name of a steam friend, return whether it is already available or not, STEAM ONLY, Takes time to actually load everything after this is called. // Preloads the avatar and name of a steam friend, return whether it is already available or not, STEAM ONLY, Takes time to actually load everything after this is called.
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI") UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")

View File

@@ -82,6 +82,19 @@ enum class EBlueprintResultSwitch : uint8
OnFailure OnFailure
}; };
// This makes a lot of the blueprint functions cleaner
UENUM()
enum class EBlueprintAsyncResultSwitch : uint8
{
// On Success
OnSuccess,
// Still loading
AsyncLoading,
// On Failure
OnFailure
};
// This is to define server type searches // This is to define server type searches
UENUM(BlueprintType) UENUM(BlueprintType)
enum class EBPServerPresenceSearchType : uint8 enum class EBPServerPresenceSearchType : uint8

View File

@@ -76,12 +76,13 @@ bool UAdvancedFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId Unique
return false; return false;
} }
UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, SteamAvatarSize AvatarSize) UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize)
{ {
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid()) if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
{ {
UE_LOG(AdvancedFriendsLog, Warning, TEXT("GetSteamFriendAvatar Had a bad UniqueNetId!")); UE_LOG(AdvancedFriendsLog, Warning, TEXT("GetSteamFriendAvatar Had a bad UniqueNetId!"));
Result = EBlueprintAsyncResultSwitch::OnFailure;
return nullptr; return nullptr;
} }
@@ -106,7 +107,10 @@ UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId
} }
if (Picture == -1) if (Picture == -1)
{
Result = EBlueprintAsyncResultSwitch::AsyncLoading;
return NULL; return NULL;
}
SteamUtils()->GetImageSize(Picture, &Width, &Height); SteamUtils()->GetImageSize(Picture, &Width, &Height);
@@ -150,6 +154,7 @@ UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId
Avatar->UpdateResource(); Avatar->UpdateResource();
Result = EBlueprintAsyncResultSwitch::OnSuccess;
return Avatar; return Avatar;
} }
else else
@@ -157,11 +162,13 @@ UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId
UE_LOG(AdvancedFriendsLog, Warning, TEXT("Bad Height / Width with steam avatar!")); UE_LOG(AdvancedFriendsLog, Warning, TEXT("Bad Height / Width with steam avatar!"));
} }
Result = EBlueprintAsyncResultSwitch::OnFailure;
return nullptr; return nullptr;
} }
#endif #endif
UE_LOG(AdvancedFriendsLog, Warning, TEXT("STEAM Couldn't be verified as initialized")); UE_LOG(AdvancedFriendsLog, Warning, TEXT("STEAM Couldn't be verified as initialized"));
Result = EBlueprintAsyncResultSwitch::OnFailure;
return nullptr; return nullptr;
} }

View File

@@ -361,7 +361,6 @@ void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *Playe
return; return;
} }
bool UAdvancedSessionsLibrary::IsValidUniqueNetID(const FBPUniqueNetId &UniqueNetId) bool UAdvancedSessionsLibrary::IsValidUniqueNetID(const FBPUniqueNetId &UniqueNetId)
{ {
return UniqueNetId.IsValid(); return UniqueNetId.IsValid();
@@ -369,17 +368,8 @@ bool UAdvancedSessionsLibrary::IsValidUniqueNetID(const FBPUniqueNetId &UniqueNe
bool UAdvancedSessionsLibrary::EqualEqual_UNetIDUnetID(const FBPUniqueNetId &A, const FBPUniqueNetId &B) bool UAdvancedSessionsLibrary::EqualEqual_UNetIDUnetID(const FBPUniqueNetId &A, const FBPUniqueNetId &B)
{ {
if (A.IsValid() && B.IsValid()) return ((A.IsValid() && B.IsValid()) && (*A.GetUniqueNetId() == *B.GetUniqueNetId()));
{
return (A.GetUniqueNetId()->GetSize() == B.GetUniqueNetId()->GetSize()) &&
(FMemory::Memcmp(A.GetUniqueNetId()->GetBytes(), B.GetUniqueNetId()->GetBytes(), A.GetUniqueNetId()->GetSize()) == 0);
} }
else
{
return false;
}
}
void UAdvancedSessionsLibrary::SetPlayerName(APlayerController *PlayerController, FString PlayerName) void UAdvancedSessionsLibrary::SetPlayerName(APlayerController *PlayerController, FString PlayerName)
{ {