diff --git a/ReadMe.md b/ReadMe.md index 791197e..43472f7 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,9 +1,9 @@ -# Steve's UE4 Scripts +# Steve's Unreal Scripts ## Summary -These scripts are to help with various tasks in [Unreal Engine 4](https://www.unrealengine.com). -They're written on the basis of using Git / Git LFS rather than Perforce (many of UE4's own +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 Unreal's own automation tools assume P4, which can be inconvenient). * [Setting up a project for Git / Git-LFS](./doc/GitSetup.md): including LFS locking diff --git a/doc/Cleanup.md b/doc/Cleanup.md index e05798e..83ef0b4 100644 --- a/doc/Cleanup.md +++ b/doc/Cleanup.md @@ -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) : (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 -dryrun : Don't perform any actual actions, just report on what you would do -help : Print this help diff --git a/doc/DataSync.md b/doc/DataSync.md index 499fead..86c2577 100644 --- a/doc/DataSync.md +++ b/doc/DataSync.md @@ -56,7 +56,7 @@ Usage: -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. - : Can be blank if specified in UE4SYNCROOT + : Can be blank if specified in UESYNCROOT -src : Source folder (current folder if omitted) : (should be root of project) -prune : Clean up versions of the data older than the latest @@ -67,15 +67,15 @@ Usage: -help : Print this help Environment Variables: - UE4SYNCROOT : Root path to sync data. Subfolders for each project name. - UE4INSTALL : Use a specific UE4 install. - : Default is to find one based on project version, under UE4ROOT - UE4ROOT : Parent folder of all binary UE4 installs (detects version). - : Default C:\Program Files\Epic Games + UESYNCROOT : Root path to sync data. Subfolders for each project name. + UEINSTALL : Use a specific Unreal install. + : Default is to find one based on project version, under UEROOT + UEROOT : Parent folder of all binary Unreal installs (detects version). + : Default C:\Program Files\Epic Games ``` 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 you can use the same root folder for multiple projects. @@ -87,7 +87,7 @@ what happens in each mode. > 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 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` > -> 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 umap files on the shared drive. Again, you can't have any uncommitted changes to diff --git a/doc/GetLatest.md b/doc/GetLatest.md index e65d6b2..b348a07 100644 --- a/doc/GetLatest.md +++ b/doc/GetLatest.md @@ -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 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. 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) : (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 -help : Print this help ``` diff --git a/doc/GitSetup.md b/doc/GitSetup.md index 35eabec..27e6fc9 100644 --- a/doc/GitSetup.md +++ b/doc/GitSetup.md @@ -13,7 +13,7 @@ you might want to keep an eye on that. We use a this content workflow in our UE game repositories: 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 * They are also tracked as Git LFS files * They are NOT marked as lockable, simply because the tooling for managing locking diff --git a/doc/Package.md b/doc/Package.md index eb25d90..6588b26 100644 --- a/doc/Package.md +++ b/doc/Package.md @@ -5,7 +5,7 @@ much like using "File > Package Project" in the UE editor. However, it offers a number of other features. 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. ``` @@ -26,10 +26,10 @@ for a full description of this file. -help : Print this help Environment Variables: - UE4INSTALL : Use a specific UE4 install. - : Default is to find one based on project version, under UE4ROOT - UE4ROOT : Parent folder of all binary UE4 installs (detects version). - : Default C:\Program Files\Epic Games + UEINSTALL : Use a specific Unreal install. + : Default is to find one based on project version, under UEROOT + UEROOT : Parent folder of all binary Unreal installs (detects version). + : Default C:\Program Files\Epic Games ``` ## What the Script Does @@ -42,10 +42,10 @@ are always from a known version. ### 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. -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 diff --git a/doc/PackageConfig.md b/doc/PackageConfig.md index 9cd2279..df2fb17 100644 --- a/doc/PackageConfig.md +++ b/doc/PackageConfig.md @@ -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 `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: ```json @@ -173,7 +173,7 @@ Unreal, e.g. "Win64", "Linux" etc ### `Configuration` *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` *Optional Setting - string* diff --git a/doc/RebuildLightmaps.md b/doc/RebuildLightmaps.md index 6f79450..9992e75 100644 --- a/doc/RebuildLightmaps.md +++ b/doc/RebuildLightmaps.md @@ -24,8 +24,8 @@ explicitly list them as arguments: -help : Print this help Environment Variables: - UE4INSTALL : Use a specific UE4 install. - : Default is to find one based on project version, under UE4ROOT - UE4ROOT : Parent folder of all binary UE4 installs (detects version). - : Default C:\Program Files\Epic Games + UEINSTALL : Use a specific Unreal install. + : Default is to find one based on project version, under UEROOT + UEROOT : Parent folder of all binary Unreal installs (detects version). + : Default C:\Program Files\Epic Games ``` \ No newline at end of file diff --git a/doc/UEInstall.md b/doc/UEInstall.md index 598f147..21c6b4b 100644 --- a/doc/UEInstall.md +++ b/doc/UEInstall.md @@ -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. 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: -* **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 -* **UE4INSTALL**: Explicitly set the location of the UE4 build you want to use. +* **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 +* **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 diff --git a/inc/packageconfig.ps1 b/inc/packageconfig.ps1 index dd2531f..3502f01 100644 --- a/inc/packageconfig.ps1 +++ b/inc/packageconfig.ps1 @@ -47,8 +47,8 @@ class PackageVariant { # Our config for both building and releasing # Note that environment variables also have an effect: -# - UE4INSTALL: a specific UE install to use (default blank, find a version in UE4ROOT) -# - UE4ROOT: Parent folder of all binary UE4 installs (default C:\Program Files\Epic Games) +# - UEINSTALL: a specific UE install to use (default blank, find a version in UEROOT) +# - UEROOT: Parent folder of all binary UE installs (default C:\Program Files\Epic Games) class PackageConfig { # The root of the folder structure which will contain packaged output # Will be structured $OutputDir/$version/$variant diff --git a/inc/steam.ps1 b/inc/steam.ps1 index b2509e5..e59f82e 100644 --- a/inc/steam.ps1 +++ b/inc/steam.ps1 @@ -30,7 +30,7 @@ function Release-Steam { # Preview mode in Steam build just outputs logs so it's dryrun $preview = if($dryrun) { "1" } else { "0"} - # Use the UE4 platform as Steam target + # Use the UE platform as Steam target $target = $variant.Platform # write app file up to depot section then fill that in as we do depots diff --git a/inc/ueeditor.ps1 b/inc/ueeditor.ps1 index 69605e8..e145d6c 100644 --- a/inc/ueeditor.ps1 +++ b/inc/ueeditor.ps1 @@ -18,9 +18,24 @@ function Close-UE-Editor { throw "Couldn't close UE4 gracefully, aborting!" } } - } else { - Write-Verbose "UE4 project is not open in editor" } 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 + + } diff --git a/inc/ueinstall.ps1 b/inc/ueinstall.ps1 deleted file mode 100644 index 7c90ba1..0000000 --- a/inc/ueinstall.ps1 +++ /dev/null @@ -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 -} diff --git a/inc/uproject.ps1 b/inc/uproject.ps1 index d733ec8..9e5608a 100644 --- a/inc/uproject.ps1 +++ b/inc/uproject.ps1 @@ -48,4 +48,67 @@ function Get-UE-Version { ) return $uproject.EngineAssociation -} \ No newline at end of file +} + +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" + } + +} + diff --git a/ue4-blueprint-recompile.ps1 b/ue4-blueprint-recompile.ps1 index 086a240..d2bb1e2 100644 --- a/ue4-blueprint-recompile.ps1 +++ b/ue4-blueprint-recompile.ps1 @@ -14,14 +14,13 @@ param ( . $PSScriptRoot\inc\packageconfig.ps1 . $PSScriptRoot\inc\projectversion.ps1 . $PSScriptRoot\inc\uproject.ps1 -. $PSScriptRoot\inc\ueinstall.ps1 . $PSScriptRoot\inc\filetools.ps1 # Include Git tools locking . $PSScriptRoot\GitScripts\inc\locking.ps1 function Write-Usage { - Write-Output "Steve's UE4 Blueprint recompile tool" + Write-Output "Steve's Unreal Blueprint recompile tool" Write-Output "Usage:" Write-Output " ue4-blueprint-recompile.ps1 [-src:sourcefolder] [-bpdir:blueprintdir] [-dryrun]" Write-Output " " @@ -31,10 +30,10 @@ function Write-Usage { Write-Output " -help : Print this help" Write-Output " " Write-Output "Environment Variables:" - Write-Output " UE4INSTALL : Use a specific UE4 install." - Write-Output " : Default is to find one based on project version, under UE4ROOT" - Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " - Write-Output " : Default C:\Program Files\Epic Games" + Write-Output " UEINSTALL : Use a specific UE install." + Write-Output " : Default is to find one based on project version, under UEROOT" + Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). " + Write-Output " : Default C:\Program Files\Epic Games" Write-Output " " } @@ -50,7 +49,7 @@ if ($help) { Exit 0 } -Write-Output "~-~-~ UE4 Blueprint Recompile Start ~-~-~" +Write-Output "~-~-~ Unreal Blueprint Recompile Start ~-~-~" try { @@ -75,7 +74,7 @@ try { $argList.Add("-packagefolder=`"$bpfullpath`"") > $null $argList.Add("-autocheckout") > $null - $ueEditorCmd = Join-Path $ueinstall "Engine/Binaries/Win64/UE4Editor-Cmd$exeSuffix" + $ueEditorCmd = Get-UEEditorCmd $ueVersion $ueinstall if ($dryrun) { Write-Output "Would have run:" @@ -91,13 +90,13 @@ try { } catch { Write-Output $_.Exception.Message - Write-Output "~-~-~ UE4 Blueprint Recompile FAILED ~-~-~" + Write-Output "~-~-~ Unreal Blueprint Recompile FAILED ~-~-~" Exit 9 } -Write-Output "~-~-~ UE4 Blueprint Recompile OK ~-~-~" +Write-Output "~-~-~ Unreal Blueprint Recompile OK ~-~-~" if (!$dryrun) { Write-Output "Reminder: You may need to commit and unlock Blueprint files" } diff --git a/ue4-build.ps1 b/ue4-build.ps1 index a8e81ca..a5fa144 100644 --- a/ue4-build.ps1 +++ b/ue4-build.ps1 @@ -8,7 +8,7 @@ param ( ) 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 "Usage:" Write-Output " ue4-build.ps1 [[-mode:]] [[-src:]sourcefolder] [Options]" @@ -20,15 +20,15 @@ function Print-Usage { Write-Output " : prod = build Shipping and package for production (TODO)" Write-Output " -src : Source folder (current folder if omitted)" 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 " -help : Print this help" Write-Output " " Write-Output "Environment Variables:" - Write-Output " UE4INSTALL : Use a specific UE4 install." - Write-Output " : Default is to find one based on project version, under UE4ROOT" - Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " - Write-Output " : Default C:\Program Files\Epic Games" + Write-Output " UEINSTALL : Use a specific Unreal install." + Write-Output " : Default is to find one based on project version, under UEROOT" + Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). " + Write-Output " : Default C:\Program Files\Epic Games" Write-Output " " } @@ -60,7 +60,7 @@ try { Write-Output "-- Build process starting --" - # Locate UE4 project file + # Locate Unreal project file $uprojfile = Get-ChildItem *.uproject | Select-Object -expand Name if (-not $uprojfile) { throw "No Unreal project file found in $(Get-Location)! Aborting." @@ -77,21 +77,30 @@ try { 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 $uproject = Get-Content $uprojfile | ConvertFrom-Json $uversion = $uproject.EngineAssociation Write-Output "Engine version is $uversion" - # 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 + # UEINSTALL env var should point at the root of the *specific version* of + # 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 UE binary installs + $uinstall = $Env:UEINSTALL + + # Backwards compat with old env var + if (-not $uinstall) { + $uinstall = $Env:UE4INSTALL + } if (-not $uinstall) { - # UE4ROOT should be the parent folder of all UE versions - $uroot = $Env:UE4ROOT + # 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 + } if (-not $uroot) { $uroot = "C:\Program Files\Epic Games" } diff --git a/ue4-cleanup.ps1 b/ue4-cleanup.ps1 index 000ec40..be57aa9 100644 --- a/ue4-cleanup.ps1 +++ b/ue4-cleanup.ps1 @@ -7,14 +7,14 @@ param ( ) function Print-Usage { - Write-Output "Steve's UE4 Project Cleanup Tool" - Write-Output " Clean up hot-reload DLLs & prune LFS to free space. Will close UE4 editor!" + Write-Output "Steve's Unreal Project Cleanup Tool" + Write-Output " Clean up hot-reload DLLs & prune LFS to free space. Will close Unreal editor!" Write-Output "Usage:" Write-Output " ue4-cleanup.ps1 [[-src:]sourcefolder] [Options]" Write-Output " " Write-Output " -src : Source folder (current folder if omitted)" 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 " -dryrun : Don't perform any actual actions, just report on what you would do" Write-Output " -help : Print this help" @@ -27,12 +27,18 @@ function Cleanup-DLLs($cleanupdir, $projname, $dryrun) { } else { 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-????.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.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) { if ($dryrun) { Write-Output "Would have deleted $cleanupdir\$cf" @@ -59,7 +65,7 @@ $result = 0 try { if ($src -ne ".") { Push-Location $src } - # Locate UE4 project file + # Locate UE project file $uprojfile = Get-ChildItem *.uproject | Select-Object -expand Name if (-not $uprojfile) { throw "No Unreal project file found in $(Get-Location)! Aborting." @@ -76,9 +82,9 @@ try { Write-Output "Cleaning up $uprojname" } - # Close UE4 as early as possible + # Close UE as early as possible 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 # Find all the modules in the project diff --git a/ue4-datasync.ps1 b/ue4-datasync.ps1 index b3e7249..9903450 100644 --- a/ue4-datasync.ps1 +++ b/ue4-datasync.ps1 @@ -11,14 +11,14 @@ param ( ) 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 "Usage:" Write-Output " ue4-datasync.ps1 [-mode:] [[-path:]syncpath] [Options]" Write-Output " " 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 " : 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 " : (should be root of project)" Write-Output " -prune : Clean up versions of the data older than the latest" @@ -28,11 +28,11 @@ function Print-Usage { Write-Output " -help : Print this help" Write-Output " " Write-Output "Environment Variables:" - Write-Output " UE4SYNCROOT : Root path to sync data. Subfolders for each project name." - Write-Output " UE4INSTALL : Use a specific UE4 install." - Write-Output " : Default is to find one based on project version, under UE4ROOT" - Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " - Write-Output " : Default C:\Program Files\Epic Games" + Write-Output " UESYNCROOT : Root path to sync data. Subfolders for each project name." + Write-Output " UEINSTALL : Use a specific Unreal install." + Write-Output " : Default is to find one based on project version, under UEROOT" + Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). " + Write-Output " : Default C:\Program Files\Epic Games" 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) { $root = $Env:UE4SYNCROOT } if (-not $root) { 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 } @@ -160,7 +164,7 @@ try { Write-Output "-- Sync process starting --" - # Locate UE4 project file + # Locate UE project file $uprojfile = Get-ChildItem *.uproject | Select-Object -expand Name if (-not $uprojfile) { throw "No Unreal project file found in $(Get-Location)! Aborting." @@ -177,9 +181,9 @@ try { 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) { - # 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) { Write-Output "Would have closed UE Editor" } else { diff --git a/ue4-get-latest.ps1 b/ue4-get-latest.ps1 index 2a69b1f..479920b 100644 --- a/ue4-get-latest.ps1 +++ b/ue4-get-latest.ps1 @@ -7,22 +7,22 @@ param ( ) function Print-Usage { - Write-Output "Steve's UE4 Get Latest Tool" - Write-Output " Get latest from repo and build for dev. Will close UE4 editor!" + Write-Output "Steve's Unreal Get Latest Tool" + Write-Output " Get latest from repo and build for dev. Will close Unreal editor!" Write-Output "Usage:" Write-Output " ue4-get-latest.ps1 [[-src:]sourcefolder] [Options]" Write-Output " " Write-Output " -src : Source folder (current folder if omitted)" 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 " -help : Print this help" Write-Output " " Write-Output "Environment Variables:" - Write-Output " UE4INSTALL : Use a specific UE4 install." - Write-Output " : Default is to find one based on project version, under UE4ROOT" - Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " - Write-Output " : Default C:\Program Files\Epic Games" + Write-Output " UEINSTALL : Use a specific Unreal install." + Write-Output " : Default is to find one based on project version, under UEROOT" + Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). " + Write-Output " : Default C:\Program Files\Epic Games" Write-Output " " } @@ -129,7 +129,7 @@ try { } # Automatically pull lighting builds, if environment variable defined - if ($Env:UE4SYNCROOT) { + if ($Env:UESYNCROOT -or $Env:UE4SYNCROOT) { $cmdargs = @() if ($nocloseeditor) { $cmdargs += "-nocloseeditor" diff --git a/ue4-package.ps1 b/ue4-package.ps1 index c6b8ffb..c6d4dfd 100644 --- a/ue4-package.ps1 +++ b/ue4-package.ps1 @@ -28,13 +28,12 @@ param ( . $PSScriptRoot\inc\packageconfig.ps1 . $PSScriptRoot\inc\projectversion.ps1 . $PSScriptRoot\inc\uproject.ps1 -. $PSScriptRoot\inc\ueinstall.ps1 . $PSScriptRoot\inc\ueeditor.ps1 . $PSScriptRoot\inc\filetools.ps1 function Write-Usage { - Write-Output "Steve's UE4 packaging tool" + Write-Output "Steve's Unreal packaging tool" Write-Output "Usage:" Write-Output " ue4-package.ps1 [-src:sourcefolder] [-major|-minor|-patch|-hotfix] [-keepversion] [-force] [-variant=VariantName] [-test] [-dryrun]" Write-Output " " @@ -53,9 +52,9 @@ function Write-Usage { Write-Output " -help : Print this help" Write-Output " " Write-Output "Environment Variables:" - Write-Output " UE4INSTALL : Use a specific UE4 install." - Write-Output " : Default is to find one based on project version, under UE4ROOT" - Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " + Write-Output " UEINSTALL : Use a specific Unreal install." + Write-Output " : Default is to find one based on project version, under UEROOT" + Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). " Write-Output " : Default C:\Program Files\Epic Games" Write-Output " " } @@ -72,7 +71,7 @@ if ($help) { Exit 0 } -Write-Output "~-~-~ UE4 Packaging Helper Start ~-~-~" +Write-Output "~-~-~ Unreal Packaging Helper Start ~-~-~" if ($test) { 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" @@ -233,7 +233,11 @@ try { $argList.Add("-archive") > $null $argList.Add("-archivedirectory=`"$($outDir)`"") > $null $argList.Add("-package") > $null - $argList.Add("-ue4exe=`"$ueEditorCmd`"") > $null + if ((Get-Is-UE5 $ueVersion)) { + $argList.Add("-unrealexe=`"$ueEditorCmd`"") > $null + } else { + $argList.Add("-ue4exe=`"$ueEditorCmd`"") > $null + } if ($config.UsePak) { $argList.Add("-pak") > $null } @@ -303,8 +307,8 @@ try { } catch { Write-Output $_.Exception.Message - Write-Output "~-~-~ UE4 Packaging Helper FAILED ~-~-~" + Write-Output "~-~-~ Unreal Packaging Helper FAILED ~-~-~" Exit 9 } -Write-Output "~-~-~ UE4 Packaging Helper Completed OK ~-~-~" +Write-Output "~-~-~ Unreal Packaging Helper Completed OK ~-~-~" diff --git a/ue4-rebuild-lightmaps.ps1 b/ue4-rebuild-lightmaps.ps1 index 5488c41..7accf29 100644 --- a/ue4-rebuild-lightmaps.ps1 +++ b/ue4-rebuild-lightmaps.ps1 @@ -16,14 +16,13 @@ param ( . $PSScriptRoot\inc\packageconfig.ps1 . $PSScriptRoot\inc\projectversion.ps1 . $PSScriptRoot\inc\uproject.ps1 -. $PSScriptRoot\inc\ueinstall.ps1 . $PSScriptRoot\inc\filetools.ps1 # Include Git tools locking . $PSScriptRoot\GitScripts\inc\locking.ps1 function Write-Usage { - Write-Output "Steve's UE4 lightmap rebuilding tool" + Write-Output "Steve's Unreal lightmap rebuilding tool" Write-Output "Usage:" Write-Output " ue4-rebuild-lightmaps.ps1 [-src:sourcefolder] [-quality:(preview|medium|high|production)] [-maps Map1,Map2,Map3] [-dryrun]" Write-Output " " @@ -36,10 +35,10 @@ function Write-Usage { Write-Output " -help : Print this help" Write-Output " " Write-Output "Environment Variables:" - Write-Output " UE4INSTALL : Use a specific UE4 install." - Write-Output " : Default is to find one based on project version, under UE4ROOT" - Write-Output " UE4ROOT : Parent folder of all binary UE4 installs (detects version). " - Write-Output " : Default C:\Program Files\Epic Games" + Write-Output " UEINSTALL : Use a specific Unreal install." + Write-Output " : Default is to find one based on project version, under UEROOT" + Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). " + Write-Output " : Default C:\Program Files\Epic Games" Write-Output " " } @@ -60,7 +59,7 @@ if ($src -ne ".") { Push-Location $src } $isGit = Test-Path ".git" if ($src -ne ".") { Pop-Location } -Write-Output "~-~-~ UE4 Lightmap Rebuild Start ~-~-~" +Write-Output "~-~-~ Unreal Lightmap Rebuild Start ~-~-~" try { $config = Read-Package-Config -srcfolder:$src @@ -126,7 +125,7 @@ try { $argList.Add("-Quality=$quality") > $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) { Write-Output "Would have run:" @@ -143,11 +142,11 @@ try { } catch { Write-Output $_.Exception.Message - Write-Output "~-~-~ UE4 Lightmap Rebuild FAILED ~-~-~" + Write-Output "~-~-~ Unreal Lightmap Rebuild FAILED ~-~-~" 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" diff --git a/ue4-release.ps1 b/ue4-release.ps1 index 5957c7d..90dc747 100644 --- a/ue4-release.ps1 +++ b/ue4-release.ps1 @@ -24,7 +24,7 @@ param ( function Write-Usage { - Write-Output "Steve's UE4 release tool" + Write-Output "Steve's Unreal release tool" Write-Output "Usage:" Write-Output " ue4-release.ps1 [-version:ver|-latest] -variant:var -services:steam,itch [-src:sourcefolder] [-dryrun]" Write-Output " " @@ -64,7 +64,7 @@ if ($version -and $latest) { Exit 1 } -Write-Output "~-~-~ UE4 Release Helper Start ~-~-~" +Write-Output "~-~-~ Unreal Release Helper Start ~-~-~" try { @@ -141,9 +141,9 @@ try { } catch { Write-Output $_.Exception.Message - Write-Output "~-~-~ UE4 Release Helper FAILED ~-~-~" + Write-Output "~-~-~ Unreal Release Helper FAILED ~-~-~" Exit 9 } -Write-Output "~-~-~ UE4 Release Helper Completed OK ~-~-~" +Write-Output "~-~-~ Unreal Release Helper Completed OK ~-~-~"