Commit Graph

79 Commits

Author SHA1 Message Date
robert manuszewski
d1443992e1 Deprecating ANY_PACKAGE.
This change consists of multiple changes:

Core:
- Deprecation of ANY_PACKAGE macro. Added ANY_PACKAGE_DEPRECATED macro which can still be used for backwards compatibility purposes (only used in CoreUObject)
- Deprecation of StaticFindObjectFast* functions that take bAnyPackage parameter
- Added UStruct::GetStructPathName function that returns FTopLevelAssetPath representing the path name (package + object FName, super quick compared to UObject::GetPathName) + wrapper UClass::GetClassPathName to make it look better when used with UClasses
- Added (Static)FindFirstObject* functions that find a first object given its Name (no Outer). These functions are used in places I consider valid to do global UObject (UClass) lookups like parsing command line parameters / checking for unique object names
- Added static UClass::TryFindType function which serves a similar purpose as FindFirstObject however it's going to throw a warning (with a callstack / maybe ensure in the future?) if short class name is provided. This function is used  in places that used to use short class names but now should have been converted to use path names to catch any potential regressions and or edge cases I missed.
- Added static UClass::TryConvertShortNameToPathName utility function
- Added static UClass::TryFixShortClassNameExportPath utility function
- Object text export paths will now also include class path (Texture2D'/Game/Textures/Grass.Grass' -> /Script/Engine.Texture2D'/Game/Textures/Grass.Grass')
- All places that manually generated object export paths for objects will now use FObjectPropertyBase::GetExportPath
- Added a new startup test that checks for short type names in UClass/FProperty MetaData values

AssetRegistry:
- Deprecated any member variables (FAssetData / FARFilter) or functions that use FNames to represent class names and replaced them with FTopLevelAssetPath
- Added new member variables and new function overloads that use FTopLevelAssetPath to represent class names
- This also applies to a few other modules' APIs to match AssetRegistry changes

Everything else:
- Updated code that used ANY_PACKAGE (depending on the use case) to use FindObject(nullptr, PathToObject), UClass::TryFindType (used when path name is expected, warns if it's a short name) or FindFirstObject (usually for finding types based on user input but there's been a few legitimate use cases not related to user input)
- Updated code that used AssetRegistry API to use FTopLevelAssetPaths and USomeClass::StaticClass()->GetClassPathName() instead of GetFName()
- Updated meta data and hardcoded FindObject(ANY_PACKAGE, "EEnumNameOrClassName") calls to use path names

#jira UE-99463
#rb many.people
[FYI] Marcus.Wassmer
#preflight 629248ec2256738f75de9b32

#codereviewnumbers 20320742, 20320791, 20320799, 20320756, 20320809, 20320830, 20320840, 20320846, 20320851, 20320863, 20320780, 20320765, 20320876, 20320786

#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 20430220 via CL 20433854 via CL 20435474 via CL 20435484
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246)

[CL 20448496 by robert manuszewski in ue5-main branch]
2022-06-01 03:46:59 -04:00
Matt Peters
7ad238a806 AssetRegistry includes (Engine/Source): change #include "AssetData.h" -> #include "AssetRegistry/AssetData.h", and similar for the other moved AssetRegistry headers.
#rb Zousar.Shaker
#rnx
#preflight 6270509a220f89f0ad573030

[CL 20016982 by Matt Peters in ue5-main branch]
2022-05-02 18:06:48 -04:00
eric knapik
0df1696488 #jira: none
Fix a nullptr issue when running in -game -server using the unrealEditor.exe
GEditor might be null

#rb: James.Hopkin
#preflight 626ac894a5009ff191b5d63c

#ROBOMERGE-AUTHOR: eric.knapik
#ROBOMERGE-SOURCE: CL 19965770 via CL 19968113 via CL 19968395 via CL 19968875
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 19972764 by eric knapik in ue5-main branch]
2022-04-28 19:14:20 -04:00
paul chipchase
36234e0c55 Fix potential assert/crash when renaming packages
#rb Danny.Couture, Matt.Peters
#jira UE-145191
#rnx
#preflight 62286bebf4469cadac0977c1
#lockdown Simon.Tourangeau

### Problem
- This problem was introduced in CL 19224316 which removed the direct call to ::ResetLoaders as forcing a package that was being unloaded to load all of it's bulkdata payloads into memory did not make much sense.
- Since the fix in that CL was about flushing all async compilation work before calling ::ResetLoaders, if we could avoid calling it unless absolutely needed (objects that were not gced) then we could reduce the chance of us actually needing to flush the async compilation work, which can be slow.

### Fix
- However if the package is being renamed, then the uobjects contained within the package will have been moved to the new package, in which case we want any bulkdata objects that they own to remain valid so we cannot rely on the call to ::ResetLoaders that occurs when a package is garbage collected as that variant leaves the newly detached bulkdata objects in an invalid state that can no longer access their payloads.
- Rolled the fix back to a 'dumber' version. We once again call ::ResetLoaders on each package but before we start doing that we check all packages that we are trying to unload to see if any have asnyc compilation work running and only if we detect this do we flush the system.
-- Renamed ::ResetPackageLoaders to ::FlushAsyncCompilation and moved it to be called much earlier.
-- Removed the array of weak ptrs added in 19224316 as they are no longer used.
- I also changed the code documentation on ::ResetLoaders to make it clear why it is being called there.

#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 19319379 in //UE5/Release-5.0/... via CL 19319782
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)

[CL 19347983 by paul chipchase in ue5-main branch]
2022-03-10 21:48:44 -05:00
paul chipchase
0f1a4c1f98 Fix UPackageTools::UnloadPackages to not potentially cause asserts when unloading a package with async compilation work running.
#rb Danny.Couture
#jira UE-144025
#rnx
#preflight 621f9577901d830f36563e26
#lockdown Mark.Lintott

- There is the potential here to call ResetLoader on a package that has async compilation work running, which currently is not thread safe. In addition, calling ResetLoader at this point can force bulkdata payloads to be loaded off disk only for the package to be immediately destroyed via garbage collection.
- The call to ::ResetLoader has been removed, we now rely on the loader being reset as part of the garbage collection process, which will not force the payload to be loaded.
- Note that if a package is garbage collected there is already code to make sure that it waits on it's async compilation tasks (if any) and so should be thread safe.
- As a safety precaution we retain an array of weak pointers to the packages and check them after the garbage collection pass to see if any of the packages survived. If they did survive we then call ::ResetLoader on them to detach the package from the file on disk, maintaining the existing behaviour.
-- Before we call ::ResetLoader we check to see if any of the packages has outstanding async compilation work and if so we flush the compilation manager to avoid any potential threading issues.


#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 19224316 via CL 19226273 via CL 19226448 via CL 19226623 via CL 19226800
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19230278 by paul chipchase in ue5-main branch]
2022-03-02 16:52:52 -05:00
zach rammell
e82a403146 Package Tools: Add exposed functions for converting between package names and filenames.
#jira UE-141015
#rb Patrick.Laflamme
#preflight 621947d7de5bc9add3ed89bf

#ROBOMERGE-AUTHOR: zach.rammell
#ROBOMERGE-SOURCE: CL 19158576 via CL 19158609 via CL 19158625 via CL 19160700
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19161718 by zach rammell in ue5-main branch]
2022-02-25 19:57:47 -05:00
phillip kavan
837954568a Exclude dead package objects when rebuilding dependent cache sets on a Blueprint asset reload, which could otherwise lead to an editor crash during reinstancing in some cases.
#jira UE-142750
#rb Thomas.Sarkanen
#preflight 62164dea0f71e491ccfe08f1
#lockdown Julien.Marchand


#ROBOMERGE-AUTHOR: phillip.kavan
#ROBOMERGE-SOURCE: CL 19093467 via CL 19095840 via CL 19096172 via CL 19097011 via CL 19105381
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19146688 by phillip kavan in ue5-main branch]
2022-02-25 09:44:32 -05:00
patrick hardy
084ffde7e1 Prevent package reload calling PostEditChangeProperty on objects that have an outdated class during PostPackageFixup. In this case the class has already been regenerated and attempting to register actor components with an outdated class will trigger a check().
This could occur when an actor on a sublevel has its class modified when ReloadPackages() is called.

This was likely caused by change 17997995 where FBlueprintCompileReinstancer::ReplaceInstancesOfClass_Inner sets CLASS_NewerVersionExists. This causes the flag to be present during PostPackageFixup which didn't occur in previous versions.

#jira UE-140850
#preflight 6204a23da30b354a40fb95c1
#rb Francis.Hurteau, Jason.Walter
#lockdown Alejandro.Arango

#ROBOMERGE-AUTHOR: patrick.hardy
#ROBOMERGE-SOURCE: CL 18940573 in //UE5/Release-5.0/... via CL 18941026 via CL 18941500
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v917-18934589)

[CL 18941531 by patrick hardy in ue5-main branch]
2022-02-10 15:02:48 -05:00
robert manuszewski
97b5e82c0b Deprecating EInternalObjectFlags::PendingKill. Making sure iterators use the appropriate flags based on the current state of PendingKill being enabled or not.
#preflight 61f8f33d537702981c352c7a
#rb Steve.Robb

#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 18806353 in //UE5/Release-5.0/... via CL 18808526 via CL 18821789
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18822151 by robert manuszewski in ue5-main branch]
2022-02-02 02:21:12 -05:00
francis hurteau
5714cca54f Reduced runtime UPackage size from 176b to 144b or 120b when stripping deprecated properties
This should saves around ~1.5 Mb to ~3 Mb at runtime with ~50000 packages

Added a new core define UE_STRIP_DEPRECATED_PROPERTIES that could be used to wrap deprecated properties and strip them to regain memory when a projects becomes compliant. this can be set in the project target file
Deprecated most public properties from UPackage and created accessors for them

#rb PJ.Kack
#jira UE-138957
#preflight 61f17a6f7266f4e79bd62601

#ROBOMERGE-AUTHOR: francis.hurteau
#ROBOMERGE-SOURCE: CL 18738937 in //UE5/Release-5.0/... via CL 18739524 via CL 18741373
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18742135 by francis hurteau in ue5-main branch]
2022-01-26 15:00:04 -05:00
jason walter
d29dc70120 Refactor ReloadPackages to use a TWeakObjPtr<UPackage> prior to creating a new map in editor.
This change also attempts to reduce some of the complexity of the function by breaking out some of the filtering that happens at the start.

#jira UE-132092
#rb francis.hurteau
#preflight 61b8aef9c8566c1582bdeb9e

#ROBOMERGE-AUTHOR: jason.walter
#ROBOMERGE-SOURCE: CL 18454207 in //UE5/Release-5.0/... via CL 18454212
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v898-18417669)

[CL 18454216 by jason walter in ue5-release-engine-test branch]
2021-12-14 09:54:00 -05:00
robert manuszewski
b87ad3ab82 Locking the entire hash maps instead of individual hash buckets when iterating UObject maps to prevent memory stomps when creating / renaming / destroying objects mid iteration
#rb Steve.Robb
[FYI] PJ.Kack

#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 18416493 via CL 18416497 via CL 18416499 via CL 18435022 via CL 18437322
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v897-18405271)

[CL 18437640 by robert manuszewski in ue5-release-engine-test branch]
2021-12-10 20:57:12 -05:00
richard talbotwatkin
c5c228eebf Improved UPackageTools::SanitizePackageName to coalesce multiple contiguous forward slashes into a single forward slash, as package names may not contain double slashes.
#jira UE-136235
#rb Alexis.Matte

#ROBOMERGE-AUTHOR: richard.talbotwatkin
#ROBOMERGE-SOURCE: CL 18338279 in //UE5/Release-5.0/... via CL 18338295
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18338302 by richard talbotwatkin in ue5-release-engine-test branch]
2021-12-01 08:55:59 -05:00
dave belanger
e766dae172 PackageTools::UnloadPackages param to force unload of dirty packages
FPluginUtils::UnloadPlugins will unmount plugins even if some of its packages cannot be unloaded
#rb Matt.Peters
#preflight skip

#ROBOMERGE-AUTHOR: dave.belanger
#ROBOMERGE-SOURCE: CL 18315688 via CL 18320378 via CL 18321619 via CL 18321713 via CL 18321909 via CL 18321927
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18321936 by dave belanger in ue5-release-engine-test branch]
2021-11-30 01:06:31 -05:00
aurel cordonnier
fc542f6cfd Merge from Release-Engine-Staging @ 18081189 to Release-Engine-Test
This represents UE4/Main @18073326, Release-5.0 @18081140 and Dev-PerfTest @18045971

[CL 18081471 by aurel cordonnier in ue5-release-engine-test branch]
2021-11-07 23:43:01 -05:00
aurel cordonnier
dc4bf61540 Merge from Release-Engine-Staging @ 17030559 to Release-Engine-Test
This represents UE4/Main @ 17030256 and Dev-PerfTest @ 17030553

[CL 17031509 by aurel cordonnier in ue5-release-engine-test branch]
2021-08-03 11:56:47 -04:00
daren cheng
d7b9c71cab Remove UE4 references UnrealEd
#jira UE-111293
#rb trivial

#ROBOMERGE-SOURCE: CL 17000762 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207)

[CL 17000774 by daren cheng in ue5-release-engine-test branch]
2021-07-29 16:30:39 -04:00
Marc Audy
e80ea6b959 Merge from Release-Engine-Staging @ 16444985
This represents UE4/Main @ 16445039 and Dev-PerfTest @ 16444526

[CL 16445122 by Marc Audy in ue5-release-engine-test branch]
2021-05-25 02:43:26 -04:00
jamie dale
b4f3a76f4e Ensure the inactive world created from the Content Browser is purged when loading that world for editing
UEditorEngine::OnAssetLoaded calls UEditorEngine::InitializeNewlyCreatedInactiveWorld for any world loaded, which can result in a resident world asset that is only partially initialized (inactive worlds disable things like AI).

UEditorEngine::Map_Load finds this resident world and attempts to re-use it, however since bIsWorldInitialized is already set to true it skips running the normal editor world initialization (which enables things like AI), and the end result is an editable world with certain features uninitialized.

UEditorEngine::Map_Load does attempt to purge any resident worlds that have been left lingering, but had made special exceptions for the world that the editor is attempting to load (UE-9631, UE-17205). This change has that logic run on any lingering resident worlds that have already been initialized, thus ensuring that the world being edited will definitely be initialized with the correct set of enabled features.

#jira UE-104140
#rb Richard.TalbotWatkins, JeanMichel.Dignard
#preflight 609e9f0a423c960001f1fa36

#ROBOMERGE-SOURCE: CL 16331756 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v804-16311228)

[CL 16331771 by jamie dale in ue5-release-engine-test branch]
2021-05-14 13:23:38 -04:00
Marc Audy
9753392e2b Merge UE5/RES CL# 15462083 to UE5/Main
This represents UE4/Main @ 15414221

[CL 15463811 by Marc Audy in ue5-main branch]
2021-02-18 18:13:28 -04:00
Marc Audy
50a3d7d368 Merge Release-Engine-Staging to Main @ CL# 14467590
This represents UE4/Main @ 14432125 + some cherrypick fixes

[CL 14468207 by Marc Audy in ue5-main branch]
2020-10-09 22:42:26 -04:00
Sebastien Lussier
e0aa044c02 Make sure that FCommandletPackageHelper::Delete(Packages) won't fail if the provided array is empty
* Modified UPackageTools::UnloadPackages() to return true if there are no packages to process

#rb trivial
#robomerge release-5.0-m2

[CL 14299543 by Sebastien Lussier in ue5-main branch]
2020-09-11 12:13:50 -04:00
Marc Audy
7379fa99c5 Merging //UE5/Release-Engine-Staging to Main (//UE5/Main) @ 14229157
[CL 14233282 by Marc Audy in ue5-main branch]
2020-09-01 14:07:48 -04:00
Marc Audy
a7c9001a94 Merging //UE5/Release-Engine-Staging to Main (//UE5/Main) @ 14075166
#rb
#rnx

[CL 14075271 by Marc Audy in ue5-main branch]
2020-08-11 01:36:57 -04:00
Michal Valient
95d19f95b1 [REVERB] Merging //UE4/Private-Reverb-Development@13832732
#rb graham.wihlidal, rune.stubbe, brian.karis, andrew.lauritzen, jeff.farris

[CL 13834854 by Michal Valient in ue5-main branch]
2020-07-06 18:58:26 -04:00