bReorderMaterialToFbxOrder

bReorderMaterialToFbxOrder

#Overview

name: bReorderMaterialToFbxOrder

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 bReorderMaterialToFbxOrder is to control whether the material list in Unreal Engine should be reordered to match the order of materials in the imported FBX file.

This setting variable is primarily used in the FBX import system of Unreal Engine, which is part of the asset import pipeline. It is utilized by both the Editor and the Interchange Plugin, specifically for importing static and skeletal meshes.

The value of this variable is typically set in the FBX import options or import UI. It can be found in both UFbxStaticMeshImportData and UFbxSkeletalMeshImportData classes.

This variable interacts with the material assignment and ordering system during FBX import. It affects how materials are mapped to the imported mesh.

Developers must be aware that enabling this option may change the order of materials on the imported mesh, which could affect existing material assignments if reimporting assets.

Best practices when using this variable include:

  1. Use it consistently across your project to maintain a predictable import behavior.
  2. Be cautious when changing this setting for existing assets, as it may require updating material assignments in your scenes.
  3. Consider your workflow and whether matching the FBX material order is important for your asset pipeline.
  4. Document your choice for this setting in your team’s asset import guidelines to ensure consistency across the project.

#Setting Variables

#References In INI files

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Interchange/Editor/Source/InterchangeEditor/Private/InterchangeFbxAssetImportDataConverter.cpp:68

Scope (from outer to inner):

file
namespace    UE::Interchange::Private
function     void FillFbxMeshImportData

Source code excerpt:

		MeshImportData->bComputeWeightedNormals = GenericAssetPipeline->CommonMeshesProperties->bComputeWeightedNormals;
		MeshImportData->bImportMeshLODs = GenericAssetPipeline->CommonMeshesProperties->bImportLods;
		MeshImportData->bReorderMaterialToFbxOrder = true;
		MeshImportData->bTransformVertexToAbsolute = GenericAssetPipeline->CommonMeshesProperties->bBakeMeshes;

		if (GenericAssetPipeline->CommonMeshesProperties->bUseMikkTSpace)
		{
			MeshImportData->NormalGenerationMethod = EFBXNormalGenerationMethod::MikkTSpace;
		}

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

Scope (from outer to inner):

file
function     void FFbxImportUIDetails::CustomizeDetails

Source code excerpt:

		if (ImportUI->MeshTypeToImport == FBXIT_StaticMesh)
		{
			ReorderMaterialToFbxOrderProp = StaticMeshDataProp->GetChildHandle(GET_MEMBER_NAME_CHECKED(UFbxStaticMeshImportData, bReorderMaterialToFbxOrder));
		}
		else if (ImportUI->MeshTypeToImport == FBXIT_SkeletalMesh)
		{
			ReorderMaterialToFbxOrderProp = SkeletalMeshDataProp->GetChildHandle(GET_MEMBER_NAME_CHECKED(UFbxSkeletalMeshImportData, bReorderMaterialToFbxOrder));
		}
		//Add the advance reorder option at the end
		MaterialCategory.AddProperty(ReorderMaterialToFbxOrderProp);
	}

	//Information category

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Factories/FbxMeshImportData.h:88

Scope (from outer to inner):

file
class        class UFbxMeshImportData : public UFbxAssetImportData

Source code excerpt:

	/* If checked, The material list will be reorder to the same order has the FBX file. */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, config, AdvancedDisplay, Category = Material, meta = (OBJRestrict = "true"))
	bool bReorderMaterialToFbxOrder;

	bool CanEditChange( const FProperty* InProperty ) const override;

	//////////////////////////////////////////////////////////////////////////
	//Original import section/material data
	UPROPERTY()

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

Scope (from outer to inner):

file
namespace    UnFbx
function     void ApplyImportUIToImportOptions

Source code excerpt:

		InOutImportOptions.VertexColorImportOption	= StaticMeshData->VertexColorImportOption;
		InOutImportOptions.VertexOverrideColor		= StaticMeshData->VertexOverrideColor;
		InOutImportOptions.bReorderMaterialToFbxOrder = StaticMeshData->bReorderMaterialToFbxOrder;
		InOutImportOptions.DistanceFieldResolutionScale = StaticMeshData->DistanceFieldResolutionScale;
	}
	else if ( ImportUI->MeshTypeToImport == FBXIT_SkeletalMesh )
	{
		UFbxSkeletalMeshImportData* SkeletalMeshData	= ImportUI->SkeletalMeshImportData;
		InOutImportOptions.NormalImportMethod			= SkeletalMeshData->NormalImportMethod;

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

Scope (from outer to inner):

file
namespace    UnFbx
function     void ApplyImportUIToImportOptions

Source code excerpt:

		InOutImportOptions.VertexColorImportOption		= SkeletalMeshData->VertexColorImportOption;
		InOutImportOptions.VertexOverrideColor			= SkeletalMeshData->VertexOverrideColor;
		InOutImportOptions.bReorderMaterialToFbxOrder	= SkeletalMeshData->bReorderMaterialToFbxOrder;
		InOutImportOptions.bImportVertexAttributes		= SkeletalMeshData->bImportVertexAttributes;

		if(ImportUI->bImportAnimations)
		{
			// Copy the transform information into the animation data to match the mesh.
			UFbxAnimSequenceImportData* AnimData	= ImportUI->AnimSequenceImportData;

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

Scope (from outer to inner):

file
namespace    UnFbx
function     bool FFbxImporter::ImportFromFile

Source code excerpt:

						Attribs.Add(FAnalyticsEventAttribute(TEXT("GenOpt MaterialBasePath"), ImportOptions->MaterialBasePath));
						Attribs.Add(FAnalyticsEventAttribute(TEXT("GenOpt MaterialSearchLocation"), MaterialSearchLocationEnum->GetNameStringByValue((uint64)(ImportOptions->MaterialSearchLocation))));
						Attribs.Add(FAnalyticsEventAttribute(TEXT("GenOpt ReorderMaterialToFbxOrder"), ImportOptions->bReorderMaterialToFbxOrder));

						//We cant capture a this member, so just assign the pointer here
						FBXImportOptions* CaptureImportOptions = ImportOptions;
						auto AddMeshAnalytic = [&Attribs, &CaptureImportOptions]()
						{
							Attribs.Add(FAnalyticsEventAttribute(TEXT("MeshOpt AutoGenerateCollision"), CaptureImportOptions->bAutoGenerateCollision));

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMeshImportData.cpp:12

Scope (from outer to inner):

file
function     UFbxMeshImportData::UFbxMeshImportData

Source code excerpt:

	bComputeWeightedNormals = true;
	bBakePivotInVertex = false;
	bReorderMaterialToFbxOrder = true;
}

bool UFbxMeshImportData::CanEditChange(const FProperty* InProperty) const
{
	bool bMutable = Super::CanEditChange(InProperty);
	UObject* Outer = GetOuter();

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxStaticMeshImport.cpp:2444

Scope (from outer to inner):

file
function     void UnFbx::FFbxImporter::PostImportStaticMesh

Source code excerpt:

	if (LODIndex == 0 && StaticMesh->GetStaticMaterials().Num() > 1)
	{
		ReorderMaterialAfterImport(StaticMesh, MeshNodeArray, ImportOptions->bReorderMaterialToFbxOrder);
	}

#if WITH_EDITOR
	FMeshBudgetProjectSettingsUtils::SetLodGroupForStaticMesh(StaticMesh);
#endif
}

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

Scope (from outer to inner):

file
namespace    UnFbx

Source code excerpt:

	EMaterialSearchLocation MaterialSearchLocation;
	//If true the materials will be reorder to follow the fbx order
	bool bReorderMaterialToFbxOrder;
	// Skeletal Mesh options
	bool bImportMorph;
	bool bImportVertexAttributes;
	bool bImportAnimations;
	bool bUpdateSkeletonReferencePose;
	bool bResample;