|
Unreal4源码拆解-UnrealBuildTool功能流程解析-PluginReferenceDescriptor
主要功能
概括
- 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)
public static void WriteArray(JsonWriter Writer, string Name, PluginReferenceDescriptor[] Plugins)
- 输入一堆插件引用信息,从 Name 开始写到 JSON 中
public static PluginReferenceDescriptor FromJsonObject(JsonObject RawObject)
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;
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
- }
复制代码 |
|