From a340cc58dd2768e88dd9bec210ff181b0654cb85 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Tue, 6 Oct 2020 16:52:06 +0100 Subject: [PATCH] Warn about unmatched map names, and exit early when no maps are matched --- ue4-rebuild-lightmaps.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ue4-rebuild-lightmaps.ps1 b/ue4-rebuild-lightmaps.ps1 index 9a24177..b8e87e9 100644 --- a/ue4-rebuild-lightmaps.ps1 +++ b/ue4-rebuild-lightmaps.ps1 @@ -61,12 +61,19 @@ try { if ($maps) { # Explicit list of maps provided on command line $mapsToRebuild = Find-File-Set -startDir:$(Join-Path $src "Content") -pattern:*.umap -includeByDefault:$false -includeBaseNames:$maps + + if ($mapsToRebuild.Count -ne $maps.Count) { + Write-Warning "Ignoring missing map(s): $($maps | Where-Object { $_ -notin $mapsToRebuild })" + } } else { # Derive maps from cook settings $mapsToRebuild = Find-File-Set -startDir:$(Join-Path $src "Content") -pattern:*.umap -includeByDefault:$config.CookAllMaps -includeBaseNames:$config.MapsIncluded -excludeBaseNames:$config.MapsExcluded } - # TODO check maps not found + if ($mapsToRebuild.Count -eq 0) { + throw "No maps found to rebuild" + } + # TODO lock map files if read-only if (-not $quality) { @@ -114,6 +121,7 @@ try { } catch { Write-Output $_.Exception.Message + Write-Output "~-~-~ UE4 Lightmap Rebuild FAILED ~-~-~" Exit 9 }