mirror of
https://github.com/sinbad/UEScripts.git
synced 2025-02-23 13:15:23 +00:00
Close the UE editor automatically
This commit is contained in:
parent
b55086e28c
commit
d32cb280b6
26
inc/ueeditor.ps1
Normal file
26
inc/ueeditor.ps1
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
function Close-UE-Editor {
|
||||||
|
param (
|
||||||
|
[string]$uprojectname,
|
||||||
|
[bool]$dryrun
|
||||||
|
)
|
||||||
|
|
||||||
|
# Filter by project name in main window title, it's always called "Project - Unreal Editor"
|
||||||
|
$ue4proc = Get-Process UE4Editor -ErrorAction SilentlyContinue | Where-Object {$_.MainWindowTitle -like "$uprojectname*" }
|
||||||
|
if ($ue4proc) {
|
||||||
|
if ($dryrun) {
|
||||||
|
Write-Output "UE4 project is currently open in editor, would have closed"
|
||||||
|
} else {
|
||||||
|
Write-Output "UE4 project is currently open in editor, closing..."
|
||||||
|
$ue4proc.CloseMainWindow() > $null
|
||||||
|
Start-Sleep 5
|
||||||
|
if (!$ue4proc.HasExited) {
|
||||||
|
throw "Couldn't close UE4 gracefully, aborting!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Verbose "UE4 project is not open in editor"
|
||||||
|
}
|
||||||
|
Remove-Variable ue4proc
|
||||||
|
|
||||||
|
}
|
@ -23,6 +23,7 @@ param (
|
|||||||
. $PSScriptRoot\inc\projectversion.ps1
|
. $PSScriptRoot\inc\projectversion.ps1
|
||||||
. $PSScriptRoot\inc\uproject.ps1
|
. $PSScriptRoot\inc\uproject.ps1
|
||||||
. $PSScriptRoot\inc\ueinstall.ps1
|
. $PSScriptRoot\inc\ueinstall.ps1
|
||||||
|
. $PSScriptRoot\inc\ueeditor.ps1
|
||||||
|
|
||||||
|
|
||||||
function Write-Usage {
|
function Write-Usage {
|
||||||
@ -176,6 +177,11 @@ try {
|
|||||||
if ($src -ne ".") { Pop-Location }
|
if ($src -ne ".") { Pop-Location }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$editorprojname = [System.IO.Path]::GetFileNameWithoutExtension($projfile)
|
||||||
|
Close-UE-Editor $editorprojname $dryrun
|
||||||
|
|
||||||
|
|
||||||
$ueEditorCmd = Join-Path $ueinstall "Engine/Binaries/Win64/UE4Editor-Cmd$exeSuffix"
|
$ueEditorCmd = Join-Path $ueinstall "Engine/Binaries/Win64/UE4Editor-Cmd$exeSuffix"
|
||||||
$runUAT = Join-Path $ueinstall "Engine/Build/BatchFiles/RunUAT$batchSuffix"
|
$runUAT = Join-Path $ueinstall "Engine/Build/BatchFiles/RunUAT$batchSuffix"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user