FieldTypesToInclude

FieldTypesToInclude

#Overview

name: FieldTypesToInclude

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 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of FieldTypesToInclude is to specify which field types should be included in the localization gathering process for metadata in Unreal Engine 5. It is used to filter and control which types of fields (such as Properties, Functions, ScriptStructs, Enums, etc.) are considered during the localization data extraction.

This setting variable is primarily used in the localization system of Unreal Engine 5, specifically in the metadata gathering process. The main subsystems and modules that rely on this variable are:

  1. The Localization module
  2. The UnrealEd module, particularly the GatherTextFromMetadataCommandlet

The value of this variable is typically set in the localization configuration files or through the Unreal Editor’s localization settings. It is defined as a TArray in the LocalizationTargetTypes.h file, allowing for multiple field types to be specified.

FieldTypesToInclude interacts closely with FieldTypesToExclude, which serves as its counterpart for excluding specific field types. Together, they provide fine-grained control over the localization gathering process.

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

  1. If FieldTypesToInclude is empty, all field types will be included by default unless explicitly excluded by FieldTypesToExclude.
  2. The variable accepts string representations of field types, which are then converted to the appropriate internal types during the gathering process.
  3. It works in conjunction with FieldOwnerTypesToInclude and FieldOwnerTypesToExclude for more precise control over the gathering process.

Best practices when using this variable include:

  1. Be specific about which field types to include to optimize the localization process and reduce unnecessary data gathering.
  2. Coordinate the use of FieldTypesToInclude with FieldTypesToExclude to create a clear and consistent gathering strategy.
  3. Regularly review and update the included field types as your project evolves to ensure all necessary data is being gathered for localization.
  4. Document the rationale behind the chosen field types to include, making it easier for team members to understand and maintain the localization configuration.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Localization/Editor.ini:63, section: [GatherTextStep2]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:434

Scope (from outer to inner):

file
namespace    LocalizationConfigurationScript
function     FLocalizationConfigurationScript GenerateGatherTextConfigFile

Source code excerpt:


			// Field Type Filters
			for (const FString& FieldTypeToInclude : Target->Settings.GatherFromMetaData.FieldTypesToInclude)
			{
				ConfigSection.Add(TEXT("FieldTypesToInclude"), FieldTypeToInclude);
			}
			for (const FString& FieldTypeToExclude : Target->Settings.GatherFromMetaData.FieldTypesToExclude)
			{
				ConfigSection.Add(TEXT("FieldTypesToExclude"), FieldTypeToExclude);
			}

#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:283

Scope: file

Source code excerpt:

	/** List of field types (eg, Property, Function, ScriptStruct, Enum, etc) that should be included in the gather, or empty to include everything. */
	UPROPERTY(config, EditAnywhere, Category = "MetaData")
	TArray<FString> FieldTypesToInclude;

	/** List of field types (eg, Property, Function, ScriptStruct, Enum, etc) the should be excluded from the gather. */
	UPROPERTY(config, EditAnywhere, Category = "MetaData")
	TArray<FString> FieldTypesToExclude;

	/** List of field owner types (eg, MyClass, MyStruct, etc) that should have fields within them included in the gather, or empty to include everything. */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Commandlets/GatherTextFromMetadataCommandlet.h:92

Scope (from outer to inner):

file
class        class UGatherTextFromMetaDataCommandlet : public UGatherTextCommandletBase

Source code excerpt:


	/** Array of field types (eg, FProperty, UFunction, UScriptStruct, etc) that should be included or excluded in the current gather */
	TArray<FFieldClassFilter> FieldTypesToInclude;
	TArray<FFieldClassFilter> FieldTypesToExclude;

	/** Array of field owner types (eg, UMyClass, FMyStruct, etc) that should have fields within them included or excluded in the current gather */
	TArray<const UStruct*> FieldOwnerTypesToInclude;
	TArray<const UStruct*> FieldOwnerTypesToExclude;
};

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromMetadataCommandlet.cpp:132

Scope (from outer to inner):

file
function     int32 UGatherTextFromMetaDataCommandlet::Main

Source code excerpt:

	}

	// FieldTypesToInclude/FieldTypesToExclude
	{
		auto GetFieldTypesArrayFromConfig = [this, &SectionName, &GatherTextConfigPath](const TCHAR* InConfigKey, TArray<FFieldClassFilter>& OutFieldTypes)
		{
			TArray<FString> FieldTypeStrs;
			GetStringArrayFromConfig(*SectionName, InConfigKey, FieldTypeStrs, GatherTextConfigPath);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromMetadataCommandlet.cpp:200

Scope (from outer to inner):

file
function     int32 UGatherTextFromMetaDataCommandlet::Main

Source code excerpt:

		};

		GetFieldTypesArrayFromConfig(TEXT("FieldTypesToInclude"), FieldTypesToInclude);
		GetFieldTypesArrayFromConfig(TEXT("FieldTypesToExclude"), FieldTypesToExclude);
	}

	// FieldOwnerTypesToInclude/FieldOwnerTypesToExclude
	{
		auto GetFieldOwnerTypesArrayFromConfig = [this, &SectionName, &GatherTextConfigPath](const TCHAR* InConfigKey, TArray<const UStruct*>& OutFieldOwnerTypes)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromMetadataCommandlet.cpp:392

Scope (from outer to inner):

file
function     bool UGatherTextFromMetaDataCommandlet::ShouldGatherFromField
lambda-function

Source code excerpt:

	auto ShouldGatherFieldByType = [this, Field]()
	{
		if (FieldTypesToInclude.Num() == 0 && FieldTypesToExclude.Num() == 0)
		{
			return true;
		}

		const auto* FieldClass = Field->GetClass();
		auto TestClassFilter = [FieldClass](const TArray<FFieldClassFilter>& InFieldTypeFilters)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/GatherTextFromMetadataCommandlet.cpp:410

Scope (from outer to inner):

file
function     bool UGatherTextFromMetaDataCommandlet::ShouldGatherFromField
lambda-function

Source code excerpt:

		};
		
		return (FieldTypesToInclude.Num() == 0 || TestClassFilter(FieldTypesToInclude))
			&& (FieldTypesToExclude.Num() == 0 || !TestClassFilter(FieldTypesToExclude));
	};

	auto ShouldGatherFieldByOwnerType = [this, Field]()
	{
		if (FieldOwnerTypesToInclude.Num() == 0 && FieldOwnerTypesToExclude.Num() == 0)