33 lines
819 B
C++
33 lines
819 B
C++
// OpenAI, Copyright LifeEXE. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Kismet/BlueprintAsyncActionBase.h"
|
|
#include "HTTP.h"
|
|
#include "DownloadImageAction.generated.h"
|
|
|
|
class UTexture2DDynamic;
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnDownloadImage, UTexture2D*, Texture);
|
|
|
|
UCLASS()
|
|
class UDownloadImageAction : public UBlueprintAsyncActionBase
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(BlueprintAssignable)
|
|
FOnDownloadImage OnCompleted;
|
|
|
|
virtual void Activate() override;
|
|
|
|
private:
|
|
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "OpenAI | Utils")
|
|
static UDownloadImageAction* DownloadImage(const FString& URL);
|
|
|
|
void HandleImageRequest(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded);
|
|
|
|
private:
|
|
FString URL{};
|
|
};
|