UnrealBuildTool的引用插件描述信息类PluginReferenceDescriptor-Unreal4源码拆解-UnrealBuildTool功能流程解析
Unreal4源码拆解-UnrealBuildTool功能流程解析-PluginReferenceDescriptor[*]引擎版本4.27
[*]4.2x功能不会差太多
主要功能
概括
[*]PluginReferenceDescriptor类,如其定名,引用插件的描述信息。
[*]功能上大致是以JSON的方式读取和更新 .uplugin文件 的部门内容。
[*]具体设计上类内变量名和JSON中项名不异。
[*]描述内容为
”Plugins”: [
{
”Name”: ”LiveLink”,
”Enabled”: true
}
]
[*]与PluginDescriptor的区别在于负责描述的东西分歧。 可以看个例子 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描述区域
}主要函数功能
大部门相对简单,就是判断各种条件,直接放源代码了。
public void Write(JsonWriter Writer)
[*]把实例中内容写到 Json 中
public static void WriteArray(JsonWriter Writer, string Name, PluginReferenceDescriptor[] Plugins)
[*]输入一堆插件引用信息,从 Name 开始写到 JSON 中
public static PluginReferenceDescriptor FromJsonObject(JsonObject RawObject)
[*]从 Json对象 中读取变量内容
public bool IsEnabledForPlatform(UnrealTargetPlatform Platform)
[*]判断是否在指定方针平台上启用
public bool IsEnabledForPlatform(UnrealTargetPlatform Platform)
{
if (!bEnabled)
{
return false;
}
if (WhitelistPlatforms != null && WhitelistPlatforms.Count > 0 && !WhitelistPlatforms.Contains(Platform))
{
return false;
}
if (BlacklistPlatforms != null && BlacklistPlatforms.Contains(Platform))
{
return false;
}
return true;
}public bool IsEnabledForTargetConfiguration(UnrealTargetConfiguration TargetConfiguration)
[*]判断是否在指定方针配置启用
public bool IsEnabledForTargetConfiguration(UnrealTargetConfiguration TargetConfiguration)
{
if (!bEnabled)
{
return false;
}
if (WhitelistTargetConfigurations != null && WhitelistTargetConfigurations.Length > 0 && !WhitelistTargetConfigurations.Contains(TargetConfiguration))
{
return false;
}
if (BlacklistTargetConfigurations != null && BlacklistTargetConfigurations.Contains(TargetConfiguration))
{
return false;
}
return true;
}public bool IsEnabledForTarget(TargetType Target)
[*]判断是否在指定方针类型启用
public bool IsEnabledForTarget(TargetType Target)
{
if (!bEnabled)
{
return false;
}
if (WhitelistTargets != null && WhitelistTargets.Length > 0 && !WhitelistTargets.Contains(Target))
{
return false;
}
if (BlacklistTargets != null && BlacklistTargets.Contains(Target))
{
return false;
}
return true;
}public bool IsSupportedTargetPlatform(UnrealTargetPlatform Platform)
[*]判断是否撑持方针平台
public bool IsSupportedTargetPlatform(UnrealTargetPlatform Platform)
{
return SupportedTargetPlatforms == null || SupportedTargetPlatforms.Count == 0 || SupportedTargetPlatforms.Contains(Platform);
}成员变量内容
public string Name;
[*]主要功能:暗示插件名称
public bool bEnabled;
[*]主要功能:暗示是否启用
public bool bOptional;
[*]主要功能:暗示是否是可选的
public string Description;
[*]主要功能:暗示描述
public string MarketplaceURL;
[*]主要功能:暗示商店的URL
public List WhitelistPlatforms;
[*]主要功能:暗示白名单方针平台
public List BlacklistPlatforms;
[*]主要功能:暗示黑名单方针平台
public UnrealTargetConfiguration[] WhitelistTargetConfigurations;
public enum UnrealTargetConfiguration
{
/// Unknown
Unknown,
/// Debug configuration
Debug,
/// DebugGame configuration; equivalent to development, but with optimization disabled for game modules
DebugGame,
/// Development configuration
Development,
/// Shipping configuration
Shipping,
/// Test configuration
Test,
}
[*]主要功能:暗示白名单方针配置
public UnrealTargetConfiguration[] BlacklistTargetConfigurations;
[*]主要功能:暗示黑名单方针配置
public enum TargetType
{
/// Cooked monolithic game executable (GameName.exe).Also used for a game-agnostic engine executable (UE4Game.exe or RocketGame.exe)
Game,
/// Uncooked modular editor executable and DLLs (UE4Editor.exe, UE4Editor*.dll, GameName*.dll)
Editor,
/// Cooked monolithic game client executable (GameNameClient.exe, but no server code)
Client,
/// Cooked monolithic game server executable (GameNameServer.exe, but no client code)
Server,
/// Program (standalone program, e.g. ShaderCompileWorker.exe, can be modular or monolithic depending on the program)
Program,
}public TargetType[] WhitelistTargets;
[*]主要功能:暗示白名单方针类型
public TargetType[] BlacklistTargets;
[*]主要功能:暗示黑名单方针类型
public List SupportedTargetPlatforms;
[*]主要功能:暗示撑持的方针平台
枚举介绍
public enum PluginDescriptorVersion
{
/// <summary>
/// Invalid
/// </summary>
Invalid = 0,
/// <summary>
/// Initial version
/// </summary>
Initial = 1,
/// <summary>
/// Adding SampleNameHash
/// </summary>
NameHash = 2,
/// <summary>
/// Unifying plugin/project files (since abandoned, but backwards compatibility maintained)
/// </summary>
ProjectPluginUnification = 3,
/// <summary>
/// This needs to be the last line, so we can calculate the value of Latest below
/// </summary>
LatestPlusOne,
/// <summary>
/// The latest plugin descriptor version
/// </summary>
Latest = LatestPlusOne - 1
}
页:
[1]