void FPluginManager::RefreshPluginsList()
{
	// Read a new list of all plugins
	TArray<TSharedRef<FPlugin>> NewPlugins;
	ReadAllPlugins(NewPlugins, PluginDiscoveryPaths);

	// Build a list of filenames for plugins which are enabled, and remove the rest
	TArray<FString> EnabledPluginFileNames;
	for(int32 Idx = 0; Idx < AllPlugins.Num(); Idx++)
	{
		const TSharedRef<FPlugin>& Plugin = AllPlugins[Idx];
		if(Plugin->bEnabled)
		{
			EnabledPluginFileNames.Add(Plugin->FileName);
		}
		else
		{
			AllPlugins.RemoveAt(Idx--);
		}
	}

	// Add all the plugins which aren't already enabled
	for(TSharedRef<FPlugin>& NewPlugin: NewPlugins)
	{
		if(!EnabledPluginFileNames.Contains(NewPlugin->FileName))
		{
			AllPlugins.Add(NewPlugin);
		}
	}
}
void FPluginManager::DiscoverAllPlugins()
{
	ensure( AllPlugins.Num() == 0 );		// Should not have already been initialized!

	PluginSystemDefs::GetAdditionalPluginPaths(PluginDiscoveryPaths);
	ReadAllPlugins(AllPlugins, PluginDiscoveryPaths);
}
Пример #3
0
void FPluginManager::DiscoverAllPlugins()
{
	ensure( AllPlugins.Num() == 0 );		// Should not have already been initialized!
	ReadAllPlugins(AllPlugins);

	// Add the plugin binaries directory
	for(const TSharedRef<FPlugin>& Plugin: AllPlugins)
	{
		const FString PluginBinariesPath = FPaths::Combine(*FPaths::GetPath(Plugin->FileName), TEXT("Binaries"), FPlatformProcess::GetBinariesSubdirectory());
		FModuleManager::Get().AddBinariesDirectory(*PluginBinariesPath, Plugin->LoadedFrom == EPluginLoadedFrom::GameProject);
	}
}