EnabledDataSources

EnabledDataSources

#Overview

name: EnabledDataSources

The value of this variable can be defined or overridden in .ini config files. 3 .ini config files referencing this setting variable.

It is referenced in 8 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of EnabledDataSources is to manage the list of data sources that are enabled for use in the Content Browser Data Subsystem within Unreal Engine 5. This variable is part of the Content Browser system, which is responsible for organizing and displaying assets and other content within the Unreal Editor.

The Content Browser Data Subsystem relies on this setting variable, as evidenced by its use in the UContentBrowserDataSubsystem class. This subsystem is part of the Editor module, specifically the ContentBrowserData component.

The value of this variable is set through configuration (as indicated by the UPROPERTY(config) macro) and can be modified programmatically using the ActivateDataSource and DeactivateDataSource functions.

EnabledDataSources interacts with other variables such as ActiveDataSources and AvailableDataSources. It serves as a list of data sources that should be activated when they become available.

Developers must be aware that:

  1. Adding a data source to EnabledDataSources does not immediately activate it; it only marks it for activation when it becomes available.
  2. The variable is used to determine which data sources should be activated when they are registered with the system.

Best practices when using this variable include:

  1. Use the provided ActivateDataSource and DeactivateDataSource functions to modify the list, rather than directly manipulating the array.
  2. Be mindful of performance implications when enabling multiple data sources, as each active source may consume resources.
  3. Ensure that any custom data sources are properly registered and unregistered to work correctly with this system.
  4. Consider the impact on the Content Browser’s performance and user experience when enabling or disabling data sources.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditor.ini:75, section: [/Script/ContentBrowserData.ContentBrowserDataSubsystem]

Location: <Workspace>/Engine/Config/BaseEditor.ini:76, section: [/Script/ContentBrowserData.ContentBrowserDataSubsystem]

Location: <Workspace>/Engine/Config/BaseEditor.ini:77, section: [/Script/ContentBrowserData.ContentBrowserDataSubsystem]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/ContentBrowserData/Private/ContentBrowserDataSubsystem.cpp:151

Scope (from outer to inner):

file
function     bool UContentBrowserDataSubsystem::ActivateDataSource

Source code excerpt:

bool UContentBrowserDataSubsystem::ActivateDataSource(const FName Name)
{
	EnabledDataSources.AddUnique(Name);

	if (!ActiveDataSources.Contains(Name))
	{
		if (UContentBrowserDataSource* DataSource = AvailableDataSources.FindRef(Name))
		{
			DataSource->SetDataSink(this);

#Loc: <Workspace>/Engine/Source/Editor/ContentBrowserData/Private/ContentBrowserDataSubsystem.cpp:174

Scope (from outer to inner):

file
function     bool UContentBrowserDataSubsystem::DeactivateDataSource

Source code excerpt:

bool UContentBrowserDataSubsystem::DeactivateDataSource(const FName Name)
{
	EnabledDataSources.Remove(Name);

	if (UContentBrowserDataSource* DataSource = ActiveDataSources.FindRef(Name))
	{
		DataSource->SetDataSink(nullptr);
		ActiveDataSources.Remove(Name);
		ActiveDataSourcesDiscoveringContent.Remove(Name);

#Loc: <Workspace>/Engine/Source/Editor/ContentBrowserData/Private/ContentBrowserDataSubsystem.cpp:203

Scope (from outer to inner):

file
function     void UContentBrowserDataSubsystem::ActivateAllDataSources

Source code excerpt:


		// Merge this array as it may contain sources that we've not yet discovered, so can't activate yet
		EnabledDataSources.AddUnique(ActiveDataSourcePair.Key);
	}
	NotifyItemDataRefreshed();
}

void UContentBrowserDataSubsystem::DeactivateAllDataSources()
{

#Loc: <Workspace>/Engine/Source/Editor/ContentBrowserData/Private/ContentBrowserDataSubsystem.cpp:221

Scope (from outer to inner):

file
function     void UContentBrowserDataSubsystem::DeactivateAllDataSources

Source code excerpt:

	}
	ActiveDataSources.Reset();
	EnabledDataSources.Reset();
	ActiveDataSourcesDiscoveringContent.Reset();
	NotifyItemDataRefreshed();
}

TArray<FName> UContentBrowserDataSubsystem::GetAvailableDataSources() const
{

#Loc: <Workspace>/Engine/Source/Editor/ContentBrowserData/Private/ContentBrowserDataSubsystem.cpp:703

Scope (from outer to inner):

file
function     void UContentBrowserDataSubsystem::HandleDataSourceRegistered

Source code excerpt:

		AvailableDataSources.Add(DataSource->GetFName(), DataSource);

		if (EnabledDataSources.Contains(DataSource->GetFName()))
		{
			ActivateDataSource(DataSource->GetFName());
		}
	}
}

#Loc: <Workspace>/Engine/Source/Editor/ContentBrowserData/Public/ContentBrowserDataSource.h:133

Scope: file

Source code excerpt:

	/**
	 * Register this data source instance for use with the Content Browser Data Subsystem.
	 * @note This does not activate the data source. @see the EnabledDataSources array in the Content Browser Data Subsystem for more information on activation.
	 */
	void RegisterDataSource();

	/**
	 * Unregister this data source instance from the Content Browser Data Subsystem.
	 */
	void UnregisterDataSource();

	/**

#Loc: <Workspace>/Engine/Source/Editor/ContentBrowserData/Public/ContentBrowserDataSubsystem.h:389

Scope: file

Source code excerpt:

	/**
	 * Called to handle a data source modular feature being registered.
	 * @note Will activate the data source if it is in the EnabledDataSources array.
	 */
	void HandleDataSourceRegistered(const FName& Type, class IModularFeature* Feature);
	
	/**
	 * Called to handle a data source modular feature being unregistered.
	 * @note Will deactivate the data source if it is in the ActiveDataSources map.
	 */
	void HandleDataSourceUnregistered(const FName& Type, class IModularFeature* Feature);

#Loc: <Workspace>/Engine/Source/Editor/ContentBrowserData/Public/ContentBrowserDataSubsystem.h:455

Scope (from outer to inner):

file
class        class UContentBrowserDataSubsystem : public UEditorSubsystem, public IContentBrowserItemDataSink

Source code excerpt:

	 */
	UPROPERTY(config)
	TArray<FName> EnabledDataSources;

	/**
	 * Queue of incremental item data updates.
	 * These will be passed to ItemDataUpdatedDelegate on the end of Tick.
	 */
	TArray<FContentBrowserItemDataUpdate> PendingUpdates;