Commit Graph

4847 Commits

Author SHA1 Message Date
paul chipchase
dbea2470ab Bulkdata will no longer fatal error if the archive is in an error state before serialization starts.
#rb Per.Larsson
#preflight 63f8922ab879197e73369f7e

- CL 24316937 made an effort to prevent serialization of bad data from corrupting memory, however the checks were a little too zealous. In some cases the archive provided for serialization is already in an error state in which case we should trust that the calling code has processes the problem correctly. Handling the error at this point from within bulkdata can give misleading errors.
- We now check if the archive is in the error state or not BEFORE we start serialization and if it is in error we just return early with default values.
- This should ensure that the problem is reported by the system creating it rather than always by bulkdata and make things easier to diagnose/fix/

[CL 24406791 by paul chipchase in ue5-main branch]
2023-02-24 15:02:22 -05:00
tim smith
70a462a77f Added a few missing definitions that were preventing "Debug Editor" builds of projects that disable GC from linking.
#rb
#preflight 63f8c4f4ef1b24bf948085f8

[CL 24400841 by tim smith in ue5-main branch]
2023-02-24 10:21:19 -05:00
devin doucette
282b87bdf8 Fixed FUObjectThreadContext to once again be an exported thread-local singleton
#preflight 63f8607ec35a141980940c2f
#rb Zousar.Shaker
#rnx

[CL 24397858 by devin doucette in ue5-main branch]
2023-02-24 04:02:09 -05:00
keith yerex
9bb93a6197 Add static assert to Cast to catch cases where the type passed in is not a UObjec,nor an Interface
#preflight 63f66d0c7064074bd8afbb7b
#rb Steve.Robb

[CL 24397830 by keith yerex in ue5-main branch]
2023-02-24 04:00:46 -05:00
devin doucette
4e02304b05 Moved API macro from types to members to fix compiling for Windows with Clang
An optimization to UE_LOG exposed an issue in Clang when targeting Windows. Log statements in inline functions of imported types fail to compile.

#preflight 63f7f350ef1b24bf94367191
#rb Zousar.Shaker
#rnx

[CL 24397809 by devin doucette in ue5-main branch]
2023-02-24 03:58:21 -05:00
jimmy andrews
430c2eddbe Fix incorrect comment for the ObjectMacros NoClear tag that indicates it will also remove the browse button
#rb lauren.barnes
#preflight skip

[CL 24397789 by jimmy andrews in ue5-main branch]
2023-02-24 03:56:57 -05:00
Matt Peters
e479db3332 Cooker: Improve discovery of Package dependencies in the initial request cluster.
1) Add editor-only scope for the load serialization of SoftObjectPaths on editoronly objects; these references should not be added to the cook.
2) Nanite SoftObjectPaths should be declared as editoronly rather than skipped entirely, so that our analytics for hidden dependencies are not triggered.
3) Explore editoronly hard dependencies in the RequestCluster, because these packages will be loaded and we want to avoid incorrectly marking them as hidden dependencies.
4) Skip exploring the soft dependencies of uncookable packages; uncookable packages are the same as not-referenced package as far as the runtime is concerned so we don't need their references.
5) Explore localization refererences - these are similar to AssetRegistry calculated dependencies.

#rb Zousar.Shaker
#rnx
#preflight 63f7e21cc35a141980525e80

[CL 24392154 by Matt Peters in ue5-main branch]
2023-02-23 18:17:55 -05:00
steve robb
40029bf9f9 Fixed assert firing in Debug mode when calling FScriptArrayHelper::MoveAssign(0, 0). Regressed in CL# 24328679.
#rb
#preflight 63f5e9ad6928c1ca3db4c09d

[CL 24387972 by steve robb in ue5-main branch]
2023-02-23 15:27:44 -05:00
steve robb
23223222c5 Unshelved from pending changelist '24294393':
Added extra checks for importing delegate definitions from strings.

#rb johan.torp
#preflight 63f4ec56977ceed915c2d372

[CL 24387136 by steve robb in ue5-main branch]
2023-02-23 15:00:37 -05:00
marc audy
7118650646 SavePackage TransientPropertyOverrides: In addition to skipping the properties when harvesting, we need to skip the properties when writing exports to disk. If we serialized the skipped properties for export A, but the skipped properties did exist as an import or export because they were included in the save by another export B, then we would still record them in the save of the export, and would give error "not listed as a dependency" because they were skipped for during the harvest of export A.
[CL 24387099 by marc audy in ue5-main branch]
2023-02-23 14:58:59 -05:00
steve robb
d1ae552eaa Added a check for invalid counts in FScriptArrayHelper::Resize().
#rb johan.torp
#preflight 63f4edf3500c05a624ae4559

[CL 24386980 by steve robb in ue5-main branch]
2023-02-23 14:55:32 -05:00
Matt Peters
76a7c8ca09 ObjectPtr: Changed FObjectPtrProperty::Identical to avoid unnecessary reads.
#rnx
#rb Joe.Pribele
#preflight 63f6abeaff5afbbb03ecab4c

[CL 24386240 by Matt Peters in ue5-main branch]
2023-02-23 14:29:19 -05:00
ben hoffman
e1b10d15ea Update comments on BlueprintType and NotBlueprintType to include the fact that they are inherited by subclasses. You can see that this is true in UEdGraphSchema_K2::IsAllowableBlueprintVariableType, where it walks the class heirarchy to check for the metadata.
#rb trivial
#preflight skip

[CL 24349658 by ben hoffman in ue5-main branch]
2023-02-21 16:23:47 -05:00
henrik karlsson
c74a887e4b Header unit fixes
* Added ScriptDelegateFwd.h and put it in the right module (CoreUObject). before fwd declarations was in Core.
* Fixed problem with StructuredArchive forward declaring and used functions that was force inlined in another file. header units did not like this and caused linker errors (and I'm surprised it worked before)
* Various fixes related to how global variables are defined (static for global variables means that they are not visible outside header units)
* Various fixes related to how global functions are defined (static for global functions means that they are not visible outside header units)
* Move some method implementations to cpp file to work around header unit compile crashes (and they should probably be there firstplace)
* Removed *_API on some types to fix header unit linker errors
* Added WITH_EDITOR around code that only compiles in editor config (these headers were not included anywhere but HU can't know that)

#preflight 63f50161ac06ce789f9c34d2
#rb steve.robb

[CL 24348303 by henrik karlsson in ue5-main branch]
2023-02-21 15:24:28 -05:00
jeanmichel dignard
c7be2b7fbd FExec: Converted Engine Exec overrides to Exec_Runtime/Exec_Dev where:
- No additional routing was being done in Exec.
- No default parameter was being provided through the Exec override.

This is so we can turn off Exec overrides in certain configurations.

#rb none
#preflight 63f3fc331d71bcd26256868e

[CL 24343558 by jeanmichel dignard in ue5-main branch]
2023-02-21 13:09:41 -05:00
paul chipchase
af3b1efb6c Fix potential memory corruption issue when allocating bulkdata payloads on 32bit systems.
#rb Per.Larsson
#rnx
#preflight 63f3b1fa52460c3a1f4684ce

- The problem is that our allocation functions take allocation sizes as type SIZE_T which on older 32bit platforms will be int32, but bulkdata stores sizes as int64. If the requested allocation is large enough the size will be truncated and the allocation could still return a valid memory allocation but one much smaller than requested. Later when we try to load into that allocation we will overwrite the end of the buffer. Given our supported platforms and how bulkdata is generally used this is an unlikely scenario but one we still should protect against.
- Added two functions ::SafeMalloc and ::SafeRealloc to replace direct calls to malloc/realloc. These utility functions will check to make sure that we can make allocations of the requested size by making sure that SIZE_T (the type that our allocators take for allocation sizes) is a large enough type.
- If the platform cannot service the request we will issue a fatal log error and halt the process. Technically we could error and return nullptr but in practice very little code checks to see if bulkdata allocations are valid or not and will end up crashing anyway. Given that this problem is only going to show up on 32bit machines and only for very large assets (most likely invalid or broken ones at that) we might as well halt execution as close to the problem as possible to make debugging easier.
- The changes are only applied for platforms where PLATFORM_32BITS is true, should be no cost to 64 bit platforms.

[CL 24335588 by paul chipchase in ue5-main branch]
2023-02-21 03:35:51 -05:00
julien stjean
af4424e59c Introducing the relocation workflow.
When on, at load the packages will detect if they where moved and if this is the case they will modify their ImportMap and SoftObjectPathList. The package reference in those that were in the same MountPoint as the asset when it was saved will behave as if they were relative references.

#preflight 63f3e319500c05a624417605
#rb Matt.Peters

[CL 24332127 by julien stjean in ue5-main branch]
2023-02-20 20:57:13 -05:00
niklas rojemo
3905f5f7e8 Memory leak creating a 3D array
Add missing DestructItems FScriptArrayHelper::MoveAssign and  FScriptMapHelper::MoveAssign to ensure that destructors of elements are called.

Will be submitted in two parts, one for UnrealTypes.h, and one for the rest of the files.

#rb Andrew Scheidecker Steve Robb
#preflight 63f3e5ba500c05a62441d14a

[CL 24331132 by niklas rojemo in ue5-main branch]
2023-02-20 19:35:05 -05:00
simon barratt
85b4fad481 Treating loading / import package errors as warnings (as the ModerationArtifactsCommandlet aims to generate artifacts as a primary goal rather than validate the input)
Ditto for any failed actor loads from world partitions

[REVIEW] [at]Daniel.Lamb [at]brian.marshall1
#preflight 63f3cb567064074bd8bf5232

[CL 24328314 by simon barratt in ue5-main branch]
2023-02-20 17:28:05 -05:00
paul chipchase
f1bbba509a Don't set an invalid size on FBulkData if the serialized element count is too large.
#rb Per.Larsson
#jira UE-172853
#rnx
#preflight 63f3834a61378b7ea0065346

- The main issue we are trying to solve is that we serialize the number of elements when saving/loading the package. On load we multiple the number of elements (int64) by the size of each element (int64) and if either of those values is large enough we could overflow and end up with an incorrect size. We do check for this when saving the package so this is only likely to come up if the package has been corrupted in some way.
- Change FBulkMetaData::FromSerialized to do the actual serialization as well. This lets us set the error flag on the archive if we do detect problems and keep all the error handling in a single place.
-- Note that setting the error flag on an archive while a package is being loaded doesn't seem to do much at the moment, so this is more of an attempt to future proof.
- If we detect an error with serializing FBulkMetaResource we will log an error and immediately return so that FBulkMetaData will remain set to defaults.
- We now calculate the largest value of ElementCount that we can support, given the ElementCount size and if the count is exceeded we will log an error, set the error flag on the archive and return leaving FBulkMetaData as default.
- Note that both before and after this change the package is effectively broken and won't work properly, but this change will stop us from potentially stomping memory.
- Note that at runtime we generally serialize the bulkdata info from the BulkDataMap in the package header, so this is mostly an editor thing.

[CL 24322887 by paul chipchase in ue5-main branch]
2023-02-20 15:37:35 -05:00
johan torp
756f7aac91 Deprecate unused EGCOptions::ProcessWeakReferences
#jira UE-177838
#lockdown mark.lintott
#rb mark.lintott
#preflight 63f33f1781646f1f248f0390

[CL 24322875 by johan torp in ue5-main branch]
2023-02-20 15:37:16 -05:00
simon tovey
b1dca74a4d Crash fix when collecting references in GC with gc.historysize 1
#rb Robert.Millar

[CL 24312165 by simon tovey in ue5-main branch]
2023-02-20 07:16:07 -05:00
peter engstrom
43e1614b0d Added ELifetimeCondition COND_Dynamic support. Added unit tests for Iris and functional tests for replication system agnostic testing.
COND_Dynamic allows for a property to decide its actual replication condition after instantiation of the actor/component rather than be the same for all instances. The condition can be changed using the macros DOREPDYNAMICCONDITION_INITCONDITION_FAST, when used in the object's GetReplicatedCustomConditionState implementation, or DOREPDYNAMICCONDITION_SETCONDITION_FAST in any other place where it's appropriate to change the condition. If the condition is never modified, thus remaining COND_Dynamic, the property will always replicate when changed. It's possible to use the DOREPCUSTOMCONDITION_ macros too on properties with this condition.

#jira UE-122444
#preflight 63eb3ca1923476b686190e5a
#rb louisphilippe.seguin, ryan.gerleve, mattias.hornlund, brian.bekich

[CL 24307287 by peter engstrom in ue5-main branch]
2023-02-19 08:39:17 -05:00
mattias hornlund
ab4e47d140 Implemented FExportArchive::GetArchiveName() to get more information in logs.
#rb CarlMagnus.Nordin
#preflight 63ef55c761378b7ea0111a96

[CL 24281951 by mattias hornlund in ue5-main branch]
2023-02-17 10:24:37 -05:00
carlmagnus nordin
3f61dc09ed ZenLoader: Ensure that postload and serialize never overlaps for exports in related packages.
#preflight 63ef42c390198dffbad4a669
#jira UE-166872
#rb pj.kack

[CL 24279266 by carlmagnus nordin in ue5-main branch]
2023-02-17 06:21:19 -05:00