Engine (map and set add item);
Implementing a way to have the map and set fill in with the next available enum value instead of always doing the default value.
Slack discussion with video: https://epicgames.slack.com/archives/C0447BVGFFZ/p1705510234620249
-- Code --
PropertyHandleImpl:
FPropertyHandleMap::AddItem() - Added a HasKey() lambda. We're then checking if the map property's key is an enum property, if so, we'll loop the enum values to see if the map doesn't already have that enum value as a key. When we find one that isn't in the map, we're adding a child node and then setting the child's key node to be the enum value that is not in the map yet. If the map property's key is not enum then we do the old check for if the default key isn't there.
FPropertyHandleSet::AddItem() - Added a HasElement() lambda. We're then checking if the set property's element is an enum property, if so, we'll loop the enum values to see if the set doesn't already have the enum value as an element. When we find one that isn't in the set, we're adding a child node and then setting the child node to be the enum value that is not in the set yet. If the set property's element is not enum then we do the old check for if the default key isn't there.
UnrealTypes:
FSetProperty::GetElementProperty() - Added this getter to return the ElementProp property.
[REVIEW] [at]guillaume.morreel, [at]matt.stone, [at]karen.jirak, [at]ronald.koppers
#tests PIE, opened a uasset that has a TMap property with enum as the key, added each enum key as I clicked the add item button, changed an entry to something out of order to make sure the add item button would add the next available entry, all the way until it wouldn't add anymore entries because all enum keys were taken. Also tried a TMap property with a gameplaytag as the key to make sure it still worked as expected. Repeated with TSet.
#rb ronald.koppers
[CL 31089421 by aaron eady in ue5-main branch]
- Changed codepaths reading FProperty objects using ReadObject() to now use ReadPropertyUnchecked(), since FProperty is not a child of UObject (ReadObject was also an unchecked implementation so validation has been lost).
These changes allow ReadObject to return a UObject fetched from a constructed TObjectPtr<UObject> which enables UObject access tracking. This corrects the previous implementation of ReadProperty which would return an FProperty from a temporarily constructed TObjectPtr<UObject>. This had the effect of running TObjectPtr tracking handlers (if any are registered) on the FProperty object which is not actually a UObject type. Using the intermediate TObjectPtr<UObject> in a handler could corrupt the underlying FProperty data as many codepaths in TObjectPtr lazily initialize UObject member variables upon calling UObject methods.
#jira UE-204533
#rb Francis.Hurteau, Robert.Manuszewski
[CL 30924162 by kevin macaulayvacher in ue5-main branch]
Add comments warning against use of IsDefaultSubobject due to the historically inconsistent behavior, and deprecate CollectDefaultSubobjects for being redundant and incorrect
Improve general comments related to subobject functions to better match the current behavior
#jira UE-201046
#rb dan.oconnor
[CL 30858830 by ben zeigler in ue5-main branch]
Added GarbageCollectComplete event that gets fired after GC is truly done (existing events were inconsitent in that manner)
#rb Johan.Torp
[CL 30845256 by robert manuszewski in ue5-main branch]
- Introduced UE::GC::GReachableObjectFlag which makes flipping all objects from Reachable -> MaybeUnreachable a single Swap() function call.
- Roots and clustered objects are then marked back as Reachable (instead of MaybeUnreachable) but there's significantly fewer of these than all objects that previously needed to be marked as MaybeUnreachable.
- ReachabilityAnalysis now clears MaybeUnreachable AND marks as Reachable (no observable perf regression because of that)
TestClient ReplayRun results (MOAU - MarkObjectsAsUnreachable, RA - ReachabilityAnalysis)
Before:
Min MOAU Time: 0.367427
Max MOAU Time: 1.21097
Avg MOAU Time: 0.709261134146342
Min RA Time: 3.46
Max RA Time: 16.03
Avg RA Time: 11.2565957446808
After:
Min MOAU Time: 0.250281
Max MOAU Time: 1.280585
Avg MOAU Time: 0.692970346153846
Min RA Time: 3.72
Max RA Time: 13.97
Avg RA Time: 11.0717777777778
#rb Johan.Torp
[CL 30615034 by robert manuszewski in ue5-main branch]