BaseColorName

BaseColorName

#Overview

name: BaseColorName

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

#Summary

#Usage in the C++ source code

The purpose of BaseColorName is to specify the name of the base color property in materials when importing assets, particularly in the context of FBX import operations in Unreal Engine 5.

This setting variable is primarily used in the following Unreal Engine subsystems and modules:

  1. Material Utilities (MaterialUtilities module)
  2. FBX Import UI (DetailCustomizations module)
  3. FBX Import System (UnrealEd module)

The value of this variable is typically set during the FBX import process, either through the FBX import UI or programmatically when configuring import options. It is stored in the UFbxTextureImportData class as a property.

BaseColorName interacts with several other variables related to material import, such as:

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

  1. It is used to map the base color property of imported materials to the corresponding property in Unreal Engine materials.
  2. The variable affects how materials are created or instanced during the import process.
  3. It can be used to customize the material creation process when importing FBX files.

Best practices when using this variable include:

  1. Ensure consistency in naming conventions across your project to avoid confusion.
  2. Use clear and descriptive names for the base color property to maintain readability.
  3. Consider the existing material structure in your project when setting this variable to ensure compatibility.
  4. Be aware of how this setting interacts with other material import options to achieve the desired result.
  5. Properly document any custom naming conventions used for this variable to help team members understand the import process.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:700, section: [/Script/UnrealEd.FbxTextureImportData]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Developer/MaterialUtilities/Private/MaterialUtilities.cpp:1583

Scope (from outer to inner):

file
function     bool FMaterialUtilities::ExportBaseColor

Source code excerpt:


	// Render diffuse texture using BufferVisualizationMode=BaseColor
	static const FName BaseColorName("BaseColor");
	const float BaseColorGamma = 2.2f;
	RenderSceneToTexture(Scene, BaseColorName, ViewOrigin, ViewRotationMatrix, ProjectionMatrix, ShowOnlyPrimitives, HiddenPrimitives, TargetSize, BaseColorGamma, true, OutSamples);
	return true;
}

FFlattenMaterial FMaterialUtilities::CreateFlattenMaterialWithSettings(const FMaterialProxySettings& InMaterialLODSettings)
{
	// Create new material.

#Loc: <Workspace>/Engine/Source/Editor/DetailCustomizations/Private/FbxImportUIDetails.cpp:834

Scope (from outer to inner):

file
function     void FFbxImportUIDetails::ConstructBaseMaterialUI

Source code excerpt:

	if (BaseColorNames.Num() > 1)
	{
		InitialSelect = FindString(BaseColorNames, ImportUI->TextureImportData->BaseColorName);
		InitialSelect = InitialSelect == INDEX_NONE ? 0 : InitialSelect; // default to the empty string located at index 0
		MaterialCategory.AddCustomRow(LOCTEXT("BaseColorProperty", "Base Color Property"))
		.NameContent()
		[
			SNew(STextBlock)
			.Text(LOCTEXT("BaseColorProperty", "Base Color Property"))

#Loc: <Workspace>/Engine/Source/Editor/DetailCustomizations/Private/FbxImportUIDetails.cpp:1230

Scope (from outer to inner):

file
function     void FFbxImportUIDetails::OnBaseColor

Source code excerpt:

void FFbxImportUIDetails::OnBaseColor(TSharedPtr<FString> Selection, ESelectInfo::Type SelectInfo)
{
	GetSelectionParameterString(Selection, ImportUI->TextureImportData->BaseColorName);
}

void FFbxImportUIDetails::OnDiffuseTextureColor(TSharedPtr<FString> Selection, ESelectInfo::Type SelectInfo)
{
	GetSelectionParameterString(Selection, ImportUI->TextureImportData->BaseDiffuseTextureName);
}

#Loc: <Workspace>/Engine/Source/Editor/DetailCustomizations/Private/FbxImportUIDetails.cpp:1265

Scope (from outer to inner):

file
function     FReply FFbxImportUIDetails::MaterialBaseParamClearAllProperties

Source code excerpt:

FReply FFbxImportUIDetails::MaterialBaseParamClearAllProperties()
{
	ImportUI->TextureImportData->BaseColorName.Empty();
	ImportUI->TextureImportData->BaseDiffuseTextureName.Empty();
	ImportUI->TextureImportData->BaseNormalTextureName.Empty();
	ImportUI->TextureImportData->BaseEmmisiveTextureName.Empty();
	ImportUI->TextureImportData->BaseEmissiveColorName.Empty();
	ImportUI->TextureImportData->BaseSpecularTextureName.Empty();
	ImportUI->TextureImportData->BaseOpacityTextureName.Empty();

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Factories/FbxTextureImportData.h:33

Scope (from outer to inner):

file
class        class UFbxTextureImportData : public UFbxAssetImportData

Source code excerpt:


	UPROPERTY(BlueprintReadWrite, config, Category = Material, meta = (ImportType = "Mesh"))
	FString BaseColorName;

	UPROPERTY(BlueprintReadWrite, config, Category = Material, meta = (ImportType = "Mesh"))
	FString BaseDiffuseTextureName;

	UPROPERTY(BlueprintReadWrite, config, Category = Material, meta = (ImportType = "Mesh"))
	FString BaseNormalTextureName;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMainImport.cpp:391

Scope (from outer to inner):

file
namespace    UnFbx
function     void ApplyImportUIToImportOptions

Source code excerpt:

		if (BaseMaterialInterface) {
			InOutImportOptions.BaseMaterial			= BaseMaterialInterface;
			InOutImportOptions.BaseColorName		= ImportUI->TextureImportData->BaseColorName;
			InOutImportOptions.BaseDiffuseTextureName = ImportUI->TextureImportData->BaseDiffuseTextureName;
			InOutImportOptions.BaseNormalTextureName = ImportUI->TextureImportData->BaseNormalTextureName;
			InOutImportOptions.BaseEmmisiveTextureName = ImportUI->TextureImportData->BaseEmmisiveTextureName;
			InOutImportOptions.BaseSpecularTextureName = ImportUI->TextureImportData->BaseSpecularTextureName;
			InOutImportOptions.BaseOpacityTextureName = ImportUI->TextureImportData->BaseOpacityTextureName;
			InOutImportOptions.BaseEmissiveColorName = ImportUI->TextureImportData->BaseEmissiveColorName;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMaterialImport.cpp:642

Scope (from outer to inner):

file
function     UMaterialInterface* UnFbx::FFbxImporter::CreateUnrealMaterial

Source code excerpt:

		else
		{
			bCanInstance = !FbxImportOptions->BaseColorName.IsEmpty();
		}

		FbxProperty FbxEmissiveProperty = FbxMaterial.FindProperty(FbxSurfaceMaterial::sEmissive);
		if (FbxEmissiveProperty.IsValid())
		{
			bCanInstance &= CanUseMaterialWithInstance(FbxMaterial, FbxSurfaceMaterial::sEmissive, FbxImportOptions->BaseEmmisiveTextureName, FbxImportOptions->BaseMaterial, OutUVSets);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMaterialImport.cpp:730

Scope (from outer to inner):

file
function     UMaterialInterface* UnFbx::FFbxImporter::CreateUnrealMaterial

Source code excerpt:

					FLinearColor LinearColor((float)DiffuseColor[0], (float)DiffuseColor[1], (float)DiffuseColor[2]);
					FLinearColor CurrentLinearColor;
					if (UnrealMaterialConstant->GetVectorParameterValue(FName(*FbxImportOptions->BaseColorName), CurrentLinearColor))
					{
						//Alpha is not consider for diffuse color
						LinearColor.A = CurrentLinearColor.A;
						if (!CurrentLinearColor.Equals(LinearColor))
						{
							UnrealMaterialConstant->SetVectorParameterValueEditorOnly(FName(*FbxImportOptions->BaseColorName), LinearColor);
						}
					}
				}
			}
			if (!bEmissiveTextureCreated)
			{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Public/FbxImporter.h:163

Scope (from outer to inner):

file
namespace    UnFbx

Source code excerpt:

	// Material import options
	class UMaterialInterface *BaseMaterial;
	FString BaseColorName;
	FString BaseDiffuseTextureName;
	FString BaseEmissiveColorName;
	FString BaseNormalTextureName;
	FString BaseEmmisiveTextureName;
	FString BaseSpecularTextureName;
	FString BaseOpacityTextureName;