UnrealBuildTool的模块描述信息ModuleDescriptor-Unreal4 ...
Unreal4源码拆解-UnrealBuildTool功能流程解析-ModuleDescriptor[*]引擎版本4.27
[*]4.2x功能不会差太多
主要功能
概括
[*]ModuleDescriptor类,如其命名,模块描述信息。
[*]功能上大致是以JSON的方式读取和更新 .uplugin文件 。
[*]具体设计上类内变量名和JSON中项名相同。注意:可读可写
.uplugin文件
首先.uplugin文件文件是JSON文件,在每个插件的主文件夹中描述插件信息的文件。举例: Engine\Plugins\Animation\LiveLinkCurveDebugUI\ LiveLinkCurveDebugUI.uplugin
{
//PluginDescriptor描述区域
"FileVersion": 3,
"Version": 1,
"VersionName": "0.1",
"FriendlyName": "Live Link Curve Debug UI",
"Description": "Allows Viewing LiveLink Curve Debug Information",
"Category": "Animation",
"CreatedBy": "Epic Games, Inc.",
"CreatedByURL": "http://epicgames.com",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"EnabledByDefault": false,
"CanContainContent": false,
"IsBetaVersion": true,
//ModuleDescriptor描述区域
"Modules": [
{
"Name": "LiveLinkCurveDebugUI",
"Type": "Runtime",
"LoadingPhase": "PreDefault"
}
],
//ModuleDescriptor描述区域
//PluginReferenceDescriptor描述区域
"Plugins": [
{
"Name": "LiveLink",
"Enabled": true
}
]
//PluginReferenceDescriptor描述区域
//PluginDescriptor描述区域
}枚举
enum ModuleHostType
[*]主要功能:表示模块运行的主机类型
public enum ModuleHostType
{
/// <summary>
///
/// </summary>
Default,
/// <summary>
/// Any target using the UE4 runtime
/// </summary>
Runtime,
/// <summary>
/// Any target except for commandlet
/// </summary>
RuntimeNoCommandlet,
/// <summary>
/// Any target or program
/// </summary>
RuntimeAndProgram,
/// <summary>
/// Loaded only in cooked builds
/// </summary>
CookedOnly,
/// <summary>
/// Loaded only in uncooked builds
/// </summary>
UncookedOnly,
/// <summary>
/// Loaded only when the engine has support for developer tools enabled
/// </summary>
Developer,
/// <summary>
/// Loads on any targets where bBuildDeveloperTools is enabled
/// </summary>
DeveloperTool,
/// <summary>
/// Loaded only by the editor
/// </summary>
Editor,
/// <summary>
/// Loaded only by the editor, except when running commandlets
/// </summary>
EditorNoCommandlet,
/// <summary>
/// Loaded by the editor or program targets
/// </summary>
EditorAndProgram,
/// <summary>
/// Loaded only by programs
/// </summary>
Program,
/// <summary>
/// Loaded only by servers
/// </summary>
ServerOnly,
/// <summary>
/// Loaded only by clients, and commandlets, and editor....
/// </summary>
ClientOnly,
/// <summary>
/// Loaded only by clients and editor (editor can run PIE which is kinda a commandlet)
/// </summary>
ClientOnlyNoCommandlet,
}
enum ModuleLoadingPhase
[*]主要功能:表示模块加载时机
public enum ModuleLoadingPhase
{
/// <summary>
/// Loaded at the default loading point during startup (during engine init, after game modules are loaded.)
/// </summary>
Default,
/// <summary>
/// Right after the default phase
/// </summary>
PostDefault,
/// <summary>
/// Right before the default phase
/// </summary>
PreDefault,
/// <summary>
/// Loaded as soon as plugins can possibly be loaded (need GConfig)
/// </summary>
EarliestPossible,
/// <summary>
/// Loaded before the engine is fully initialized, immediately after the config system has been initialized.Necessary only for very low-level hooks
/// </summary>
PostConfigInit,
/// <summary>
/// The first screen to be rendered after system splash screen
/// </summary>
PostSplashScreen,
/// <summary>
/// After PostConfigInit and before coreUobject initialized. used for early boot loading screens before the uobjects are initialized
/// </summary>
PreEarlyLoadingScreen,
/// <summary>
/// Loaded before the engine is fully initialized for modules that need to hook into the loading screen before it triggers
/// </summary>
PreLoadingScreen,
/// <summary>
/// After the engine has been initialized
/// </summary>
PostEngineInit,
/// <summary>
/// Do not automatically load this module
/// </summary>
None,
}
主要成员变量
public readonly string Name;
[*]主要功能:表示模块名称
public ModuleHostType Type;
[*]主要功能:表示模块使用的主机类型
public ModuleLoadingPhase LoadingPhase = ModuleLoadingPhase.Default;
[*]主要功能:表示模块加载阶段
public List WhitelistPlatforms;
[*]主要功能:表示模块支持的白名单平台
public List BlacklistPlatforms;
[*]主要功能:表示模块支持的黑名单平台
public TargetType[] WhitelistTargets;
[*]主要功能:表示模块支持的白名单目标类型
public TargetType[] BlacklistTargets;
[*]主要功能:表示模块支持的黑名单目标类型
public enum TargetType
{
/// <summary>
/// Cooked monolithic game executable (GameName.exe).Also used for a game-agnostic engine executable (UE4Game.exe or RocketGame.exe)
/// </summary>
Game,
/// <summary>
/// Uncooked modular editor executable and DLLs (UE4Editor.exe, UE4Editor*.dll, GameName*.dll)
/// </summary>
Editor,
/// <summary>
/// Cooked monolithic game client executable (GameNameClient.exe, but no server code)
/// </summary>
Client,
/// <summary>
/// Cooked monolithic game server executable (GameNameServer.exe, but no client code)
/// </summary>
Server,
/// <summary>
/// Program (standalone program, e.g. ShaderCompileWorker.exe, can be modular or monolithic depending on the program)
/// </summary>
Program,
}
public UnrealTargetConfiguration[] WhitelistTargetConfigurations;
[*]主要功能:表示模块支持的白名单目标配置类型
public UnrealTargetConfiguration[] BlacklistTargetConfigurations;
[*]主要功能:表示模块支持的黑名单目标配置类型
public string[] WhitelistPrograms;
[*]主要功能:表示模块依赖的白名单程序
public string[] BlacklistPrograms;
[*]主要功能:表示模块依赖的黑名单程序
public string[] AdditionalDependencies;
[*]主要功能:传入JSON对象,解析每一个条目并设置到同名变量中
主要成员函数
public static ModuleDescriptor FromJsonObject(JsonObject InObject)
[*]主要功能:传入文件,新建并且返回一个PluginDescriptor对象
void Write(JsonWriter Writer)
[*]主要功能:更新信息到Json中。
public static void WriteArray(JsonWriter Writer, string Name, ModuleDescriptor[] Modules)
[*]主要功能:同时更新多个ModuleDescriptor信息到其对应的Json中。
public void Validate(FileReference File)
[*]Tip: 传入参数没有用,只是报错信息
[*]主要功能:模块可以加载的目标程序类型是Developer则报错不支持,ModuleHostType.Developer在4.24及以后被弃用了
public bool IsCompiledInConfiguration(UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string TargetName, TargetType TargetType, bool bBuildDeveloperTools, bool bBuildRequiresCookedData)
[*]决定当前给定的插件模块是否在本次build中被编译
页:
[1]