Example #1
0
        /// <summary>
        /// Determine if a plugin is enabled for a given project
        /// </summary>
        /// <param name="Project">The project to check. May be null.</param>
        /// <param name="Plugin">Information about the plugin</param>
        /// <param name="Platform">The target platform</param>
        /// <param name="Configuration">The target configuration</param>
        /// <param name="TargetType">The type of target being built</param>
        /// <returns>True if the plugin should be enabled for this project</returns>
        public static bool IsPluginEnabledForTarget(PluginInfo Plugin, ProjectDescriptor Project, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, TargetType TargetType)
        {
            if (!Plugin.Descriptor.SupportsTargetPlatform(Platform))
            {
                return(false);
            }

            bool bAllowEnginePluginsEnabledByDefault = (Project == null ? true : !Project.DisableEnginePluginsByDefault);
            bool bEnabled = Plugin.IsEnabledByDefault(bAllowEnginePluginsEnabledByDefault);

            if (Project != null && Project.Plugins != null)
            {
                foreach (PluginReferenceDescriptor PluginReference in Project.Plugins)
                {
                    if (String.Compare(PluginReference.Name, Plugin.Name, true) == 0 && !PluginReference.bOptional)
                    {
                        bEnabled = PluginReference.IsEnabledForPlatform(Platform) && PluginReference.IsEnabledForTargetConfiguration(Configuration) && PluginReference.IsEnabledForTarget(TargetType);
                    }
                }
            }
            return(bEnabled);
        }