First try UE5 compatibility update

This commit is contained in:
Steve Streeting 2022-04-19 12:07:09 +01:00
parent cf9ce9b1da
commit e87b45e948
22 changed files with 213 additions and 143 deletions

View File

@ -1,9 +1,9 @@
# Steve's UE4 Scripts # Steve's Unreal Scripts
## Summary ## Summary
These scripts are to help with various tasks in [Unreal Engine 4](https://www.unrealengine.com). These scripts are to help with various tasks in [Unreal Engine](https://www.unrealengine.com).
They're written on the basis of using Git / Git LFS rather than Perforce (many of UE4's own They're written on the basis of using Git / Git LFS rather than Perforce (many of Unreal's own
automation tools assume P4, which can be inconvenient). automation tools assume P4, which can be inconvenient).
* [Setting up a project for Git / Git-LFS](./doc/GitSetup.md): including LFS locking * [Setting up a project for Git / Git-LFS](./doc/GitSetup.md): including LFS locking

View File

@ -12,7 +12,7 @@ The script also cleans up Live Coding patches but there's fewer of those.
-src : Source folder (current folder if omitted) -src : Source folder (current folder if omitted)
: (should be root of project) : (should be root of project)
-nocloseeditor : Don't close UE4 editor (this will prevent DLL cleanup) -nocloseeditor : Don't close Unreal editor (this will prevent DLL cleanup)
-lfsprune : Call 'git lfs prune' to delete old LFS files as well -lfsprune : Call 'git lfs prune' to delete old LFS files as well
-dryrun : Don't perform any actual actions, just report on what you would do -dryrun : Don't perform any actual actions, just report on what you would do
-help : Print this help -help : Print this help

View File

@ -56,7 +56,7 @@ Usage:
-mode : Whether to push or pull the built data from your filesystem -mode : Whether to push or pull the built data from your filesystem
-root : Root folder to sync files to/from. Project name will be appended to this path. -root : Root folder to sync files to/from. Project name will be appended to this path.
: Can be blank if specified in UE4SYNCROOT : Can be blank if specified in UESYNCROOT
-src : Source folder (current folder if omitted) -src : Source folder (current folder if omitted)
: (should be root of project) : (should be root of project)
-prune : Clean up versions of the data older than the latest -prune : Clean up versions of the data older than the latest
@ -67,15 +67,15 @@ Usage:
-help : Print this help -help : Print this help
Environment Variables: Environment Variables:
UE4SYNCROOT : Root path to sync data. Subfolders for each project name. UESYNCROOT : Root path to sync data. Subfolders for each project name.
UE4INSTALL : Use a specific UE4 install. UEINSTALL : Use a specific Unreal install.
: Default is to find one based on project version, under UE4ROOT : Default is to find one based on project version, under UEROOT
UE4ROOT : Parent folder of all binary UE4 installs (detects version). UEROOT : Parent folder of all binary Unreal installs (detects version).
: Default C:\Program Files\Epic Games : Default C:\Program Files\Epic Games
``` ```
You must tell the sync tool where the shared drive is, either using the `-root` You must tell the sync tool where the shared drive is, either using the `-root`
argument, or defining the `UE4SYNCROOT` environment variable. A project folder argument, or defining the `UESYNCROOT` environment variable. A project folder
will be added below that, based on the name of your .uproject file, so that will be added below that, based on the name of your .uproject file, so that
you can use the same root folder for multiple projects. you can use the same root folder for multiple projects.
@ -87,7 +87,7 @@ what happens in each mode.
> Example: `ue4-datasync.ps1 push` > Example: `ue4-datasync.ps1 push`
> >
> Assuming you run this in your project root and have defined the environment variable UE4SYNCROOT > Assuming you run this in your project root and have defined the environment variable UESYNCROOT
In push mode, you want to upload BuiltData files you've updated, probably because of a In push mode, you want to upload BuiltData files you've updated, probably because of a
change to the .umap. You have to have committed your changes to the .umap first, change to the .umap. You have to have committed your changes to the .umap first,
@ -109,7 +109,7 @@ umap on this shared drive, without it being in the git repo.
> Example: `ue4-datasync.ps1 pull` > Example: `ue4-datasync.ps1 pull`
> >
> Assuming you run this in your project root and have defined the environment variable UE4SYNCROOT > Assuming you run this in your project root and have defined the environment variable UESYNCROOT
In pull mode, the script tries to find the BuiltData files corresponding to your In pull mode, the script tries to find the BuiltData files corresponding to your
umap files on the shared drive. Again, you can't have any uncommitted changes to umap files on the shared drive. Again, you can't have any uncommitted changes to

View File

@ -4,7 +4,7 @@ We've found it useful to provide a simple script which can be run on artists'
machines to get the latest from Git, and make sure all the C++ components are machines to get the latest from Git, and make sure all the C++ components are
built. built.
It now also automatically calls `ue4-datasync.ps1 pull` if `UE4SYNCROOT` is defined It now also automatically calls `ue4-datasync.ps1 pull` if `UESYNCROOT` is defined
in the environment. in the environment.
While the UE editor can sometimes do this successfully on startup as well, While the UE editor can sometimes do this successfully on startup as well,
@ -20,7 +20,7 @@ project to make sure the build is successful.
-src : Source folder (current folder if omitted) -src : Source folder (current folder if omitted)
: (should be root of project) : (should be root of project)
-nocloseeditor : Don't close UE4 editor (this will prevent DLL cleanup) -nocloseeditor : Don't close Unreal editor (this will prevent DLL cleanup)
-dryrun : Don't perform any actual actions, just report on what you would do -dryrun : Don't perform any actual actions, just report on what you would do
-help : Print this help -help : Print this help
``` ```

View File

@ -13,7 +13,7 @@ you might want to keep an eye on that.
We use a this content workflow in our UE game repositories: We use a this content workflow in our UE game repositories:
1. All content creation files in `$REPO/MediaSrc` (subfolders by type) 1. All content creation files in `$REPO/MediaSrc` (subfolders by type)
* These are typically in formats e.g. Blender that UE4 doesn't read directly, so outside `Content` * These are typically in formats e.g. Blender that Unreal doesn't read directly, so outside `Content`
* These files are added to Git * These files are added to Git
* They are also tracked as Git LFS files * They are also tracked as Git LFS files
* They are NOT marked as lockable, simply because the tooling for managing locking * They are NOT marked as lockable, simply because the tooling for managing locking

View File

@ -5,7 +5,7 @@ much like using "File > Package Project" in the UE editor. However, it offers a
number of other features. number of other features.
This script operates based on a `packageconfig.json` file which must be present This script operates based on a `packageconfig.json` file which must be present
in the root of your UE4 project. Please see the [Package Config File docs](PackageConfig.md) in the root of your Unreal project. Please see the [Package Config File docs](PackageConfig.md)
for a full description of this file. for a full description of this file.
``` ```
@ -26,9 +26,9 @@ for a full description of this file.
-help : Print this help -help : Print this help
Environment Variables: Environment Variables:
UE4INSTALL : Use a specific UE4 install. UEINSTALL : Use a specific Unreal install.
: Default is to find one based on project version, under UE4ROOT : Default is to find one based on project version, under UEROOT
UE4ROOT : Parent folder of all binary UE4 installs (detects version). UEROOT : Parent folder of all binary Unreal installs (detects version).
: Default C:\Program Files\Epic Games : Default C:\Program Files\Epic Games
``` ```
@ -42,10 +42,10 @@ are always from a known version.
### 2. Locate UE Install ### 2. Locate UE Install
The script can locate your UE4 install automatically. You may need to customise The script can locate your Unreal install automatically. You may need to customise
this on non-Windows platforms or if you use a source build. this on non-Windows platforms or if you use a source build.
See [How Scripts Locate the UE4 Install](UEInstall.md) for more details. See [How Scripts Locate the Unreal Install](UEInstall.md) for more details.
### 3. Close the UE Editor ### 3. Close the UE Editor

View File

@ -6,7 +6,7 @@ Many of the tools in this repo, such as the [Packaging Script](./Package.md)
and the [Release Script](./Release.md), depend on a configuration file named and the [Release Script](./Release.md), depend on a configuration file named
`packageconfig.json`. `packageconfig.json`.
This file should be in the root of your UE4 project. It's contents are set out This file should be in the root of your Unreal project. It's contents are set out
in detail later in this document, but but here's an example demonstrating many of the features: in detail later in this document, but but here's an example demonstrating many of the features:
```json ```json
@ -173,7 +173,7 @@ Unreal, e.g. "Win64", "Linux" etc
### `Configuration` ### `Configuration`
*Mandatory Setting - string* *Mandatory Setting - string*
The build configuration for this variant as defined by UE4, e.g. "Development" or "Shipping". The build configuration for this variant as defined by Unreal, e.g. "Development" or "Shipping".
### `ExtraBuildArguments` ### `ExtraBuildArguments`
*Optional Setting - string* *Optional Setting - string*

View File

@ -24,8 +24,8 @@ explicitly list them as arguments:
-help : Print this help -help : Print this help
Environment Variables: Environment Variables:
UE4INSTALL : Use a specific UE4 install. UEINSTALL : Use a specific Unreal install.
: Default is to find one based on project version, under UE4ROOT : Default is to find one based on project version, under UEROOT
UE4ROOT : Parent folder of all binary UE4 installs (detects version). UEROOT : Parent folder of all binary Unreal installs (detects version).
: Default C:\Program Files\Epic Games : Default C:\Program Files\Epic Games
``` ```

View File

@ -1,13 +1,13 @@
# How Scripts Locate the UE4 Install # How Scripts Locate the Unreal Install
If you're using an installed version of UE4, the script reads your project file If you're using an installed version of Unreal, the script reads your project file
and automatically finds the location of the tools. and automatically finds the location of the tools.
If you're using a source version of UE, or have installed in a non-standard location, If you're using a source version of UE, or have installed in a non-standard location,
you can define the following environment variables instead: you can define the following environment variables instead:
* **UE4ROOT** : Set the root directory of installed versions of UE4 (instead of the default e.g. C:\Program Files\Epic Games). The script will find the correct version in subfolders e.g. UE_4.25 * **UEROOT** : Set the root directory of installed versions of Unreal (instead of the default e.g. C:\Program Files\Epic Games). The script will find the correct version in subfolders e.g. UE_4.27, UE_5.0
* **UE4INSTALL**: Explicitly set the location of the UE4 build you want to use. * **UEINSTALL**: Explicitly set the location of the Unreal build you want to use.
The script will just use this directly and assume it contains e.g. Engine/Build/BatchFiles The script will just use this directly and assume it contains e.g. Engine/Build/BatchFiles

View File

@ -47,8 +47,8 @@ class PackageVariant {
# Our config for both building and releasing # Our config for both building and releasing
# Note that environment variables also have an effect: # Note that environment variables also have an effect:
# - UE4INSTALL: a specific UE install to use (default blank, find a version in UE4ROOT) # - UEINSTALL: a specific UE install to use (default blank, find a version in UEROOT)
# - UE4ROOT: Parent folder of all binary UE4 installs (default C:\Program Files\Epic Games) # - UEROOT: Parent folder of all binary UE installs (default C:\Program Files\Epic Games)
class PackageConfig { class PackageConfig {
# The root of the folder structure which will contain packaged output # The root of the folder structure which will contain packaged output
# Will be structured $OutputDir/$version/$variant # Will be structured $OutputDir/$version/$variant

View File

@ -30,7 +30,7 @@ function Release-Steam {
# Preview mode in Steam build just outputs logs so it's dryrun # Preview mode in Steam build just outputs logs so it's dryrun
$preview = if($dryrun) { "1" } else { "0"} $preview = if($dryrun) { "1" } else { "0"}
# Use the UE4 platform as Steam target # Use the UE platform as Steam target
$target = $variant.Platform $target = $variant.Platform
# write app file up to depot section then fill that in as we do depots # write app file up to depot section then fill that in as we do depots

View File

@ -18,9 +18,24 @@ function Close-UE-Editor {
throw "Couldn't close UE4 gracefully, aborting!" throw "Couldn't close UE4 gracefully, aborting!"
} }
} }
} else {
Write-Verbose "UE4 project is not open in editor"
} }
Remove-Variable ue4proc Remove-Variable ue4proc
# Also close UE5
$ue5proc = Get-Process UEEditor -ErrorAction SilentlyContinue | Where-Object {$_.MainWindowTitle -like "$uprojectname*" }
if ($ue5proc) {
if ($dryrun) {
Write-Output "UE5 project is currently open in editor, would have closed"
} else {
Write-Output "UE5 project is currently open in editor, closing..."
$ue5proc.CloseMainWindow() > $null
Start-Sleep 5
if (!$ue5proc.HasExited) {
throw "Couldn't close UE5 gracefully, aborting!"
}
}
}
Remove-Variable ue5proc
} }

View File

@ -1,29 +0,0 @@
function Get-UE-Install {
param (
[string]$ueVersion
)
# UE4INSTALL env var should point at the root of the *specific version* of
# UE4 you want to use. This is mainly for use in source builds, default is
# to build it from version number and root of all UE4 binary installs
$uinstall = $Env:UE4INSTALL
if (-not $uinstall) {
# UE4ROOT should be the parent folder of all UE versions
$uroot = $Env:UE4ROOT
if (-not $uroot) {
$uroot = "C:\Program Files\Epic Games"
}
$uinstall = Join-Path $uroot "UE_$ueVersion"
}
# Test we can find RunUAT.bat
$batchfolder = Join-Path "$uinstall" "Engine\Build\BatchFiles"
$buildbat = Join-Path "$batchfolder" "RunUAT.bat"
if (-not (Test-Path $buildbat -PathType Leaf)) {
throw "RunUAT.bat missing at $buildbat : Not a valid UE install"
}
return $uinstall
}

View File

@ -49,3 +49,66 @@ function Get-UE-Version {
return $uproject.EngineAssociation return $uproject.EngineAssociation
} }
function Get-Is-UE5 {
param (
# the uproject object from Read-Uproject
[string]$ueVersion
)
return $ueVersion.StartsWith("5.")
}
function Get-UE-Install {
param (
[string]$ueVersion
)
# UEINSTALL env var should point at the root of the *specific version* of
# UE you want to use. This is mainly for use in source builds, default is
# to build it from version number and root of all UE binary installs
$uinstall = $Env:UEINSTALL
# Backwards compat
if (-not $uinstall) {
$uinstall = $Env:UE4INSTALL
}
if (-not $uinstall) {
# UEROOT should be the parent folder of all UE versions
$uroot = $Env:UEROOT
# Bakwards compat
if (-not $uroot) {
$uroot = $Env:UE4ROOT
}
if (-not $uroot) {
$uroot = "C:\Program Files\Epic Games"
}
$uinstall = Join-Path $uroot "UE_$ueVersion"
}
# Test we can find RunUAT.bat
$batchfolder = Join-Path "$uinstall" "Engine\Build\BatchFiles"
$buildbat = Join-Path "$batchfolder" "RunUAT.bat"
if (-not (Test-Path $buildbat -PathType Leaf)) {
throw "RunUAT.bat missing at $buildbat : Not a valid UE install"
}
return $uinstall
}
function Get-UEEditorCmd {
param (
[string]$ueVersion,
[string]$ueInstall
)
if ((Get-Is-UE5 $ueVersion)) {
return Join-Path $ueInstall "Engine/Binaries/Win64/UnrealEditor-Cmd$exeSuffix"
} else {
return Join-Path $ueInstall "Engine/Binaries/Win64/UE4Editor-Cmd$exeSuffix"
}
}

View File

@ -14,14 +14,13 @@ param (
. $PSScriptRoot\inc\packageconfig.ps1 . $PSScriptRoot\inc\packageconfig.ps1
. $PSScriptRoot\inc\projectversion.ps1 . $PSScriptRoot\inc\projectversion.ps1
. $PSScriptRoot\inc\uproject.ps1 . $PSScriptRoot\inc\uproject.ps1
. $PSScriptRoot\inc\ueinstall.ps1
. $PSScriptRoot\inc\filetools.ps1 . $PSScriptRoot\inc\filetools.ps1
# Include Git tools locking # Include Git tools locking
. $PSScriptRoot\GitScripts\inc\locking.ps1 . $PSScriptRoot\GitScripts\inc\locking.ps1
function Write-Usage { function Write-Usage {
Write-Output "Steve's UE4 Blueprint recompile tool" Write-Output "Steve's Unreal Blueprint recompile tool"
Write-Output "Usage:" Write-Output "Usage:"
Write-Output " ue4-blueprint-recompile.ps1 [-src:sourcefolder] [-bpdir:blueprintdir] [-dryrun]" Write-Output " ue4-blueprint-recompile.ps1 [-src:sourcefolder] [-bpdir:blueprintdir] [-dryrun]"
Write-Output " " Write-Output " "
@ -31,9 +30,9 @@ function Write-Usage {
Write-Output " -help : Print this help" Write-Output " -help : Print this help"
Write-Output " " Write-Output " "
Write-Output "Environment Variables:" Write-Output "Environment Variables:"
Write-Output " UE4INSTALL : Use a specific UE4 install." Write-Output " UEINSTALL : Use a specific UE install."
Write-Output " : Default is to find one based on project version, under UE4ROOT" Write-Output " : Default is to find one based on project version, under UEROOT"
Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). "
Write-Output " : Default C:\Program Files\Epic Games" Write-Output " : Default C:\Program Files\Epic Games"
Write-Output " " Write-Output " "
} }
@ -50,7 +49,7 @@ if ($help) {
Exit 0 Exit 0
} }
Write-Output "~-~-~ UE4 Blueprint Recompile Start ~-~-~" Write-Output "~-~-~ Unreal Blueprint Recompile Start ~-~-~"
try { try {
@ -75,7 +74,7 @@ try {
$argList.Add("-packagefolder=`"$bpfullpath`"") > $null $argList.Add("-packagefolder=`"$bpfullpath`"") > $null
$argList.Add("-autocheckout") > $null $argList.Add("-autocheckout") > $null
$ueEditorCmd = Join-Path $ueinstall "Engine/Binaries/Win64/UE4Editor-Cmd$exeSuffix" $ueEditorCmd = Get-UEEditorCmd $ueVersion $ueinstall
if ($dryrun) { if ($dryrun) {
Write-Output "Would have run:" Write-Output "Would have run:"
@ -91,13 +90,13 @@ try {
} catch { } catch {
Write-Output $_.Exception.Message Write-Output $_.Exception.Message
Write-Output "~-~-~ UE4 Blueprint Recompile FAILED ~-~-~" Write-Output "~-~-~ Unreal Blueprint Recompile FAILED ~-~-~"
Exit 9 Exit 9
} }
Write-Output "~-~-~ UE4 Blueprint Recompile OK ~-~-~" Write-Output "~-~-~ Unreal Blueprint Recompile OK ~-~-~"
if (!$dryrun) { if (!$dryrun) {
Write-Output "Reminder: You may need to commit and unlock Blueprint files" Write-Output "Reminder: You may need to commit and unlock Blueprint files"
} }

View File

@ -8,7 +8,7 @@ param (
) )
function Print-Usage { function Print-Usage {
Write-Output "Steve's UE4 Build Tool" Write-Output "Steve's Unreal Build Tool"
Write-Output " This is a WIP, only builds for dev right now" Write-Output " This is a WIP, only builds for dev right now"
Write-Output "Usage:" Write-Output "Usage:"
Write-Output " ue4-build.ps1 [[-mode:]<dev|test|prod>] [[-src:]sourcefolder] [Options]" Write-Output " ue4-build.ps1 [[-mode:]<dev|test|prod>] [[-src:]sourcefolder] [Options]"
@ -20,14 +20,14 @@ function Print-Usage {
Write-Output " : prod = build Shipping and package for production (TODO)" Write-Output " : prod = build Shipping and package for production (TODO)"
Write-Output " -src : Source folder (current folder if omitted)" Write-Output " -src : Source folder (current folder if omitted)"
Write-Output " : (should be root of project)" Write-Output " : (should be root of project)"
Write-Output " -nocloseeditor : Don't close UE4 editor (this will prevent DLL cleanup)" Write-Output " -nocloseeditor : Don't close Unreal editor (this will prevent DLL cleanup)"
Write-Output " -dryrun : Don't perform any actual actions, just report on what you would do" Write-Output " -dryrun : Don't perform any actual actions, just report on what you would do"
Write-Output " -help : Print this help" Write-Output " -help : Print this help"
Write-Output " " Write-Output " "
Write-Output "Environment Variables:" Write-Output "Environment Variables:"
Write-Output " UE4INSTALL : Use a specific UE4 install." Write-Output " UEINSTALL : Use a specific Unreal install."
Write-Output " : Default is to find one based on project version, under UE4ROOT" Write-Output " : Default is to find one based on project version, under UEROOT"
Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). "
Write-Output " : Default C:\Program Files\Epic Games" Write-Output " : Default C:\Program Files\Epic Games"
Write-Output " " Write-Output " "
@ -60,7 +60,7 @@ try {
Write-Output "-- Build process starting --" Write-Output "-- Build process starting --"
# Locate UE4 project file # Locate Unreal project file
$uprojfile = Get-ChildItem *.uproject | Select-Object -expand Name $uprojfile = Get-ChildItem *.uproject | Select-Object -expand Name
if (-not $uprojfile) { if (-not $uprojfile) {
throw "No Unreal project file found in $(Get-Location)! Aborting." throw "No Unreal project file found in $(Get-Location)! Aborting."
@ -77,21 +77,30 @@ try {
Write-Output "Building $uprojname for $mode" Write-Output "Building $uprojname for $mode"
} }
# Check version number of UE4 project so we know which version to run # Check version number of Unreal project so we know which version to run
# We can read this from .uproject which is JSON # We can read this from .uproject which is JSON
$uproject = Get-Content $uprojfile | ConvertFrom-Json $uproject = Get-Content $uprojfile | ConvertFrom-Json
$uversion = $uproject.EngineAssociation $uversion = $uproject.EngineAssociation
Write-Output "Engine version is $uversion" Write-Output "Engine version is $uversion"
# UE4INSTALL env var should point at the root of the *specific version* of # UEINSTALL env var should point at the root of the *specific version* of
# UE4 you want to use. This is mainly for use in source builds, default is # Unreal you want to use. This is mainly for use in source builds, default is
# to build it from version number and root of all UE4 binary installs # to build it from version number and root of all UE binary installs
$uinstall = $Env:UEINSTALL
# Backwards compat with old env var
if (-not $uinstall) {
$uinstall = $Env:UE4INSTALL $uinstall = $Env:UE4INSTALL
}
if (-not $uinstall) { if (-not $uinstall) {
# UE4ROOT should be the parent folder of all UE versions # UEROOT should be the parent folder of all UE versions
$uroot = $Env:UEROOT
# Backwards compat with old env var
if (-not $uroot) {
$uroot = $Env:UE4ROOT $uroot = $Env:UE4ROOT
}
if (-not $uroot) { if (-not $uroot) {
$uroot = "C:\Program Files\Epic Games" $uroot = "C:\Program Files\Epic Games"
} }

View File

@ -7,14 +7,14 @@ param (
) )
function Print-Usage { function Print-Usage {
Write-Output "Steve's UE4 Project Cleanup Tool" Write-Output "Steve's Unreal Project Cleanup Tool"
Write-Output " Clean up hot-reload DLLs & prune LFS to free space. Will close UE4 editor!" Write-Output " Clean up hot-reload DLLs & prune LFS to free space. Will close Unreal editor!"
Write-Output "Usage:" Write-Output "Usage:"
Write-Output " ue4-cleanup.ps1 [[-src:]sourcefolder] [Options]" Write-Output " ue4-cleanup.ps1 [[-src:]sourcefolder] [Options]"
Write-Output " " Write-Output " "
Write-Output " -src : Source folder (current folder if omitted)" Write-Output " -src : Source folder (current folder if omitted)"
Write-Output " : (should be root of project)" Write-Output " : (should be root of project)"
Write-Output " -nocloseeditor : Don't close UE4 editor (this will prevent DLL cleanup)" Write-Output " -nocloseeditor : Don't close Unreal editor (this will prevent DLL cleanup)"
Write-Output " -lfsprune : Call 'git lfs prune' to delete old LFS files as well" Write-Output " -lfsprune : Call 'git lfs prune' to delete old LFS files as well"
Write-Output " -dryrun : Don't perform any actual actions, just report on what you would do" Write-Output " -dryrun : Don't perform any actual actions, just report on what you would do"
Write-Output " -help : Print this help" Write-Output " -help : Print this help"
@ -27,12 +27,18 @@ function Cleanup-DLLs($cleanupdir, $projname, $dryrun) {
} else { } else {
Write-Output "Cleaning up temporary DLLs/PDBs in $cleanupdir for $projname" Write-Output "Cleaning up temporary DLLs/PDBs in $cleanupdir for $projname"
} }
# Hot Reload files # Hot Reload files - UE4
$cleanupfiles = @(Get-ChildItem "$cleanupdir\UE4Editor-$projname-????.dll" | Select-Object -Expand Name) $cleanupfiles = @(Get-ChildItem "$cleanupdir\UE4Editor-$projname-????.dll" | Select-Object -Expand Name)
$cleanupfiles += @(Get-ChildItem "$cleanupdir\UE4Editor-$projname-????.pdb" | Select-Object -Expand Name) $cleanupfiles += @(Get-ChildItem "$cleanupdir\UE4Editor-$projname-????.pdb" | Select-Object -Expand Name)
# Live Coding files # Live Coding files - UE4
$cleanupfiles += @(Get-ChildItem "$cleanupdir\UE4Editor-$projname.exe.patch_*" | Select-Object -Expand Name) $cleanupfiles += @(Get-ChildItem "$cleanupdir\UE4Editor-$projname.exe.patch_*" | Select-Object -Expand Name)
$cleanupfiles += @(Get-ChildItem "$cleanupdir\UE4Editor-$projname.pdb.patch_*" | Select-Object -Expand Name) $cleanupfiles += @(Get-ChildItem "$cleanupdir\UE4Editor-$projname.pdb.patch_*" | Select-Object -Expand Name)
# Hot Reload files - UE5
$cleanupfiles = @(Get-ChildItem "$cleanupdir\UnrealEditor-$projname-????.dll" | Select-Object -Expand Name)
$cleanupfiles += @(Get-ChildItem "$cleanupdir\UnrealEditor-$projname-????.pdb" | Select-Object -Expand Name)
# Live Coding files - UE5
$cleanupfiles += @(Get-ChildItem "$cleanupdir\UnrealEditor-$projname.exe.patch_*" | Select-Object -Expand Name)
$cleanupfiles += @(Get-ChildItem "$cleanupdir\UnrealEditor-$projname.pdb.patch_*" | Select-Object -Expand Name)
foreach ($cf in $cleanupfiles) { foreach ($cf in $cleanupfiles) {
if ($dryrun) { if ($dryrun) {
Write-Output "Would have deleted $cleanupdir\$cf" Write-Output "Would have deleted $cleanupdir\$cf"
@ -59,7 +65,7 @@ $result = 0
try { try {
if ($src -ne ".") { Push-Location $src } if ($src -ne ".") { Push-Location $src }
# Locate UE4 project file # Locate UE project file
$uprojfile = Get-ChildItem *.uproject | Select-Object -expand Name $uprojfile = Get-ChildItem *.uproject | Select-Object -expand Name
if (-not $uprojfile) { if (-not $uprojfile) {
throw "No Unreal project file found in $(Get-Location)! Aborting." throw "No Unreal project file found in $(Get-Location)! Aborting."
@ -76,9 +82,9 @@ try {
Write-Output "Cleaning up $uprojname" Write-Output "Cleaning up $uprojname"
} }
# Close UE4 as early as possible # Close UE as early as possible
if (-not $nocloseeditor) { if (-not $nocloseeditor) {
# Check if UE4 is running, if so try to shut it gracefully # Check if UE is running, if so try to shut it gracefully
Close-UE-Editor $uprojname $dryrun Close-UE-Editor $uprojname $dryrun
# Find all the modules in the project # Find all the modules in the project

View File

@ -11,14 +11,14 @@ param (
) )
function Print-Usage { function Print-Usage {
Write-Output "Steve's UE4 Map BuiltData Sync Tool" Write-Output "Steve's UE Map BuiltData Sync Tool"
Write-Output " Avoid storing Map_BuiltData.uasset files in source control, sync them directly instead" Write-Output " Avoid storing Map_BuiltData.uasset files in source control, sync them directly instead"
Write-Output "Usage:" Write-Output "Usage:"
Write-Output " ue4-datasync.ps1 [-mode:]<push|pull> [[-path:]syncpath] [Options]" Write-Output " ue4-datasync.ps1 [-mode:]<push|pull> [[-path:]syncpath] [Options]"
Write-Output " " Write-Output " "
Write-Output " -mode : Whether to push or pull the built data from your filesystem" Write-Output " -mode : Whether to push or pull the built data from your filesystem"
Write-Output " -root : Root folder to sync files to/from. Project name will be appended to this path." Write-Output " -root : Root folder to sync files to/from. Project name will be appended to this path."
Write-Output " : Can be blank if specified in UE4SYNCROOT" Write-Output " : Can be blank if specified in UESYNCROOT"
Write-Output " -src : Source folder (current folder if omitted)" Write-Output " -src : Source folder (current folder if omitted)"
Write-Output " : (should be root of project)" Write-Output " : (should be root of project)"
Write-Output " -prune : Clean up versions of the data older than the latest" Write-Output " -prune : Clean up versions of the data older than the latest"
@ -28,10 +28,10 @@ function Print-Usage {
Write-Output " -help : Print this help" Write-Output " -help : Print this help"
Write-Output " " Write-Output " "
Write-Output "Environment Variables:" Write-Output "Environment Variables:"
Write-Output " UE4SYNCROOT : Root path to sync data. Subfolders for each project name." Write-Output " UESYNCROOT : Root path to sync data. Subfolders for each project name."
Write-Output " UE4INSTALL : Use a specific UE4 install." Write-Output " UEINSTALL : Use a specific Unreal install."
Write-Output " : Default is to find one based on project version, under UE4ROOT" Write-Output " : Default is to find one based on project version, under UEROOT"
Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). "
Write-Output " : Default C:\Program Files\Epic Games" Write-Output " : Default C:\Program Files\Epic Games"
Write-Output " " Write-Output " "
@ -106,13 +106,17 @@ if ($mode -ne "push" -and $mode -ne "pull") {
} }
if (-not $root) {
$root = $Env:UESYNCROOT
}
# Backwards compat
if (-not $root) { if (-not $root) {
$root = $Env:UE4SYNCROOT $root = $Env:UE4SYNCROOT
} }
if (-not $root) { if (-not $root) {
Print-Usage Print-Usage
Write-Output "ERROR: Missing '-root' argument and no UE4SYNCROOT env var" Write-Output "ERROR: Missing '-root' argument and no UESYNCROOT env var"
Exit 3 Exit 3
} }
@ -160,7 +164,7 @@ try {
Write-Output "-- Sync process starting --" Write-Output "-- Sync process starting --"
# Locate UE4 project file # Locate UE project file
$uprojfile = Get-ChildItem *.uproject | Select-Object -expand Name $uprojfile = Get-ChildItem *.uproject | Select-Object -expand Name
if (-not $uprojfile) { if (-not $uprojfile) {
throw "No Unreal project file found in $(Get-Location)! Aborting." throw "No Unreal project file found in $(Get-Location)! Aborting."
@ -177,9 +181,9 @@ try {
Write-Output "Syncing $uprojname" Write-Output "Syncing $uprojname"
} }
# Close UE4 as early as possible in pull mode # Close UE as early as possible in pull mode
if ($mode -eq "pull" -and -not $nocloseeditor) { if ($mode -eq "pull" -and -not $nocloseeditor) {
# Check if UE4 is running, if so try to shut it gracefully # Check if UE is running, if so try to shut it gracefully
if ($dryrun) { if ($dryrun) {
Write-Output "Would have closed UE Editor" Write-Output "Would have closed UE Editor"
} else { } else {

View File

@ -7,21 +7,21 @@ param (
) )
function Print-Usage { function Print-Usage {
Write-Output "Steve's UE4 Get Latest Tool" Write-Output "Steve's Unreal Get Latest Tool"
Write-Output " Get latest from repo and build for dev. Will close UE4 editor!" Write-Output " Get latest from repo and build for dev. Will close Unreal editor!"
Write-Output "Usage:" Write-Output "Usage:"
Write-Output " ue4-get-latest.ps1 [[-src:]sourcefolder] [Options]" Write-Output " ue4-get-latest.ps1 [[-src:]sourcefolder] [Options]"
Write-Output " " Write-Output " "
Write-Output " -src : Source folder (current folder if omitted)" Write-Output " -src : Source folder (current folder if omitted)"
Write-Output " : (should be root of project)" Write-Output " : (should be root of project)"
Write-Output " -nocloseeditor : Don't close UE4 editor (this will prevent DLL cleanup)" Write-Output " -nocloseeditor : Don't close Unreal editor (this will prevent DLL cleanup)"
Write-Output " -dryrun : Don't perform any actual actions, just report on what you would do" Write-Output " -dryrun : Don't perform any actual actions, just report on what you would do"
Write-Output " -help : Print this help" Write-Output " -help : Print this help"
Write-Output " " Write-Output " "
Write-Output "Environment Variables:" Write-Output "Environment Variables:"
Write-Output " UE4INSTALL : Use a specific UE4 install." Write-Output " UEINSTALL : Use a specific Unreal install."
Write-Output " : Default is to find one based on project version, under UE4ROOT" Write-Output " : Default is to find one based on project version, under UEROOT"
Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). "
Write-Output " : Default C:\Program Files\Epic Games" Write-Output " : Default C:\Program Files\Epic Games"
Write-Output " " Write-Output " "
@ -129,7 +129,7 @@ try {
} }
# Automatically pull lighting builds, if environment variable defined # Automatically pull lighting builds, if environment variable defined
if ($Env:UE4SYNCROOT) { if ($Env:UESYNCROOT -or $Env:UE4SYNCROOT) {
$cmdargs = @() $cmdargs = @()
if ($nocloseeditor) { if ($nocloseeditor) {
$cmdargs += "-nocloseeditor" $cmdargs += "-nocloseeditor"

View File

@ -28,13 +28,12 @@ param (
. $PSScriptRoot\inc\packageconfig.ps1 . $PSScriptRoot\inc\packageconfig.ps1
. $PSScriptRoot\inc\projectversion.ps1 . $PSScriptRoot\inc\projectversion.ps1
. $PSScriptRoot\inc\uproject.ps1 . $PSScriptRoot\inc\uproject.ps1
. $PSScriptRoot\inc\ueinstall.ps1
. $PSScriptRoot\inc\ueeditor.ps1 . $PSScriptRoot\inc\ueeditor.ps1
. $PSScriptRoot\inc\filetools.ps1 . $PSScriptRoot\inc\filetools.ps1
function Write-Usage { function Write-Usage {
Write-Output "Steve's UE4 packaging tool" Write-Output "Steve's Unreal packaging tool"
Write-Output "Usage:" Write-Output "Usage:"
Write-Output " ue4-package.ps1 [-src:sourcefolder] [-major|-minor|-patch|-hotfix] [-keepversion] [-force] [-variant=VariantName] [-test] [-dryrun]" Write-Output " ue4-package.ps1 [-src:sourcefolder] [-major|-minor|-patch|-hotfix] [-keepversion] [-force] [-variant=VariantName] [-test] [-dryrun]"
Write-Output " " Write-Output " "
@ -53,9 +52,9 @@ function Write-Usage {
Write-Output " -help : Print this help" Write-Output " -help : Print this help"
Write-Output " " Write-Output " "
Write-Output "Environment Variables:" Write-Output "Environment Variables:"
Write-Output " UE4INSTALL : Use a specific UE4 install." Write-Output " UEINSTALL : Use a specific Unreal install."
Write-Output " : Default is to find one based on project version, under UE4ROOT" Write-Output " : Default is to find one based on project version, under UEROOT"
Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). "
Write-Output " : Default C:\Program Files\Epic Games" Write-Output " : Default C:\Program Files\Epic Games"
Write-Output " " Write-Output " "
} }
@ -72,7 +71,7 @@ if ($help) {
Exit 0 Exit 0
} }
Write-Output "~-~-~ UE4 Packaging Helper Start ~-~-~" Write-Output "~-~-~ Unreal Packaging Helper Start ~-~-~"
if ($test) { if ($test) {
Write-Output "TEST MODE: No tagging, version bumping" Write-Output "TEST MODE: No tagging, version bumping"
@ -213,7 +212,8 @@ try {
} }
} }
$ueEditorCmd = Join-Path $ueinstall "Engine/Binaries/Win64/UE4Editor-Cmd$exeSuffix"
$ueEditorCmd = Get-UEEditorCmd $ueVersion $ueinstall
$runUAT = Join-Path $ueinstall "Engine/Build/BatchFiles/RunUAT$batchSuffix" $runUAT = Join-Path $ueinstall "Engine/Build/BatchFiles/RunUAT$batchSuffix"
@ -233,7 +233,11 @@ try {
$argList.Add("-archive") > $null $argList.Add("-archive") > $null
$argList.Add("-archivedirectory=`"$($outDir)`"") > $null $argList.Add("-archivedirectory=`"$($outDir)`"") > $null
$argList.Add("-package") > $null $argList.Add("-package") > $null
if ((Get-Is-UE5 $ueVersion)) {
$argList.Add("-unrealexe=`"$ueEditorCmd`"") > $null
} else {
$argList.Add("-ue4exe=`"$ueEditorCmd`"") > $null $argList.Add("-ue4exe=`"$ueEditorCmd`"") > $null
}
if ($config.UsePak) { if ($config.UsePak) {
$argList.Add("-pak") > $null $argList.Add("-pak") > $null
} }
@ -303,8 +307,8 @@ try {
} }
catch { catch {
Write-Output $_.Exception.Message Write-Output $_.Exception.Message
Write-Output "~-~-~ UE4 Packaging Helper FAILED ~-~-~" Write-Output "~-~-~ Unreal Packaging Helper FAILED ~-~-~"
Exit 9 Exit 9
} }
Write-Output "~-~-~ UE4 Packaging Helper Completed OK ~-~-~" Write-Output "~-~-~ Unreal Packaging Helper Completed OK ~-~-~"

View File

@ -16,14 +16,13 @@ param (
. $PSScriptRoot\inc\packageconfig.ps1 . $PSScriptRoot\inc\packageconfig.ps1
. $PSScriptRoot\inc\projectversion.ps1 . $PSScriptRoot\inc\projectversion.ps1
. $PSScriptRoot\inc\uproject.ps1 . $PSScriptRoot\inc\uproject.ps1
. $PSScriptRoot\inc\ueinstall.ps1
. $PSScriptRoot\inc\filetools.ps1 . $PSScriptRoot\inc\filetools.ps1
# Include Git tools locking # Include Git tools locking
. $PSScriptRoot\GitScripts\inc\locking.ps1 . $PSScriptRoot\GitScripts\inc\locking.ps1
function Write-Usage { function Write-Usage {
Write-Output "Steve's UE4 lightmap rebuilding tool" Write-Output "Steve's Unreal lightmap rebuilding tool"
Write-Output "Usage:" Write-Output "Usage:"
Write-Output " ue4-rebuild-lightmaps.ps1 [-src:sourcefolder] [-quality:(preview|medium|high|production)] [-maps Map1,Map2,Map3] [-dryrun]" Write-Output " ue4-rebuild-lightmaps.ps1 [-src:sourcefolder] [-quality:(preview|medium|high|production)] [-maps Map1,Map2,Map3] [-dryrun]"
Write-Output " " Write-Output " "
@ -36,9 +35,9 @@ function Write-Usage {
Write-Output " -help : Print this help" Write-Output " -help : Print this help"
Write-Output " " Write-Output " "
Write-Output "Environment Variables:" Write-Output "Environment Variables:"
Write-Output " UE4INSTALL : Use a specific UE4 install." Write-Output " UEINSTALL : Use a specific Unreal install."
Write-Output " : Default is to find one based on project version, under UE4ROOT" Write-Output " : Default is to find one based on project version, under UEROOT"
Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). "
Write-Output " : Default C:\Program Files\Epic Games" Write-Output " : Default C:\Program Files\Epic Games"
Write-Output " " Write-Output " "
} }
@ -60,7 +59,7 @@ if ($src -ne ".") { Push-Location $src }
$isGit = Test-Path ".git" $isGit = Test-Path ".git"
if ($src -ne ".") { Pop-Location } if ($src -ne ".") { Pop-Location }
Write-Output "~-~-~ UE4 Lightmap Rebuild Start ~-~-~" Write-Output "~-~-~ Unreal Lightmap Rebuild Start ~-~-~"
try { try {
$config = Read-Package-Config -srcfolder:$src $config = Read-Package-Config -srcfolder:$src
@ -126,7 +125,7 @@ try {
$argList.Add("-Quality=$quality") > $null $argList.Add("-Quality=$quality") > $null
$argList.Add("-Map=$($foundmaps.BaseNames -join "+")") > $null $argList.Add("-Map=$($foundmaps.BaseNames -join "+")") > $null
$ueEditorCmd = Join-Path $ueinstall "Engine/Binaries/Win64/UE4Editor-Cmd$exeSuffix" $ueEditorCmd = Get-UEEditorCmd $ueVersion $ueinstall
if ($dryrun) { if ($dryrun) {
Write-Output "Would have run:" Write-Output "Would have run:"
@ -143,11 +142,11 @@ try {
} catch { } catch {
Write-Output $_.Exception.Message Write-Output $_.Exception.Message
Write-Output "~-~-~ UE4 Lightmap Rebuild FAILED ~-~-~" Write-Output "~-~-~ Unreal Lightmap Rebuild FAILED ~-~-~"
Exit 9 Exit 9
} }
Write-Output "~-~-~ UE4 Lightmap Rebuild OK ~-~-~" Write-Output "~-~-~ Unreal Lightmap Rebuild OK ~-~-~"
Write-Output "Reminder: You may need to commit and unlock map files" Write-Output "Reminder: You may need to commit and unlock map files"

View File

@ -24,7 +24,7 @@ param (
function Write-Usage { function Write-Usage {
Write-Output "Steve's UE4 release tool" Write-Output "Steve's Unreal release tool"
Write-Output "Usage:" Write-Output "Usage:"
Write-Output " ue4-release.ps1 [-version:ver|-latest] -variant:var -services:steam,itch [-src:sourcefolder] [-dryrun]" Write-Output " ue4-release.ps1 [-version:ver|-latest] -variant:var -services:steam,itch [-src:sourcefolder] [-dryrun]"
Write-Output " " Write-Output " "
@ -64,7 +64,7 @@ if ($version -and $latest) {
Exit 1 Exit 1
} }
Write-Output "~-~-~ UE4 Release Helper Start ~-~-~" Write-Output "~-~-~ Unreal Release Helper Start ~-~-~"
try { try {
@ -141,9 +141,9 @@ try {
} catch { } catch {
Write-Output $_.Exception.Message Write-Output $_.Exception.Message
Write-Output "~-~-~ UE4 Release Helper FAILED ~-~-~" Write-Output "~-~-~ Unreal Release Helper FAILED ~-~-~"
Exit 9 Exit 9
} }
Write-Output "~-~-~ UE4 Release Helper Completed OK ~-~-~" Write-Output "~-~-~ Unreal Release Helper Completed OK ~-~-~"