为笔记用来做一点补充
原文中插件怎么用第二步替换完模块名称以后
#include "MyBlueprintFunctionLibrary.h"
#include "DesktopPlatformEx/Public/IDesktopPlatformEx.h"
#include "DesktopPlatformEx/Public/DesktopPlatformModuleEx.h"
bool UMyBlueprintFunctionLibrary::OpenWindowsMovie(TArray<FString>& FilePath)
{
FString ExtensionStr = ".";
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModuleEx::Get();
bool bOpen = DesktopPlatform->OpenFileDialog(nullptr, TEXT("选择文件"),FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()), TEXT(""), *ExtensionStr,EFileDialogFlags::None, FilePath);
if (!bOpen)
{
return false;
}
else
{
return true;
}
return false;
}
要包含修改过名称的头文件
#include "DesktopPlatformEx/Public/IDesktopPlatformEx.h" #include "DesktopPlatformEx/Public/DesktopPlatformModuleEx.h"
然后如原文一样将FDesktopPlatformModule::Get()替换成FDesktopPlatformModuleEx::Get()即可编译成功
最后贴一下.h和.Build.cs
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "MyBlueprintFunctionLibrary.generated.h"
/**
*
*/
UCLASS()
class OPENVIDEOTEST2_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
static bool OpenWindowsMovie(TArray<FString>& FilePath);
};
using UnrealBuildTool;
public class OpenVideoTest2 : ModuleRules
{
public OpenVideoTest2(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore","DesktopPlatformEx" });
PrivateDependencyModuleNames.AddRange(new string[] { });
|