前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ue4安装插件_ue4 软引用

ue4安装插件_ue4 软引用

作者头像
全栈程序员站长
发布2022-11-09 17:34:26
5820
发布2022-11-09 17:34:26
举报

原创文章,转载请注明出处。

本文介绍 两个知识点Plugin/Module 插件和模块的联系区别,同时介绍插件和我们的Source中创建多模块。

**

一、Plugin/Module 插件和模块的联系区别

** 1> 一个插件至少有一个模块 2>一般插件都是做底层做通用设计的,而模块做的负责的我理解为逻辑

代码语言:javascript
复制
ProjectName.Build.cs		//主要管理的是链接, dll的链接
ProjectName.Target.cs		//管理的是编译,加上才会编译你的Module, 如果你是runtime模块,放到这里
ProjectName.Editor.Target.cs	//管理的是编译,加上才会编译你的Module, 如果你的是editor模块,那么好,放这里

关于.Build.cs中的一些介绍

代码语言:javascript
复制
PublicDependencyModuleNames.AddRange(new string[] { 
    "Core", "CoreUObject", "Engine", "InputCore" });

PrivateDependencyModuleNames.AddRange(new string[] { 
     });
代码语言:javascript
复制
PublicDependencyModuleNames 里面的所有模块都会被引用该模块的模块所继承使用,你就理解成public
PrivateDependencyModuleNames 与上面相反了,按private理解

二、在Plugin中创建多模块以及在我们的Source中创建多模块

1>我的SelectDialog插件,放置三个模块。如下图

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2>在你的Plugin中加上你的模块引用,如下图

在这里插入图片描述
在这里插入图片描述

3>加上模块中的 StartupModule和ShutdownModule可以在模块初始化和模块卸载时增加你的业务逻辑,如下图

头文件.h

代码语言:javascript
复制
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "ISlateFileDialogModuleEx.h"
class FSlateFileDialogsStyle;
class FSlateFileDialogsModule : public ISlateFileDialogsModule
{ 

public:
// IModuleInterface interface
virtual void StartupModule() override;
virtual void ShutdownModule() override;
public:
//ISlateFileDialogModule interface
bool OpenFileDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath,
const FString& DefaultFile, const FString& FileTypes, uint32 Flags, TArray<FString>& OutFilenames, int32& OutFilterIndex);
bool OpenFileDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath,
const FString& DefaultFile, const FString& FileTypes, uint32 Flags, TArray<FString>& OutFilenames);
bool OpenDirectoryDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath,
FString& OutFoldername);
bool SaveFileDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath,
const FString& DefaultFile, const FString& FileTypes, uint32 Flags, TArray<FString>& OutFilenames);
ISlateFileDialogsModule* Get();
FSlateFileDialogsStyle *GetFileDialogsStyle() { 
 return FileDialogStyle; }
private:
ISlateFileDialogsModule *SlateFileDialog;
FSlateFileDialogsStyle	*FileDialogStyle;
};

实现.cpp

代码语言:javascript
复制
// Copyright Epic Games, Inc. All Rights Reserved.
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
#include "SlateFileDialogsEx.h"
#include "SlateFileDialogsStylesEx.h"
#include "SlateFileDlgWindowEx.h"
void FSlateFileDialogsModule::StartupModule()
{ 

SlateFileDialog = new FSlateFileDialogsModule();
FileDialogStyle = new FSlateFileDialogsStyle;
FileDialogStyle->Initialize();
}
void FSlateFileDialogsModule::ShutdownModule()
{ 

if (SlateFileDialog != NULL)
{ 

FileDialogStyle->Shutdown();
delete FileDialogStyle;
delete SlateFileDialog;
SlateFileDialog = NULL;
}
}
bool FSlateFileDialogsModule::OpenFileDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath,
const FString& DefaultFile, const FString& FileTypes, uint32 Flags, TArray<FString>& OutFilenames, int32& OutFilterIndex)
{ 

FSlateFileDlgWindow dialog(FileDialogStyle);
return dialog.OpenFileDialog(ParentWindowHandle, DialogTitle, DefaultPath, DefaultFile, FileTypes, Flags, OutFilenames, OutFilterIndex);
}
bool FSlateFileDialogsModule::OpenFileDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath,
const FString& DefaultFile, const FString& FileTypes, uint32 Flags, TArray<FString>& OutFilenames)
{ 

FSlateFileDlgWindow dialog(FileDialogStyle);
return dialog.OpenFileDialog(ParentWindowHandle, DialogTitle, DefaultPath, DefaultFile, FileTypes, Flags, OutFilenames);
}
bool FSlateFileDialogsModule::OpenDirectoryDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath,
FString& OutFoldername)
{ 

FSlateFileDlgWindow dialog(FileDialogStyle);
return dialog.OpenDirectoryDialog(ParentWindowHandle, DialogTitle, DefaultPath, OutFoldername);
}
bool FSlateFileDialogsModule::SaveFileDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath,
const FString& DefaultFile, const FString& FileTypes, uint32 Flags, TArray<FString>& OutFilenames)
{ 

FSlateFileDlgWindow dialog(FileDialogStyle);
return dialog.SaveFileDialog(ParentWindowHandle, DialogTitle, DefaultPath, DefaultFile, FileTypes, Flags, OutFilenames);
}
ISlateFileDialogsModule* FSlateFileDialogsModule::Get()
{ 

return SlateFileDialog;
}
IMPLEMENT_MODULE(FSlateFileDialogsModule, SlateFileDialogsEx);

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/186104.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022年10月4日 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 本文介绍 两个知识点Plugin/Module 插件和模块的联系区别,同时介绍插件和我们的Source中创建多模块。
  • 一、Plugin/Module 插件和模块的联系区别
  • 二、在Plugin中创建多模块以及在我们的Source中创建多模块
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档