MetaDataTagsForAssetRegistry

MetaDataTagsForAssetRegistry

#Overview

name: MetaDataTagsForAssetRegistry

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

It is referenced in 12 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MetaDataTagsForAssetRegistry is to manage a set of metadata tags that are transferred to the Asset Registry in Unreal Engine 5. This variable is primarily used for asset management and organization within the engine.

This setting variable is utilized by multiple Unreal Engine subsystems and modules, including:

  1. The Shotgrid plugin (Experimental)
  2. The Asset Registry system
  3. The Asset Manager
  4. The Thumbnail system

The value of this variable is set in various places:

  1. In the Shotgrid plugin settings (UShotgridSettings class)
  2. In the Asset Manager settings (UAssetManagerSettings class)
  3. Dynamically in the FAssetThumbnailPool constructor

This variable interacts with the global set of metadata tags for the Asset Registry, which can be accessed using UObject::GetMetaDataTagsForAssetRegistry(). The variable is used to add or remove tags from this global set.

Developers should be aware of the following when using this variable:

  1. Changes to this variable trigger updates to the global set of metadata tags.
  2. The variable is used in both runtime and editor contexts.
  3. Modifying this variable can affect asset discovery and organization in the engine.

Best practices when using this variable include:

  1. Use meaningful and consistent tag names to improve asset organization.
  2. Be cautious when modifying tags, as it may impact existing assets and workflows.
  3. Coordinate changes with team members to ensure consistency across the project.
  4. Use the provided functions (ApplyMetaDataTagsSettings, ClearMetaDataTagsSettings) when modifying tags to ensure proper updates to the global set.
  5. Be aware of potential performance implications when adding a large number of tags, as it may affect Asset Registry operations.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:57, section: [/Script/Engine.AssetManagerSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/Shotgrid/Source/Shotgrid/Private/ShotgridSettings.cpp:16

Scope (from outer to inner):

file
function     void UShotgridSettings::ApplyMetaDataTagsSettings

Source code excerpt:

{
	TSet<FName>& GlobalTagsForAssetRegistry = UObject::GetMetaDataTagsForAssetRegistry();
	for (FName Tag : MetaDataTagsForAssetRegistry)
	{
		if (!Tag.IsNone())
		{
			if (!GlobalTagsForAssetRegistry.Contains(Tag))
			{
				GlobalTagsForAssetRegistry.Add(Tag);

#Loc: <Workspace>/Engine/Plugins/Experimental/Shotgrid/Source/Shotgrid/Private/ShotgridSettings.cpp:36

Scope (from outer to inner):

file
function     void UShotgridSettings::ClearMetaDataTagsSettings

Source code excerpt:

{
	TSet<FName>& GlobalTagsForAssetRegistry = UObject::GetMetaDataTagsForAssetRegistry();
	for (FName Tag : MetaDataTagsForAssetRegistry)
	{
		if (!Tag.IsNone())
		{
			GlobalTagsForAssetRegistry.Remove(Tag);
		}
	}

#Loc: <Workspace>/Engine/Plugins/Experimental/Shotgrid/Source/Shotgrid/Private/ShotgridSettings.cpp:52

Scope (from outer to inner):

file
function     void UShotgridSettings::PreEditChange

Source code excerpt:

	{
		FName PropertyName = PropertyAboutToChange->GetFName();
		if (PropertyName == GET_MEMBER_NAME_CHECKED(UShotgridSettings, MetaDataTagsForAssetRegistry))
		{
			ClearMetaDataTagsSettings();
		}
	}
}

#Loc: <Workspace>/Engine/Plugins/Experimental/Shotgrid/Source/Shotgrid/Private/ShotgridSettings.cpp:64

Scope (from outer to inner):

file
function     void UShotgridSettings::PostEditChangeProperty

Source code excerpt:


	FName PropertyName = (PropertyChangedEvent.MemberProperty != NULL) ? PropertyChangedEvent.MemberProperty->GetFName() : NAME_None;
	if (PropertyName == GET_MEMBER_NAME_CHECKED(UShotgridSettings, MetaDataTagsForAssetRegistry))
	{
		if (PropertyChangedEvent.ChangeType == EPropertyChangeType::ValueSet)
		{
			// Check if the new value already exists in the global tags list
			int32 Index = PropertyChangedEvent.GetArrayIndex(PropertyName.ToString());
			if (Index > 0)
			{
				TSet<FName>::TIterator It = MetaDataTagsForAssetRegistry.CreateIterator();
				for (int32 i = 0; i < Index; ++i)
				{
					++It;
				}
				FName NewValue = It ? *It : FName();
				if (UObject::GetMetaDataTagsForAssetRegistry().Contains(NewValue))

#Loc: <Workspace>/Engine/Plugins/Experimental/Shotgrid/Source/Shotgrid/Private/ShotgridSettings.h:15

Scope (from outer to inner):

file
class        class UShotgridSettings : public UObject

Source code excerpt:

	/** The metadata tags to be transferred to the Asset Registry. */
	UPROPERTY(config, EditAnywhere, AdvancedDisplay, Category = "Asset Registry", DisplayName = "Metadata Tags For Asset Registry")
	TSet<FName> MetaDataTagsForAssetRegistry;

#if WITH_EDITOR
	virtual void PostInitProperties() override;
	virtual void PreEditChange(FProperty* PropertyAboutToChange) override;
	virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/AssetThumbnail.cpp:950

Scope (from outer to inner):

file
function     FAssetThumbnailPool::FAssetThumbnailPool

Source code excerpt:


	// Add the custom thumbnail tag to the list of tags that the asset registry can parse
	TSet<FName>& MetaDataTagsForAssetRegistry = UObject::GetMetaDataTagsForAssetRegistry();
	MetaDataTagsForAssetRegistry.Add(CustomThumbnailTagName);
}

FAssetThumbnailPool::~FAssetThumbnailPool()
{
	UThumbnailManager* ThumbnailManager = UThumbnailManager::TryGet();
	if ( IsValid( ThumbnailManager ) &&

#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/Obj.cpp:2468

Scope: file

Source code excerpt:

}

static TSet<FName> MetaDataTagsForAssetRegistry;

TSet<FName>& UObject::GetMetaDataTagsForAssetRegistry()
{
	return MetaDataTagsForAssetRegistry;
}

void UObject::GetAssetRegistryTagMetadata(TMap<FName, FAssetRegistryTagMetadata>& OutMetadata) const
{
	OutMetadata.Add(FPrimaryAssetId::PrimaryAssetTypeTag,
		FAssetRegistryTagMetadata()

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/AssetManagerSettings.h:132

Scope (from outer to inner):

file
class        class UAssetManagerSettings : public UDeveloperSettings

Source code excerpt:

	/** The metadata tags to be transferred to the Asset Registry. */
	UPROPERTY(config, EditAnywhere, AdvancedDisplay, Category = "Asset Registry", DisplayName = "Metadata Tags For Asset Registry")
	TSet<FName> MetaDataTagsForAssetRegistry;

	ENGINE_API virtual void PostReloadConfig(class FProperty* PropertyThatWasLoaded) override;

#if WITH_EDITOR
	ENGINE_API virtual void PostInitProperties() override;
	ENGINE_API virtual void PreEditChange(FProperty* PropertyAboutToChange) override;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManagerTypes.cpp:208

Scope (from outer to inner):

file
function     void UAssetManagerSettings::ApplyMetaDataTagsSettings

Source code excerpt:

{
	TSet<FName>& GlobalTagsForAssetRegistry = UObject::GetMetaDataTagsForAssetRegistry();
	for (FName Tag : MetaDataTagsForAssetRegistry)
	{
		if (!Tag.IsNone())
		{
			if (!GlobalTagsForAssetRegistry.Contains(Tag))
			{
				GlobalTagsForAssetRegistry.Add(Tag);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManagerTypes.cpp:228

Scope (from outer to inner):

file
function     void UAssetManagerSettings::ClearMetaDataTagsSettings

Source code excerpt:

{
	TSet<FName>& GlobalTagsForAssetRegistry = UObject::GetMetaDataTagsForAssetRegistry();
	for (FName Tag : MetaDataTagsForAssetRegistry)
	{
		if (!Tag.IsNone())
		{
			GlobalTagsForAssetRegistry.Remove(Tag);
		}
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManagerTypes.cpp:244

Scope (from outer to inner):

file
function     void UAssetManagerSettings::PreEditChange

Source code excerpt:

	{
		FName PropertyName = PropertyAboutToChange->GetFName();
		if (PropertyName == GET_MEMBER_NAME_CHECKED(UAssetManagerSettings, MetaDataTagsForAssetRegistry))
		{
			ClearMetaDataTagsSettings();
		}
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManagerTypes.cpp:256

Scope (from outer to inner):

file
function     void UAssetManagerSettings::PostEditChangeProperty

Source code excerpt:


	FName PropertyName = (PropertyChangedEvent.MemberProperty != NULL) ? PropertyChangedEvent.MemberProperty->GetFName() : NAME_None;
	if (PropertyName == GET_MEMBER_NAME_CHECKED(UAssetManagerSettings, MetaDataTagsForAssetRegistry))
	{
		if (PropertyChangedEvent.ChangeType == EPropertyChangeType::ValueSet)
		{
			// Check if the new value already exists in the global tags list
			int32 Index = PropertyChangedEvent.GetArrayIndex(PropertyName.ToString());
			if (Index > 0)
			{
				TSet<FName>::TIterator It = MetaDataTagsForAssetRegistry.CreateIterator();
				for (int32 i = 0; i < Index; ++i)
				{
					++It;
				}
				FName NewValue = It ? *It : FName();
				if (UObject::GetMetaDataTagsForAssetRegistry().Contains(NewValue))