PredefinedEDF

PredefinedEDF

#Overview

name: PredefinedEDF

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

#Summary

#Usage in the C++ source code

The purpose of PredefinedEDF is to store and manage predefined Emission Distribution Functions (EDF) for the MaterialX pipeline in Unreal Engine 5. This variable is part of the material system, specifically for handling MaterialX imports and conversions.

This setting variable is primarily used within the Interchange plugin, which is responsible for importing and converting various asset formats into Unreal Engine. The main subsystems that rely on this variable are:

  1. The MaterialX pipeline in the Interchange system
  2. The editor customization for MaterialX pipeline settings

The value of this variable is set in two ways:

  1. Through configuration files (as indicated by the config meta tag in the property declaration)
  2. Programmatically in the InitPredefinedAssets function of the UMaterialXPipelineSettings class

PredefinedEDF interacts with other similar variables such as PredefinedBSDF, PredefinedVDF, and PredefinedSurfaceShaders. These variables collectively define the mapping between MaterialX shader types and their corresponding Unreal Engine assets.

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

  1. It is part of the MaterialX import pipeline and affects how MaterialX assets are converted to Unreal Engine materials.
  2. The variable is a map that links EInterchangeMaterialXEDF enum values to FSoftObjectPath objects, representing the paths to the corresponding Unreal Engine assets.
  3. Changes to this variable will affect the MaterialX import process and the resulting materials in the engine.

Best practices when using this variable include:

  1. Ensure that the mapped assets exist and are compatible with the MaterialX EDF they represent.
  2. When adding or modifying entries, consider the impact on existing MaterialX imports and the consistency of material appearance across different imports.
  3. Use the provided editor customization (FInterchangeMaterialXPipelineSettingsCustomization) to modify these settings rather than changing them directly in code or config files.
  4. Be aware of the interaction between this variable and the other predefined shader type mappings (BSDF, VDF, Surface Shaders) to maintain a consistent material import pipeline.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Plugins/Interchange/Runtime/Config/BaseInterchange.ini:63, section: [/Script/InterchangePipelines.MaterialXPipelineSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Interchange/Editor/Source/Pipelines/Private/InterchangeMaterialXPipelineCustomizations.cpp:133

Scope (from outer to inner):

file
function     void FInterchangeMaterialXPipelineSettingsCustomization::CustomizeDetails

Source code excerpt:

			  UE::Interchange::MaterialX::IndexBSDF);

	Customize(GET_MEMBER_NAME_CHECKED(UMaterialXPipelineSettings, PredefinedEDF),
			  TEXT("MaterialXPredefined | EDF"),
			  NSLOCTEXT("InterchangeMaterialXPipelineSettingsCustomization", "MaterialXPredefined | EDF", "Emission Distribution Functions"),
			  UE::Interchange::MaterialX::IndexEDF);

	Customize(GET_MEMBER_NAME_CHECKED(UMaterialXPipelineSettings, PredefinedVDF),
			  TEXT("MaterialXPredefined | VDF"),

#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangeMaterialXPipeline.cpp:671

Scope (from outer to inner):

file
function     UInterchangeMaterialXPipeline::UInterchangeMaterialXPipeline

Source code excerpt:

	}

	for(const TPair<EInterchangeMaterialXEDF, FSoftObjectPath>& Entry : MaterialXSettings->PredefinedEDF)
	{
		PathToEnumMapping.FindOrAdd(Entry.Value.GetAssetPathString(), EInterchangeMaterialXSettings{ TInPlaceType<EInterchangeMaterialXEDF>{}, Entry.Key });
	}

	for(const TPair<EInterchangeMaterialXVDF, FSoftObjectPath>& Entry : MaterialXSettings->PredefinedVDF)
	{

#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangeMaterialXPipeline.cpp:792

Scope (from outer to inner):

file
function     bool UMaterialXPipelineSettings::AreRequiredPackagesLoaded

Source code excerpt:

	};

	return ArePackagesLoaded(PredefinedSurfaceShaders) && ArePackagesLoaded(PredefinedBSDF) && ArePackagesLoaded(PredefinedEDF) && ArePackagesLoaded(PredefinedVDF);
}

#if WITH_EDITOR
void UMaterialXPipelineSettings::InitPredefinedAssets()
{
	if(bIsSubstrateEnabled)

#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangeMaterialXPipeline.cpp:844

Scope (from outer to inner):

file
function     void UMaterialXPipelineSettings::InitPredefinedAssets

Source code excerpt:

				else if(ShadersSettings.IsType<EInterchangeMaterialXEDF>())
				{
					PredefinedEDF.Add(ShadersSettings.Get<EInterchangeMaterialXEDF>(), FSoftObjectPath{ Mapping.Get<2>() });
				}
				else if(ShadersSettings.IsType<EInterchangeMaterialXVDF>())
				{
					PredefinedVDF.Add(ShadersSettings.Get<EInterchangeMaterialXVDF>(), FSoftObjectPath{ Mapping.Get<2>() });
				}
			}

#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangeMaterialXPipeline.cpp:878

Scope (from outer to inner):

file
function     FString UMaterialXPipelineSettings::GetAssetPathString

Source code excerpt:

	else if(EnumValue.IsType<EInterchangeMaterialXEDF>())
	{
		return FindAssetPathString(PredefinedEDF, EnumValue.Get<EInterchangeMaterialXEDF>());
	}
	else if(EnumValue.IsType<EInterchangeMaterialXVDF>())
	{
		return FindAssetPathString(PredefinedVDF, EnumValue.Get<EInterchangeMaterialXVDF>());
	}

#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Public/InterchangeMaterialXPipeline.h:52

Scope (from outer to inner):

file
class        class UMaterialXPipelineSettings : public UDeveloperSettings

Source code excerpt:


	UPROPERTY(EditAnywhere, config, Category = "MaterialXPredefined | EDF", meta = (DisplayName = "MaterialX Predefined EDF"))
	TMap<EInterchangeMaterialXEDF, FSoftObjectPath> PredefinedEDF;

	UPROPERTY(EditAnywhere, config, Category = "MaterialXPredefined | VDF", meta = (DisplayName = "MaterialX Predefined VDF"))
	TMap<EInterchangeMaterialXVDF, FSoftObjectPath> PredefinedVDF;

#if WITH_EDITOR
	/** Init the Predefined with Substrate assets, since the default value is set in BaseInterchange.ini and we have no way in the config file to conditionally init a property*/