r.MaterialEditor.AllowIgnoringCompilationErrors

r.MaterialEditor.AllowIgnoringCompilationErrors

#Overview

name: r.MaterialEditor.AllowIgnoringCompilationErrors

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.MaterialEditor.AllowIgnoringCompilationErrors is to control whether compilation errors in platform shaders and derived materials can be ignored in the Material Editor.

This setting variable is primarily used in the Material Editor subsystem of Unreal Engine 5. It’s referenced in the MaterialEditor module, specifically in the MaterialEditor.cpp and MaterialInstanceEditor.cpp files.

The value of this variable is set as a console variable (CVar) with a default value of true. It’s defined using TAutoConsoleVariable, which means it can be changed at runtime through the console or configuration files.

The associated variable CVarMaterialEdAllowIgnoringCompilationErrors directly interacts with r.MaterialEditor.AllowIgnoringCompilationErrors. They share the same value and purpose.

Developers must be aware that this variable affects how the Material Editor handles compilation errors. When set to true, it allows the editor to ignore certain compilation errors, which might be useful for rapid iteration but could potentially mask important issues.

Best practices when using this variable include:

  1. Use it cautiously, as ignoring compilation errors may lead to unexpected behavior in materials.
  2. Consider setting it to false when preparing for final builds to ensure all materials compile correctly.
  3. Be aware that changing this variable at runtime requires re-opening the Material Editor for the changes to take effect.

Regarding the associated variable CVarMaterialEdAllowIgnoringCompilationErrors:

Developers should treat CVarMaterialEdAllowIgnoringCompilationErrors as the programmatic interface to the r.MaterialEditor.AllowIgnoringCompilationErrors setting, using it when they need to check or modify this behavior in code.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/MaterialEditor/Private/MaterialEditor.cpp:192

Scope: file

Source code excerpt:


TAutoConsoleVariable<bool> CVarMaterialEdAllowIgnoringCompilationErrors(
	TEXT("r.MaterialEditor.AllowIgnoringCompilationErrors"),
	true,
	TEXT("Allow ignoring compilation errors of platform shaders and derived materials."));

///////////////////////////
// FMatExpressionPreview //
///////////////////////////

#Associated Variable and Callsites

This variable is associated with another variable named CVarMaterialEdAllowIgnoringCompilationErrors. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Editor/MaterialEditor/Private/MaterialEditor.cpp:191

Scope: file

Source code excerpt:

	TEXT("Limits amount of derived material instance shown in platform stats. Use negative number to disable the limit. Material editor must be re-opened if changed at runtime."));

TAutoConsoleVariable<bool> CVarMaterialEdAllowIgnoringCompilationErrors(
	TEXT("r.MaterialEditor.AllowIgnoringCompilationErrors"),
	true,
	TEXT("Allow ignoring compilation errors of platform shaders and derived materials."));

///////////////////////////
// FMatExpressionPreview //

#Loc: <Workspace>/Engine/Source/Editor/MaterialEditor/Private/MaterialEditor.cpp:570

Scope (from outer to inner):

file
function     void FMaterialEditor::InitMaterialEditor

Source code excerpt:

	GEditor->RegisterForUndo(this);

	MaterialStatsManager = FMaterialStatsUtils::CreateMaterialStats(this, true, CVarMaterialEdAllowIgnoringCompilationErrors.GetValueOnGameThread());
	MaterialStatsManager->SetMaterialsDisplayNames({OriginalMaterial->GetName()});
	MaterialStatsManager->GetOldStatsListing()->OnMessageTokenClicked().AddSP(this, &FMaterialEditor::OnMessageLogLinkActivated);

	if (!Material->MaterialGraph)
	{
		Material->MaterialGraph = CastChecked<UMaterialGraph>(FBlueprintEditorUtils::CreateNewGraph(Material, NAME_None, UMaterialGraph::StaticClass(), UMaterialGraphSchema::StaticClass()));

#Loc: <Workspace>/Engine/Source/Editor/MaterialEditor/Private/MaterialInstanceEditor.cpp:69

Scope: file

Source code excerpt:

const FName FMaterialInstanceEditor::PreviewSettingsTabId(TEXT("MaterialInstanceEditor_PreviewSettings"));

extern TAutoConsoleVariable<bool> CVarMaterialEdAllowIgnoringCompilationErrors;

//////////////////////////////////////////////////////////////////////////
// SMaterialTreeWidgetItem
class SMaterialTreeWidgetItem : public SMultiColumnTableRow< TWeakObjectPtr<UMaterialInterface> >
{
public:

#Loc: <Workspace>/Engine/Source/Editor/MaterialEditor/Private/MaterialInstanceEditor.cpp:416

Scope (from outer to inner):

file
function     void FMaterialInstanceEditor::InitMaterialInstanceEditor

Source code excerpt:

	MaterialEditorInstance->SetSourceFunction(MaterialFunctionOriginal);

	MaterialStatsManager = FMaterialStatsUtils::CreateMaterialStats(this, false, CVarMaterialEdAllowIgnoringCompilationErrors.GetValueOnGameThread());
	MaterialStatsManager->SetMaterialsDisplayNames({MaterialEditorInstance->SourceInstance->GetName()});

	// Register our commands. This will only register them if not previously registered
	FMaterialEditorCommands::Register();

	CreateInternalWidgets();