UE功能性插件

---打开资源管理器

UCLASS()
class OPENWINDOWSFILE_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "OpenWindowsFile")
static TArray<FString> OpenWindowsFiles();
};

#include "MyBlueprintFunctionLibrary.h"
#include "Runtime\Core\Public\Misc\FileHelper.h"
#include "Runtime\Core\Public\Misc\Paths.h"
#include "Developer\DesktopPlatform\Public\IDesktopPlatform.h"
#include "Developer\DesktopPlatform\Public\DesktopPlatformModule.h"

TArray<FString> UMyBlueprintFunctionLibrary::OpenWindowsFiles() {
TArray<FString> OpenFileNames;//获取的文件绝对路径
FString ExtensionStr=TEXT("*.*");//文件类型

IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
DesktopPlatform->OpenFileDialog(nullptr, TEXT("ywy文件管理器"), FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()), TEXT(""), *ExtensionStr, EFileDialogFlags::None, OpenFileNames);
return OpenFileNames;
}

posted @ 2023-10-16 15:04  蜡笔小新紫南  阅读(27)  评论(0编辑  收藏  举报