Removed container and struct conversions from the script VM. This introduced complexity that the VM doesn't need, nor did it scale for the various struct types that we want to implicitly convert in Blueprints. Instead, the script VM is *only* aware of float<->double conversion. Container and struct conversions have now been moved to BlueprintTypeConversions. Currently, only the existing FVector3f<->FVector3d conversion has been added, but the remaining LWC types will be added in a subsequent change.
During Blueprint compilation of container and struct conversions, we now inject a function call into the bytecode that performs the conversion, which is better suited to the task instead of burdening the VM with the work. One drawback to this technique is that containers are slightly more inefficient when it comes to conversions. They won't know their type(s) ahead of time, which requires dynamically looking up a conversion function at runtime. We can possibly optimize this further, but the generaly recommendation is to avoid implicit conversions of container types when possible.
Additionally, a couple of convenience functions were added to the KismetCastingUtils to help remove a fair amount of boilerplate code that was used for implicit casting in various node types. ScriptCastingUtils.h was also removed since the VM no longer needs to concern itself with complex conversions.
#jira UE-151338
#preflight 629a507fb42820769428c133
#rb phillip.kavan
[CL 20560449 by dave jones2 in ue5-main branch]
- Plugins/BlueprintContext
- Editor/GlueprintGraph
- Editor/GraphEditor
- Editor/Kismet
- Editor/KismetCompiler
- Editor/UnrealEd/Private/Kismet2
note: if you're seeing this CL in the perforce history because you're trying to figure out why there's a null check that doesn't make sense, This is why. The goal of this CL is to preserve the behavior before IsChildOf changed rather than analyze whether that behavior makes sense. Use your best judgement
#rb marc.audy
#preflight 6299023a6438e3c731307a69
[CL 20474984 by jordan hoffmann in ue5-main branch]
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]
When linking a single precision pin to a double, we need to treat the pins as the same type, which ensures that a "break" message is used. However, FTypePromotion discovered that a cast exists between the two types, so it returns a "make with promotion" message instead.
The easiest fix here is to simply move the type promotion check to when the types don't match, since equal types imply that no promotion would be necessary to begin with. A more long term fix would be to remove float/double cast functions from KismetMathLibrary, as they're no longer necessary with implicit casting.
#rb ben.hoffman
#preflight 626aba17b17dd9121b3e37f5
#jira UE-150403
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 19966951 in //UE5/Release-5.0/... via CL 19967813
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)
[CL 19971946 by dave jones2 in ue5-main branch]
For floats, the display should now include either a "(single-precision)" or "(double-precision)" next to the float type. Unfortunately, this required a bit of finagling.
When we query for the tooltip, we also need to specify that we want to include subcategory information, which requires changing the signature of GetTypeDescription (et al) and GetCategoryText to include that information. Additionally, pluralizing the type gets a little weird. For containers, you might get something such as "Current type: Array of Float (single-precision)s". Instead of trying to fix the out of place "s", the wording has been changed to "Current: Array of Float (single-precision) types".
#rb justin.hare
#preflight 6257501bf7476d662c9094c6
#jira UE-147869
[CL 19757826 by dave jones2 in ue5-main branch]
This allows assets that implement an interface to be set as pin defaults
#jira none
#rb Phillip.Kavan
#preflight 624d63004c5db57ae60511d3
[CL 19644779 by Thomas Sarkanen in ue5-main branch]
We need to ensure that literal default values are interpreted as float strings instead of doubles. We've observed that some older Blueprint content might be using exact comparisons with floats. While this is generally frowned upon, some game logic may depend on this behavior. These issues can be difficult to debug if we covertly interpret literal float data as doubles.
As for the fix, anytime we serialize old pin data that represented a single precision float, we set a flag on the type that ensures we parse its default value string as a single precision float. This flag is also serialized, and isn't changed until the user actually changes the current value to something different.
#jira UE-145026
#preflight 622a416b03062eac59dae469
#rb phillip.kavan
#lockdown
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 19339612 in //UE5/Release-5.0/... via CL 19348994
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)
[CL 19349461 by dave jones2 in ue5-main branch]
The KismetMathLibrary changes made in CL 19159126 revealed a problem with type promotions: it's too strict when it comes to finding matching functions. This is currently preventing a BP class from compiling, which is blocking Dev-EngineMerge.
We need to modify ArePinTypesEquivalent to be less strict about real number comparisons, which permits using single precision float pins with double precision math functions.
#jira UE-144351
#preflight 621ec6c331454c90cce33859
#rb Marc.Audy
#lockdown
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 19224349 via CL 19226280 via CL 19226464 via CL 19226631 via CL 19226810
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)
[CL 19230290 by dave jones2 in ue5-main branch]
Two issues were discovered:
1. UKismetSystemLibrary::SetFloatPropertyByName is no longer used since it's been replaced by SetDoublePropertyByName. As a result, SetDoublePropertyByName would fail if the property was actually a float, which can happen if it's a native class. In this case, we should check for a FFloatProperty as a fallback.
2. Deprecation of float<->string converion functions in CL 19083449 introduced a regression: we can no longer use autocasts when the type is a single-precision float. In this case, we should search for autocast functions that take a double instead.
#jira UE-143681
#preflight 62181516783beeaf8ae8db8b
#rb andy.davidson
#lockdown julien.marchand
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 19157869 in //UE5/Release-5.0/... via CL 19159851
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)
[CL 19161495 by dave jones2 in ue5-main branch]
2) Enhancements to StringView and a few other helper classes
3) New UE style ignore case comparison
4) Moved shared UHT definitions into a common C# file.
#rb jonathan.adamczewski
#rnx
#preflight 620e3cdc8b6428e701a24666
[CL 19033446 by Tim Smith in ue5-main branch]
previous change at CL 18866227 was backed out because it broke the bot1 cooks: https://horde.devtools.epicgames.com/log/61ffcf94676584e71ea0ab7e?lineindex=104697
Basically GetBoolMetaDataHierarchical returns the wrong thing and the return pin can no longer be broken up and so the blueprint won't compile.
#jira UE-141083
#rb helge.mathee sara.schvartzman ben.hoffman
#preflight https://horde.devtools.epicgames.com/job/62018bbd62420bfd0493e404
#ROBOMERGE-AUTHOR: jack.cai
#ROBOMERGE-SOURCE: CL 18907822 via CL 18907834 via CL 18907851 via CL 18918946 via CL 18919865
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v916-18915374)
[CL 18919918 by jack cai in ue5-main branch]
#fyi jack.cai
Original CL Desc
-----------------------------------------------------------------
Control Rig: Added BlueprintInternalUseOnly="true" to the basel rig unit struct so that all derived rig unit structs don't appear in the pin type drop down menu and create confusion
#jira UE-141083
#rb helge.mathee sara.schvartzman ben.hoffman
#preflight https://horde.devtools.epicgames.com/job/61fc0ed3af01d3caef14ccb1
[CL 18882380 by aurel cordonnier in ue5-main branch]
The original ENABLE_BLUEPRINT_REAL_NUMBERS macro was strictly meant for AB testing in the Dev-LWC. Currently, disabling it won't work, and would likely lead to broken behavior. Its presence might incorrectly indicate to licensees that this is an option that can be toggled safely.
#rb marc.audy
#jira UE-140327
#preflight 61fc6449dc0b3ecbecb6f381
#lockdown julien.marchand
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 18864654 in //UE5/Release-5.0/... via CL 18864683 via CL 18864993
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)
[CL 18865002 by dave jones2 in ue5-main branch]
- Ensure that any folded AnimNode property gets remapped correctly for pin-to-property map in FBlueprintDebugData
- Ensure pin value watching for folded properties retrieves the correct value
- Const-ifying some code paths around blueprint pin watching
#jira UE-139995
#preflight 61fa624ddb42673a60239ce1
#rb Thomas.Sarkanen
#lockdown Cristina.Riveron
#ROBOMERGE-AUTHOR: jurre.debaare
#ROBOMERGE-SOURCE: CL 18824229 in //UE5/Release-5.0/... via CL 18825883 via CL 18826298
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)
[CL 18826349 by jurre debaare in ue5-main branch]
Blueprint real number support.
This change deprecates the use the of "float" and "double" types in Blueprints in favor of a new "real". By default, "real" is back by a double precision floating point number. However, it can be single precision if the number is a native float property or function parameter. This distinction won't be visible to the Blueprint user: in both instances, they'll be represented by "real" pin types. During deserialization, we'll automatically convert Blueprint pin types to use real/doubles, unless they're used to represent native code (including delegate signatures).
One consequence of this change is that we need to perform implicit casts between single and double precision real numbers. During Blueprint compilation, the compiler will detect points in the graph for when either a widening or narrowing conversion needs to occur. Subsequently, the script bytecode will contain a new cast instruction that performs the conversion. This also works on container types, but each entry in the container will have to be converted. This can introduce unwanted overhead for large containers that are frequently passed between Blueprint and native code.
The scope of this change affects Blueprints used by Gameplay, Animation, Control Rig, and UMG.
#rb marc.audy (serialization changes)
#jira UE-116484
#preflight 61f8bdd5a2514ba12ff7bdfc
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 18809077 in //UE5/Release-5.0/... via CL 18809455 via CL 18822548
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)
[CL 18823569 by dave jones2 in ue5-main branch]
#jira UE-136038
#rb ben.hoffman
#preflight 61d4b8bad17842e547ab783d
#ROBOMERGE-AUTHOR: benjamin.fox
#ROBOMERGE-SOURCE: CL 18512890 in //UE5/Release-5.0/... via CL 18512942
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)
[CL 18512978 by benjamin fox in ue5-release-engine-test branch]