MakeMaterialsCheck

MakeMaterialsCheck

#Overview

name: MakeMaterialsCheck

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 MakeMaterialsCheck is to control whether materials should be created during the SpeedTree import process in Unreal Engine 5. This setting variable is primarily used in the SpeedTree importer plugin, which is responsible for importing SpeedTree assets into the Unreal Engine environment.

The SpeedTree importer plugin relies on this setting variable to determine if it should generate materials for the imported SpeedTree assets. It is used in both SpeedTree version 7 and 8 import processes.

The value of this variable is set through the Unreal Engine editor interface. It is defined as a UPROPERTY in the USpeedTreeImportData class, which means it can be edited in the editor’s property window when configuring SpeedTree import settings.

MakeMaterialsCheck interacts with several other variables, such as:

  1. IncludeNormalMapCheck
  2. IncludeDetailMapCheck
  3. IncludeSpecularMapCheck
  4. IncludeBranchSeamSmoothing
  5. IncludeSpeedTreeAO
  6. IncludeColorAdjustment

These variables are used to fine-tune the material creation process when MakeMaterialsCheck is enabled.

Developers must be aware that:

  1. When MakeMaterialsCheck is false, the importer will use the default surface material instead of creating custom materials for the SpeedTree asset.
  2. Enabling this option may increase import time and resource usage, as it involves creating new materials.
  3. The created materials may need further customization after import to achieve the desired look.

Best practices when using this variable include:

  1. Enable MakeMaterialsCheck when you need custom materials for your SpeedTree assets and are willing to invest time in potential post-import material adjustments.
  2. Disable it if you plan to create materials manually or use existing materials for your SpeedTree assets.
  3. Consider the performance impact of creating multiple materials, especially for large-scale environments with many SpeedTree instances.
  4. Review and adjust the related material settings (normal maps, detail maps, etc.) to optimize the generated materials for your specific use case.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:944, section: [/Script/SpeedTreeImporter.SpeedTreeImportData]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Editor/SpeedTreeImporter/Source/SpeedTreeImporter/Classes/SpeedTreeImportData.h:65

Scope (from outer to inner):

file
class        class USpeedTreeImportData : public UAssetImportData

Source code excerpt:

	/**  */
	UPROPERTY(EditAnywhere, config, Category=Materials, meta = (DisplayName = "Create Materials", SpeedTreeVersion = "8"))
	uint32 MakeMaterialsCheck : 1;
	
	/**  */
	UPROPERTY(EditAnywhere, config, Category = Materials, meta = (EditCondition = "MakeMaterialsCheck", DisplayName = "Include Normal Maps"))
	uint32 IncludeNormalMapCheck : 1;
	
	/**  */

#Loc: <Workspace>/Engine/Plugins/Editor/SpeedTreeImporter/Source/SpeedTreeImporter/Private/SpeedTreeImportData.cpp:40

Scope (from outer to inner):

file
function     void USpeedTreeImportData::CopyFrom

Source code excerpt:

	LODType = Other->LODType;
	IncludeCollision = Other->IncludeCollision;
	MakeMaterialsCheck = Other->MakeMaterialsCheck;
	IncludeNormalMapCheck = Other->IncludeNormalMapCheck;
	IncludeDetailMapCheck = Other->IncludeDetailMapCheck;
	IncludeSpecularMapCheck = Other->IncludeSpecularMapCheck;
	IncludeBranchSeamSmoothing = Other->IncludeBranchSeamSmoothing;
	IncludeSpeedTreeAO = Other->IncludeSpeedTreeAO;
	IncludeColorAdjustment = Other->IncludeColorAdjustment;

#Loc: <Workspace>/Engine/Plugins/Editor/SpeedTreeImporter/Source/SpeedTreeImporter/Private/SpeedTreeImportData.cpp:99

Scope (from outer to inner):

file
function     void FSpeedTreeImportDataDetails::CustomizeDetails

Source code excerpt:

	
	//We have to make the logic for vertex processing
	TSharedRef<IPropertyHandle> MakeMaterialsCheckProp = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(USpeedTreeImportData, MakeMaterialsCheck));
	MakeMaterialsCheckProp->SetOnPropertyValueChanged(FSimpleDelegate::CreateSP(this, &FSpeedTreeImportDataDetails::OnForceRefresh));

	TSharedRef<IPropertyHandle> IncludeVertexProcessingCheckProp = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(USpeedTreeImportData, IncludeVertexProcessingCheck));
	IncludeVertexProcessingCheckProp->SetOnPropertyValueChanged(FSimpleDelegate::CreateSP(this, &FSpeedTreeImportDataDetails::OnForceRefresh));

	//Hide all properties, we will show them in the correct order with the correct grouping

#Loc: <Workspace>/Engine/Plugins/Editor/SpeedTreeImporter/Source/SpeedTreeImporter/Private/SpeedTreeImportData.cpp:112

Scope (from outer to inner):

file
function     void FSpeedTreeImportDataDetails::CustomizeDetails

Source code excerpt:


	MaterialsCategoryBuilder.AddProperty(MakeMaterialsCheckProp);
	if (SpeedTreeImportData->MakeMaterialsCheck)
	{
		for (TSharedRef<IPropertyHandle> Handle : MaterialCategoryDefaultProperties)
		{
			// skip any properties that don't match speedtree 8
			const FString& SpeedTreeMetaData = Handle->GetMetaData(TEXT("SpeedTreeVersion"));
			if (bSpeedTree8 && SpeedTreeMetaData.Compare(TEXT("8")) != 0)

#Loc: <Workspace>/Engine/Plugins/Editor/SpeedTreeImporter/Source/SpeedTreeImporter/Private/SpeedTreeImportFactory.cpp:669

Scope (from outer to inner):

file
function     UMaterialInterface* CreateSpeedTreeMaterial7

Source code excerpt:

{
	// Make sure we have a parent
	if (!SpeedTreeImportData->MakeMaterialsCheck || !ensure(Parent))
	{
		return UMaterial::GetDefaultMaterial(MD_Surface);
	}
	
	if (auto* Material = ImportContext.ImportedMaterials.Find(MaterialFullName))
	{

#Loc: <Workspace>/Engine/Plugins/Editor/SpeedTreeImporter/Source/SpeedTreeImporter/Private/SpeedTreeImportFactory.cpp:1000

Scope (from outer to inner):

file
function     UMaterialInterface* CreateSpeedTreeMaterial8

Source code excerpt:

{
	// Make sure we have a parent
	if (!SpeedTreeImportData->MakeMaterialsCheck || !ensure(Parent))
	{
		return UMaterial::GetDefaultMaterial(MD_Surface);
	}

	if (auto* Material = ImportContext.ImportedMaterials.Find(MaterialFullName))
	{