Prevent landscape material instances validation/recompilation if not in the editor or a commandlet (we cannot re-build material instance constants otherwise)

#rb sebastien.lussier
#jira UE-138693
#preflight 61dd5f03917ab97716a96332

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 18571500 via CL 18571516 via CL 18571531 via CL 18571972 via CL 18571996 via CL 18572025
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Test -> Main) (v899-18417669)

[CL 18572047 by jonathan bard in ue5-main branch]
This commit is contained in:
jonathan bard
2022-01-11 10:17:30 -05:00

View File

@@ -2577,8 +2577,8 @@ void ALandscapeProxy::PostLoad()
if (UMaterialInstance* MaterialInstance = Comp->GetMaterialInstance(0, false))
{
UMaterialInstanceConstant* CombinationMaterialInstance = Cast<UMaterialInstanceConstant>(MaterialInstance->Parent);
// Only validate if uncooked
if (!Comp->GetOutermost()->HasAnyPackageFlags(PKG_FilterEditorOnly))
// Only validate if uncooked and in the editor/commandlet mode (we cannot re-build material instance constants if this is not the case : see UMaterialInstance::CacheResourceShadersForRendering, which is only called if FApp::CanEverRender() returns true)
if (!Comp->GetOutermost()->HasAnyPackageFlags(PKG_FilterEditorOnly) && (GIsEditor && FApp::CanEverRender()))
{
if (Comp->ValidateCombinationMaterial(CombinationMaterialInstance))
{