FieldOwnerTypesToInclude

FieldOwnerTypesToInclude

#Overview

name: FieldOwnerTypesToInclude

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

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of FieldOwnerTypesToInclude is to specify a list of field owner types (e.g., classes, structs) that should have their fields included in the localization gathering process. This setting variable is part of Unreal Engine 5’s localization system.

This setting variable is primarily used by the localization subsystem, specifically within the GatherTextFromMetaDataCommandlet. It’s part of the localization target settings and is used to configure the text gathering process from metadata.

The value of this variable is set in the localization configuration, likely through the Unreal Editor’s localization dashboard or in configuration files. It’s defined as a UPROPERTY in the LocalizationTargetTypes.h file, which means it can be edited in the editor and saved to config files.

FieldOwnerTypesToInclude interacts closely with FieldOwnerTypesToExclude. While FieldOwnerTypesToInclude specifies types to include, FieldOwnerTypesToExclude specifies types to exclude from the gathering process. They work together to fine-tune the scope of the text gathering.

Developers must be aware that this variable affects the scope of text gathering from metadata. If left empty, it includes everything. When specified, it limits the gathering to only the listed types. This can significantly impact the amount of text gathered for localization.

Best practices when using this variable include:

  1. Carefully consider which types need localization to avoid over-gathering or missing important text.
  2. Use in conjunction with FieldOwnerTypesToExclude for more precise control.
  3. Regularly review and update these lists as the project evolves to ensure all necessary text is being gathered.
  4. Document the rationale behind inclusions to help team members understand the localization strategy.
  5. Test the localization process after making changes to ensure all expected text is being gathered.

#Setting Variables

#References In INI files

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

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

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

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

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

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

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

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

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

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

Location: <Workspace>/Engine/Config/Localization/Editor.ini:77, 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:444

Scope (from outer to inner):

file
namespace    LocalizationConfigurationScript
function     FLocalizationConfigurationScript GenerateGatherTextConfigFile

Source code excerpt:


			// Field Owner Type Filters
			for (const FString& FieldOwnerTypeToInclude : Target->Settings.GatherFromMetaData.FieldOwnerTypesToInclude)
			{
				ConfigSection.Add(TEXT("FieldOwnerTypesToInclude"), FieldOwnerTypeToInclude);
			}
			for (const FString& FieldOwnerTypeToExclude : Target->Settings.GatherFromMetaData.FieldOwnerTypesToExclude)
			{
				ConfigSection.Add(TEXT("FieldOwnerTypesToExclude"), FieldOwnerTypeToExclude);
			}

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

Scope: file

Source code excerpt:

	/** List of field owner types (eg, MyClass, MyStruct, etc) that should have fields within them included in the gather, or empty to include everything. */
	UPROPERTY(config, EditAnywhere, Category = "MetaData")
	TArray<FString> FieldOwnerTypesToInclude;

	/** List of field owner types (eg, MyClass, MyStruct, etc) that should have fields within them excluded from the gather. */
	UPROPERTY(config, EditAnywhere, Category = "MetaData")
	TArray<FString> FieldOwnerTypesToExclude;

	/* If enabled, data that is specified as editor-only may be processed for gathering. */

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

Scope (from outer to inner):

file
class        class UGatherTextFromMetaDataCommandlet : public UGatherTextCommandletBase

Source code excerpt:


	/** 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:204

Scope (from outer to inner):

file
function     int32 UGatherTextFromMetaDataCommandlet::Main

Source code excerpt:

	}

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

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

Scope (from outer to inner):

file
function     int32 UGatherTextFromMetaDataCommandlet::Main

Source code excerpt:

		};

		GetFieldOwnerTypesArrayFromConfig(TEXT("FieldOwnerTypesToInclude"), FieldOwnerTypesToInclude);
		GetFieldOwnerTypesArrayFromConfig(TEXT("FieldOwnerTypesToExclude"), FieldOwnerTypesToExclude);
	}

	FGatherParameters Arguments;
	GetStringArrayFromConfig(*SectionName, TEXT("InputKeys"), Arguments.InputKeys, GatherTextConfigPath);
	GetStringArrayFromConfig(*SectionName, TEXT("OutputNamespaces"), Arguments.OutputNamespaces, GatherTextConfigPath);

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

Scope (from outer to inner):

file
function     bool UGatherTextFromMetaDataCommandlet::ShouldGatherFromField
lambda-function

Source code excerpt:

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

		const UStruct* FieldOwnerType = Field->GetOwnerStruct();
		if (FieldOwnerType)
		{
			// Only properties and functions will have an owner struct type
			return (FieldOwnerTypesToInclude.Num() == 0 || FieldOwnerTypesToInclude.Contains(FieldOwnerType))
				&& (FieldOwnerTypesToExclude.Num() == 0 || !FieldOwnerTypesToExclude.Contains(FieldOwnerType));
		}

		return true;
	};