<# .SYNOPSIS Runs build\ue_export_kit.py through the Unreal editor commandlet (no window, no GPU): dumps the Modular SciFi Season 1 Starter Bundle (meshes as FBX, textures as PNG, material and demo-map descriptions as JSON) into models\anchorage\kit_export. Read-only for the Unreal project. .EXAMPLE powershell -NoProfile -ExecutionPolicy Bypass -File build\ue_export_kit.ps1 powershell -NoProfile -ExecutionPolicy Bypass -File build\ue_export_kit.ps1 -Do maps -Maps SciFi_INT_EX1 #> [CmdletBinding()] param( [string]$Do = 'meshes,materials,textures,maps', [string]$Maps = '', [string]$Root = '/Game/StarterBundle', [string]$Out = '', # skeletal meshes need a render device to export (2026-10-21): -Render runs the commandlet on the GPU, offscreen [switch]$Render ) $ErrorActionPreference = 'Stop' $Here = $PSScriptRoot $Uproject = 'D:\HADAL - The Descent\TheDescentUE\TheDescent.uproject' $EditorCmd = 'E:\Tools\UE_5.8\Engine\Binaries\Win64\UnrealEditor-Cmd.exe' $Script = (Join-Path $Here 'ue_export_kit.py').Replace('\', '/') if (-not $Out) { $Out = Join-Path (Split-Path -Parent $Here) 'kit_export' } New-Item -ItemType Directory -Force -Path $Out | Out-Null $LogFile = Join-Path $Out 'ue_export_last.log' $env:UE_SDKS_ROOT = 'D:\HADAL - The Descent\.tools\AutoSDK' $env:KIT_OUT = $Out.Replace('\', '/') $env:KIT_ROOT = $Root $env:KIT_DO = $Do $env:KIT_MAPS = $Maps $rhi = if ($Render) { @('-AllowCommandletRendering', '-RenderOffscreen') } else { @('-nullrhi') } $argList = @( ('"' + $Uproject + '"'), '-run=pythonscript', ('-script="' + $Script + '"'), '-unattended', '-nosplash') + $rhi + @('-nosound', '-NoLiveCoding', ('-abslog="' + $LogFile + '"') ) $sw = [System.Diagnostics.Stopwatch]::StartNew() $proc = Start-Process -FilePath $EditorCmd -ArgumentList $argList -PassThru -WindowStyle Hidden $proc.WaitForExit() $sw.Stop() $lines = Get-Content $LogFile -ErrorAction SilentlyContinue $lines | Where-Object { $_ -match '\[kit\]' } | ForEach-Object { $_ -replace '^\[[0-9.:\-]+\]\[\s*\d+\]', '' } | ForEach-Object { Write-Host $_ } $done = $lines | Where-Object { $_ -match '\[kit\] \+\s*[0-9.]+s\s+DONE' } $secs = [math]::Round($sw.Elapsed.TotalSeconds, 1) if ($done) { Write-Host ("KIT EXPORT DONE exit={0} {1}s" -f $proc.ExitCode, $secs); exit 0 } Write-Host ("KIT EXPORT FAIL exit={0} {1}s log={2}" -f $proc.ExitCode, $secs, $LogFile) exit 1