2016-01-07 08:17:16 -05:00
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
2014-09-17 04:34:40 -04:00
# include "HotReloadPrivatePCH.h"
# include "HotReloadClassReinstancer.h"
# if WITH_ENGINE
2015-04-10 03:30:54 -04:00
# include "Engine/BlueprintGeneratedClass.h"
2015-09-30 05:26:51 -04:00
# include "Layers/ILayers.h"
# include "BlueprintEditor.h"
# include "Kismet2/CompilerResultsLog.h"
2014-09-17 04:34:40 -04:00
void FHotReloadClassReinstancer : : SetupNewClassReinstancing ( UClass * InNewClass , UClass * InOldClass )
{
// Set base class members to valid values
ClassToReinstance = InNewClass ;
DuplicatedClass = InOldClass ;
OriginalCDO = InOldClass - > GetDefaultObject ( ) ;
bHasReinstanced = false ;
bSkipGarbageCollection = false ;
bNeedsReinstancing = true ;
2014-12-11 06:03:58 -05:00
NewClass = InNewClass ;
// Collect the original CDO property values
SerializeCDOProperties ( InOldClass - > GetDefaultObject ( ) , OriginalCDOProperties ) ;
// Collect the property values of the new CDO
SerializeCDOProperties ( InNewClass - > GetDefaultObject ( ) , ReconstructedCDOProperties ) ;
2014-09-17 04:34:40 -04:00
SaveClassFieldMapping ( InOldClass ) ;
2015-02-04 10:13:13 -05:00
ObjectsThatShouldUseOldStuff . Add ( InOldClass ) ; //CDO of REINST_ class can be used as archetype
2014-09-17 04:34:40 -04:00
TArray < UClass * > ChildrenOfClass ;
GetDerivedClasses ( InOldClass , ChildrenOfClass ) ;
for ( auto ClassIt = ChildrenOfClass . CreateConstIterator ( ) ; ClassIt ; + + ClassIt )
{
UClass * ChildClass = * ClassIt ;
UBlueprint * ChildBP = Cast < UBlueprint > ( ChildClass - > ClassGeneratedBy ) ;
if ( ChildBP & & ! ChildBP - > HasAnyFlags ( RF_BeingRegenerated ) )
{
// If this is a direct child, change the parent and relink so the property chain is valid for reinstancing
if ( ! ChildBP - > HasAnyFlags ( RF_NeedLoad ) )
{
if ( ChildClass - > GetSuperClass ( ) = = InOldClass )
{
ReparentChild ( ChildBP ) ;
}
Children . AddUnique ( ChildBP ) ;
2015-02-04 10:54:51 -05:00
if ( ChildBP - > ParentClass = = InOldClass )
{
ChildBP - > ParentClass = NewClass ;
}
2014-09-17 04:34:40 -04:00
}
else
{
// If this is a child that caused the load of their parent, relink to the REINST class so that we can still serialize in the CDO, but do not add to later processing
ReparentChild ( ChildClass ) ;
}
}
}
// Finally, remove the old class from Root so that it can get GC'd and mark it as CLASS_NewerVersionExists
InOldClass - > RemoveFromRoot ( ) ;
InOldClass - > ClassFlags | = CLASS_NewerVersionExists ;
}
2014-12-11 06:03:58 -05:00
void FHotReloadClassReinstancer : : SerializeCDOProperties ( UObject * InObject , FHotReloadClassReinstancer : : FCDOPropertyData & OutData )
2014-09-17 04:34:40 -04:00
{
// Creates a mem-comparable CDO data
class FCDOWriter : public FMemoryWriter
{
/** Objects already visited by this archive */
TSet < UObject * > & VisitedObjects ;
2015-01-23 08:34:49 -05:00
/** Output property data */
2014-12-11 06:03:58 -05:00
FCDOPropertyData & PropertyData ;
2015-01-23 08:34:49 -05:00
/** Current subobject being serialized */
FName SubobjectName ;
2014-09-17 04:34:40 -04:00
public :
/** Serializes all script properties of the provided DefaultObject */
2015-01-23 08:34:49 -05:00
FCDOWriter ( FCDOPropertyData & InOutData , UObject * DefaultObject , TSet < UObject * > & InVisitedObjects , FName InSubobjectName = NAME_None )
2014-12-11 06:03:58 -05:00
: FMemoryWriter ( InOutData . Bytes , /* bIsPersistent = */ false , /* bSetOffset = */ true )
2014-09-17 04:34:40 -04:00
, VisitedObjects ( InVisitedObjects )
2014-12-11 06:03:58 -05:00
, PropertyData ( InOutData )
2015-01-23 08:34:49 -05:00
, SubobjectName ( InSubobjectName )
2014-09-17 04:34:40 -04:00
{
2014-12-11 06:03:58 -05:00
// Disable delta serialization, we want to serialize everything
ArNoDelta = true ;
2014-09-17 04:34:40 -04:00
DefaultObject - > SerializeScriptProperties ( * this ) ;
}
2014-12-11 06:03:58 -05:00
virtual void Serialize ( void * Data , int64 Num ) override
{
// Collect serialized properties so we can later update their values on instances if they change
auto SerializedProperty = GetSerializedProperty ( ) ;
if ( SerializedProperty ! = nullptr )
{
FCDOProperty & PropertyInfo = PropertyData . Properties . FindOrAdd ( SerializedProperty - > GetFName ( ) ) ;
if ( PropertyInfo . Property = = nullptr )
{
PropertyInfo . Property = SerializedProperty ;
2015-01-23 08:34:49 -05:00
PropertyInfo . SubobjectName = SubobjectName ;
2014-12-11 06:03:58 -05:00
PropertyInfo . SerializedValueOffset = Tell ( ) ;
PropertyInfo . SerializedValueSize = Num ;
PropertyData . Properties . Add ( SerializedProperty - > GetFName ( ) , PropertyInfo ) ;
}
else
{
PropertyInfo . SerializedValueSize + = Num ;
}
}
FMemoryWriter : : Serialize ( Data , Num ) ;
}
2014-09-17 04:34:40 -04:00
/** Serializes an object. Only name and class for normal references, deep serialization for DSOs */
virtual FArchive & operator < < ( class UObject * & InObj ) override
{
FArchive & Ar = * this ;
if ( InObj )
{
FName ClassName = InObj - > GetClass ( ) - > GetFName ( ) ;
FName ObjectName = InObj - > GetFName ( ) ;
Ar < < ClassName ;
Ar < < ObjectName ;
2014-10-24 08:09:33 -04:00
if ( ! VisitedObjects . Contains ( InObj ) )
2014-09-17 04:34:40 -04:00
{
VisitedObjects . Add ( InObj ) ;
2014-10-30 09:52:57 -04:00
if ( Ar . GetSerializedProperty ( ) & & Ar . GetSerializedProperty ( ) - > ContainsInstancedObjectProperty ( ) )
2014-10-24 08:09:33 -04:00
{
// Serialize all DSO properties too
2015-01-23 08:34:49 -05:00
FCDOWriter DefaultSubobjectWriter ( PropertyData , InObj , VisitedObjects , InObj - > GetFName ( ) ) ;
2015-02-04 06:43:42 -05:00
Seek ( PropertyData . Bytes . Num ( ) ) ;
2014-10-24 08:09:33 -04:00
}
2014-09-17 04:34:40 -04:00
}
}
else
{
FName UnusedName = NAME_None ;
Ar < < UnusedName ;
Ar < < UnusedName ;
}
return * this ;
}
2014-09-17 06:20:17 -04:00
/** Serializes an FName as its index and number */
2014-09-17 04:34:40 -04:00
virtual FArchive & operator < < ( FName & InName ) override
{
FArchive & Ar = * this ;
2014-09-17 06:20:17 -04:00
NAME_INDEX ComparisonIndex = InName . GetComparisonIndex ( ) ;
NAME_INDEX DisplayIndex = InName . GetDisplayIndex ( ) ;
2014-09-17 04:34:40 -04:00
int32 Number = InName . GetNumber ( ) ;
2014-09-17 06:20:17 -04:00
Ar < < ComparisonIndex ;
Ar < < DisplayIndex ;
2014-09-17 04:34:40 -04:00
Ar < < Number ;
return Ar ;
}
virtual FArchive & operator < < ( FLazyObjectPtr & LazyObjectPtr ) override
{
FArchive & Ar = * this ;
2014-10-30 09:53:23 -04:00
auto UniqueID = LazyObjectPtr . GetUniqueID ( ) ;
Ar < < UniqueID ;
2014-09-17 04:34:40 -04:00
return * this ;
}
virtual FArchive & operator < < ( FAssetPtr & AssetPtr ) override
{
FArchive & Ar = * this ;
2014-10-30 09:53:23 -04:00
auto UniqueID = AssetPtr . GetUniqueID ( ) ;
Ar < < UniqueID ;
2014-09-17 04:34:40 -04:00
return Ar ;
}
virtual FArchive & operator < < ( FStringAssetReference & Value ) override
{
FArchive & Ar = * this ;
2015-07-23 10:49:29 -04:00
FString Path = Value . ToString ( ) ;
Ar < < Path ;
if ( IsLoading ( ) )
{
Value . SetPath ( MoveTemp ( Path ) ) ;
}
2014-09-17 04:34:40 -04:00
return Ar ;
}
/** Archive name, for debugging */
virtual FString GetArchiveName ( ) const override { return TEXT ( " FCDOWriter " ) ; }
} ;
TSet < UObject * > VisitedObjects ;
2014-10-24 08:09:33 -04:00
VisitedObjects . Add ( InObject ) ;
2014-09-17 04:34:40 -04:00
FCDOWriter Ar ( OutData , InObject , VisitedObjects ) ;
}
2015-05-15 14:07:44 -04:00
void FHotReloadClassReinstancer : : ReconstructClassDefaultObject ( UClass * InClass , UObject * InOuter , FName InName , EObjectFlags InFlags )
2014-09-17 04:34:40 -04:00
{
// Get the parent CDO
2015-05-15 14:07:44 -04:00
UClass * ParentClass = InClass - > GetSuperClass ( ) ;
2014-09-17 04:34:40 -04:00
UObject * ParentDefaultObject = NULL ;
if ( ParentClass ! = NULL )
{
ParentDefaultObject = ParentClass - > GetDefaultObject ( ) ; // Force the default object to be constructed if it isn't already
}
// Re-create
2015-11-18 16:20:49 -05:00
InClass - > ClassDefaultObject = StaticAllocateObject ( InClass , InOuter , InName , InFlags , EInternalObjectFlags : : None , false ) ;
2015-05-15 14:07:44 -04:00
check ( InClass - > ClassDefaultObject ) ;
Copying //UE4/Dev-Blueprints to //UE4/Dev-Main (Source: //UE4/Dev-Blueprints @ 3130440)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3050029 on 2016/07/14 by Ben.Cosh
This modifies the blueprint instrumented compilation chain so only the the blueprint you compile and all dependencies are instrumented and the profiler is notified rather than waiting for event data.
#Jira UE-32063 - The blueprint profiler doesn't display any stats in the execution graph if no instance is placed in the current level.
#Proj BlueprintProfiler, Kismet, UnrelEd
- This also improves the execution graph UI, notifying the user that no instances are available to display data from.
Change 3101549 on 2016/08/25 by Maciej.Mroz
BP nativization: fixed FEmitDefaultValueHelper::HandleInstancedSubobject
https://udn.unrealengine.com/questions/308800/nativized-blueprints-newobject-call-uses-incorrect.html
Change 3101811 on 2016/08/25 by Ryan.Rauschkolb
BP Profiler: Fixed stack overflow crash when compiling blueprints with nested macros
#jira UE-34503
Change 3102478 on 2016/08/26 by Maciej.Mroz
#jira UE-35135 - Odin compiles with errors when using Blueprint nativization
BP Nativization:
- improved native cast
- improved bool handling
Change 3102944 on 2016/08/26 by Phillip.Kavan
[UE-33017] Don't include transient properties when generating property lists at cook time for optimized runtime Blueprint component instancing. Also ensure that deprecated properties are serialized during load/instancing at runtime.
change summary:
- modified FBlueprintComponentInstanceDataLoader to append 'PPF_UseDeprecatedProperties' to the FArchive port flags.
- modified FBlueprintComponentInstanceDataWriter to append both 'PPF_Duplicate' and 'PPF_UseDeprecatedProperties" to the FArchive port flags (to ensure consistency w/ the instancing side).
- switched the RecursivePropertyGatherLambda helper to a static class method instead
- modified the RecursivePropertyGather utility method to exclude transient properties.
notes:
- the primary cause of UE-33017 was that UBodySetup can "share" the ShapeBodySetup object across all instances, but the shared object is not owned by the CDO, it's owned by the archetype. this caused the archetype to differ from the CDO, which caused us to emit the transient property at cook time. thsi threw off the serialization offset between read/write FArchive passes at runtime. since transient properties are not serialized as part of the template, there's no need to include them in the generated delta property list, so as a fix, i'm just excluding them altogether.
#jira UE-33017
Change 3103692 on 2016/08/27 by Mike.Beach
Merging //UE4/Dev-Main to Dev-Blueprints (//UE4/Dev-Blueprints)
Change 3104266 on 2016/08/29 by Ben.Marsh
Add test script to native assets for QAGame.
Change 3104399 on 2016/08/29 by Ben.Marsh
Fix missing property warning in build script.
Change 3104419 on 2016/08/29 by Maciej.Mroz
#jira UE-35135 Odin compiles with errors when using Blueprint nativization
- Reduced number of DynamicCLass instance dependencies
- Fixed UDS default values dependencies
- Improved WeakObjPtr handling
- Improved const parameters handling
Change 3104474 on 2016/08/29 by Ryan.Rauschkolb
BP Profiler: Fixed issue where collapsed nodes that share a name with a parent class collapsed node can cause a stack overflow
#jira UE-35245
Change 3105605 on 2016/08/30 by Maciej.Mroz
Temp change: CIS Test
Change 3105738 on 2016/08/30 by Maciej.Mroz
UAT, CIS: testing NoRecompileUAT switch.
Change 3105800 on 2016/08/30 by Maciej.Mroz
UAT, CIS, Nativization:
- reverted NoRecompileUAT switch.
- testing nativization with -nocompileeditor flag and without -compile flag
Change 3106162 on 2016/08/30 by Maciej.Mroz
UAT, CIS, Nativization:
-NoSubmit flag added. Otherwise UAT files are singed (when they are used by other process). It causes an error.
- Ugly hack removed.
Change 3106261 on 2016/08/30 by Phillip.Kavan
[UE-34705] Gracefully handle tunnel node entry exec pins that aren't internally linked during BP profiler tunnel boundary mapping.
change summary:
- added FBlueprintFunctionContext::GetTunnelBoundaryNode() (uncheckedl variant).
- moved FBlueprintFunctionContext::GetTunnelBoundaryNodeChecked() impl into GetTunnelBoundaryNode().
- re-implemented FBlueprintFunctionContext::GetTunnelBoundaryNodeChecked() to call GetTunnelBoundaryNode() and then assert on the result.
- changed the FBlueprintTunnelInstanceContext::GetTunnelBoundaryNodeChecked() impl to override GetTunnelBoundaryNode() instead.
- modified FBlueprintFunctionContext::MapTunnelBoundary() to only process the entry case if the TunnelBoundaryNode result is valid. this way we simply skip tunnel boundary mapping if an entry path was not previously mapped (rather than assert).
#jira UE-34705
Change 3106478 on 2016/08/30 by Ben.Marsh
Include *.uasset files on builders running the NativizeAssets job.
Change 3107514 on 2016/08/31 by Ben.Cosh
This set of changes is the result of a full pass on the blueprint profiler heat interface to try and bring them into a usable state.
#Jira UE-33465 - Stat heat colors and heat wire traces need a quick pass to ensure they are working as expected.
#Jira UE-33309 - FlipFlop node breaks hottest path wire heatmap
#Jira UE-33650 - Blueprint heatwire effects do not work when touching user macros
#Jira UE-33706 - BP Profiler - Macro instances not colored or reporting time
#Jira UE-33701 - BP Profiler: Hottest path wire heatmap doesn't appear to be working
#Jira UE-33083 - BP Profiler - (Exclusive) pure node heatmap missing from some nodes
#Jira UE-34855 - BP Profiler - Update heatmap coloration when switching between Default/Custom thresholds
#Jira UE-32218 - BP Profiler: Clear "inclusive" time entries from "avg. time" row.
#Proj GraphEditor, Kismet, BlueprintProfiler,
Change 3108268 on 2016/08/31 by Ben.Cosh
Minor change from profiler review sessions to move macro timing to average stats.
#Jira UE-33706 - BP Profiler - Macro instances not colored or reporting time
#Proj Kismet
Change 3108991 on 2016/08/31 by Maciej.Mroz
UAT, CIS, Nativization: Test separate cooking and compiling
Change 3110097 on 2016/09/01 by Ben.Cosh
Minor update to the blueprint profiler mapping functionality to ignore disabled nodes and a fix for the max timing white glow bug.
#Jira UE-35377 - Blueprint macros highlighting white in profiler
#Jira UE-34973 - Remove Ghost Nodes
#Proj Kismet, BlueprintProfiler
Change 3114553 on 2016/09/06 by Dan.Oconnor
Support for TMap/TSet in blueprint variable editor panel
#jira UE-2114
Change 3116367 on 2016/09/07 by Dan.Oconnor
Fixed Function/Macro inputs/outputs list (had become cramped with my last change) + misc. fixes for new container types, fixes uninitialized members in FTerminalType
#jira UE-2114, UE-35676
Change 3116663 on 2016/09/07 by Dan.Oconnor
Fix for array functions showing up with TSet and TMap pins
#jira UE-2114
Change 3118259 on 2016/09/08 by Ryan.Rauschkolb
BP Profiler: Fixed Assert when profiling parent/child Blueprint
#jira UE-35487
Change 3119023 on 2016/09/09 by Maciej.Mroz
Manually integrated (from Odin branch) recent changes related to BP and nativization:
3115713 UE-35448
3117590 UE-35697
3117742 ODIN-577
Change 3119058 on 2016/09/09 by Maciej.Mroz
#jira UE-32841 GitHub 2574 : fix typos
#2574 https://github.com/EpicGames/UnrealEngine/pull/2574
Renamed function CustomNativeInitilize to InitializeNativeClassData and made it private.
Change 3119302 on 2016/09/09 by Maciej.Mroz
#jira UE-35584 Orion - nativized server crashes
Global variable for WITH_PERFCOUNTERS definition in UEBuildConfiguration.
Previously the same header could be compiled with the WITH_PERFCOUNTERS flag enadles and disabled (during a single compilation) .
Change 3119502 on 2016/09/09 by Mike.Beach
When building a deterministic UUID for latent nodes, we now use expanded nodes' origin (node) to avoid collisions (latent node in macros, etc.)
#jira UE-35609
Change 3119517 on 2016/09/09 by Ryan.Rauschkolb
Added blueprint editor settings option to display unique names for blueprint nodes
Change 3119602 on 2016/09/09 by Maciej.Mroz
#jira UEBP-214 Implement Solution for Nativized AnimBlueprints Size Reduction
Added stats about nativized AnimBP
Mechanism to exlcude reducible AnimBP
Editor config option:[BlueprintNativizationSettings] bNativizeAnimBPOnlyWhenNonReducibleFuncitons=false
Change 3119615 on 2016/09/09 by Maciej.Mroz
Missing change (should be part of cl#3119602)
Change 3119619 on 2016/09/09 by Maciej.Mroz
#jira UEBP-214 Implement Solution for Nativized AnimBlueprints Size Reduction
Excluding all AnimBP from Orion nativization.
Change 3120752 on 2016/09/12 by Maciej.Mroz
#jira UE-35051 [CrashReport] UE4Editor_BlueprintNativeCodeGen!FBlueprintNativeCodeGenModule::GenerateSingleAsset()
Removed unnecessary ensure
Change 3121354 on 2016/09/12 by Dan.Oconnor
Fixed variable type width, required for TMap's extra combobox.
Change 3121626 on 2016/09/12 by Phillip.Kavan
[UE-35456] Fix crash on right-click in components tree view after copying one or more BSP actors to clipboard.
Note: This applies to the components tree view in both the Blueprint editor and the Level editor's Actor details panel.
change summary:
- modified FComponentObjectTextFactory::CanCreateClass() to exclude Actor/Component subtypes that are not Blueprint-compatible (e.g. ABrush).
#jira UE-35456
Change 3122712 on 2016/09/13 by Maciej.Mroz
#jira UE-35714 [CrashReport] UE4Editor_BlueprintGraph!UK2Node_CallArrayFunction::GetArrayPins() [k2node_callarrayfunction.cpp:141]
Replaced "check" with "ensure".
Change 3124398 on 2016/09/14 by Maciej.Mroz
More strict BP validation in UBlueprintThumbnailRenderer::Draw
#jira UE-35705
Change 3124405 on 2016/09/14 by Maciej.Mroz
#jira UE-35110 Packaged project crashes when playing sound from blueprint library with enum input after nativizing blueprints
Function Libraries are properly added to dependencies list while nativization.
Change 3124667 on 2016/09/14 by Maciej.Mroz
#jira UE-35262 Incompatible pins give generate warning, when error is necessary.
Fixed incompatible pins validation.
Change 3125245 on 2016/09/14 by Phillip.Kavan
[UE-33674] Fix missing stats for the ForEachElementInEnum node type in the Blueprint profiler tree view.
change summary:
- modified FScriptEventPlayback::Process() to not allow intermediate node exit pins to pollute the current trace path
- modified FBlueprintFunctionContext::DetermineGraphNodeCharacteristics() to handle the UK2Node_ForEachElementInEnum type as a special case and account for extra loop iterations in the sample frequency computed at mapping time
- exported UK2Node_ForEachElementInEnum::InsideLoopPinName and EnumOutputPinName string constants
#jira UE-33674
Change 3126211 on 2016/09/15 by Maciej.Mroz
#jira UE-36016 Struct pin can be connected to Object pin without error
Change 3126393 on 2016/09/15 by Maciej.Mroz
#jira UE-35936
Replace "check" by "ensure".
Change 3126623 on 2016/09/15 by Maciej.Mroz
#jira UE-35816 User defined struct array resets to defaults in blueprint after updating the struct
STRUCT_SerializeFromMismatchedTag is not necessary to serialize structure when guids match. Anyway STRUCT_SerializeFromMismatchedTag sholud precede SerializeFromMismatchedTag().
Change 3127288 on 2016/09/15 by Mike.Beach
Making the script VM overhead and native time stats threadsafe (to account for threaded anim Blueprints in Orion).
Change 3127375 on 2016/09/15 by Mike.Beach
Making sure Blueprint classes inherit the super's ClassConfigName properly (inherit the ID instead of the filename).
Change 3127381 on 2016/09/15 by Mike.Beach
Removing an overzealous ensure that certain users were hitting when a loading array property wasn't fully filled out yet (confirmed that it was populated with the proper objects by the end of the load).
Change 3127476 on 2016/09/15 by Dan.Oconnor
Build fix
#jira UE-36073
Change 3128335 on 2016/09/16 by Maciej.Mroz
#jira UE-36075 Odin: BP_DefaultHand and BigBotCharacter blueprints fail to compile
Fixed broken BP assets.
Change 3128589 on 2016/09/16 by Mike.Beach
Fixing a static analysis CIS warning (duplicated condition).
Change 3128630 on 2016/09/16 by Dan.Oconnor
Re-fix with engine version set
Change 3129338 on 2016/09/16 by Dan.Oconnor
=FScriptSet/FScriptSetHelper fleshed out (Add, Remove, and Find implemented)
+SetParam implemented for marking up sets for primitive Set functions (to be checked in once completed as BlueprintSetLibrary)
#jira UE-2114
[CL 3131171 by Mike Beach in Main branch]
2016-09-19 16:14:06 -04:00
const bool bShouldInitializeProperties = false ;
2014-09-17 04:34:40 -04:00
const bool bCopyTransientsFromClassDefaults = false ;
Copying //UE4/Dev-Blueprints to //UE4/Dev-Main (Source: //UE4/Dev-Blueprints @ 3130440)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3050029 on 2016/07/14 by Ben.Cosh
This modifies the blueprint instrumented compilation chain so only the the blueprint you compile and all dependencies are instrumented and the profiler is notified rather than waiting for event data.
#Jira UE-32063 - The blueprint profiler doesn't display any stats in the execution graph if no instance is placed in the current level.
#Proj BlueprintProfiler, Kismet, UnrelEd
- This also improves the execution graph UI, notifying the user that no instances are available to display data from.
Change 3101549 on 2016/08/25 by Maciej.Mroz
BP nativization: fixed FEmitDefaultValueHelper::HandleInstancedSubobject
https://udn.unrealengine.com/questions/308800/nativized-blueprints-newobject-call-uses-incorrect.html
Change 3101811 on 2016/08/25 by Ryan.Rauschkolb
BP Profiler: Fixed stack overflow crash when compiling blueprints with nested macros
#jira UE-34503
Change 3102478 on 2016/08/26 by Maciej.Mroz
#jira UE-35135 - Odin compiles with errors when using Blueprint nativization
BP Nativization:
- improved native cast
- improved bool handling
Change 3102944 on 2016/08/26 by Phillip.Kavan
[UE-33017] Don't include transient properties when generating property lists at cook time for optimized runtime Blueprint component instancing. Also ensure that deprecated properties are serialized during load/instancing at runtime.
change summary:
- modified FBlueprintComponentInstanceDataLoader to append 'PPF_UseDeprecatedProperties' to the FArchive port flags.
- modified FBlueprintComponentInstanceDataWriter to append both 'PPF_Duplicate' and 'PPF_UseDeprecatedProperties" to the FArchive port flags (to ensure consistency w/ the instancing side).
- switched the RecursivePropertyGatherLambda helper to a static class method instead
- modified the RecursivePropertyGather utility method to exclude transient properties.
notes:
- the primary cause of UE-33017 was that UBodySetup can "share" the ShapeBodySetup object across all instances, but the shared object is not owned by the CDO, it's owned by the archetype. this caused the archetype to differ from the CDO, which caused us to emit the transient property at cook time. thsi threw off the serialization offset between read/write FArchive passes at runtime. since transient properties are not serialized as part of the template, there's no need to include them in the generated delta property list, so as a fix, i'm just excluding them altogether.
#jira UE-33017
Change 3103692 on 2016/08/27 by Mike.Beach
Merging //UE4/Dev-Main to Dev-Blueprints (//UE4/Dev-Blueprints)
Change 3104266 on 2016/08/29 by Ben.Marsh
Add test script to native assets for QAGame.
Change 3104399 on 2016/08/29 by Ben.Marsh
Fix missing property warning in build script.
Change 3104419 on 2016/08/29 by Maciej.Mroz
#jira UE-35135 Odin compiles with errors when using Blueprint nativization
- Reduced number of DynamicCLass instance dependencies
- Fixed UDS default values dependencies
- Improved WeakObjPtr handling
- Improved const parameters handling
Change 3104474 on 2016/08/29 by Ryan.Rauschkolb
BP Profiler: Fixed issue where collapsed nodes that share a name with a parent class collapsed node can cause a stack overflow
#jira UE-35245
Change 3105605 on 2016/08/30 by Maciej.Mroz
Temp change: CIS Test
Change 3105738 on 2016/08/30 by Maciej.Mroz
UAT, CIS: testing NoRecompileUAT switch.
Change 3105800 on 2016/08/30 by Maciej.Mroz
UAT, CIS, Nativization:
- reverted NoRecompileUAT switch.
- testing nativization with -nocompileeditor flag and without -compile flag
Change 3106162 on 2016/08/30 by Maciej.Mroz
UAT, CIS, Nativization:
-NoSubmit flag added. Otherwise UAT files are singed (when they are used by other process). It causes an error.
- Ugly hack removed.
Change 3106261 on 2016/08/30 by Phillip.Kavan
[UE-34705] Gracefully handle tunnel node entry exec pins that aren't internally linked during BP profiler tunnel boundary mapping.
change summary:
- added FBlueprintFunctionContext::GetTunnelBoundaryNode() (uncheckedl variant).
- moved FBlueprintFunctionContext::GetTunnelBoundaryNodeChecked() impl into GetTunnelBoundaryNode().
- re-implemented FBlueprintFunctionContext::GetTunnelBoundaryNodeChecked() to call GetTunnelBoundaryNode() and then assert on the result.
- changed the FBlueprintTunnelInstanceContext::GetTunnelBoundaryNodeChecked() impl to override GetTunnelBoundaryNode() instead.
- modified FBlueprintFunctionContext::MapTunnelBoundary() to only process the entry case if the TunnelBoundaryNode result is valid. this way we simply skip tunnel boundary mapping if an entry path was not previously mapped (rather than assert).
#jira UE-34705
Change 3106478 on 2016/08/30 by Ben.Marsh
Include *.uasset files on builders running the NativizeAssets job.
Change 3107514 on 2016/08/31 by Ben.Cosh
This set of changes is the result of a full pass on the blueprint profiler heat interface to try and bring them into a usable state.
#Jira UE-33465 - Stat heat colors and heat wire traces need a quick pass to ensure they are working as expected.
#Jira UE-33309 - FlipFlop node breaks hottest path wire heatmap
#Jira UE-33650 - Blueprint heatwire effects do not work when touching user macros
#Jira UE-33706 - BP Profiler - Macro instances not colored or reporting time
#Jira UE-33701 - BP Profiler: Hottest path wire heatmap doesn't appear to be working
#Jira UE-33083 - BP Profiler - (Exclusive) pure node heatmap missing from some nodes
#Jira UE-34855 - BP Profiler - Update heatmap coloration when switching between Default/Custom thresholds
#Jira UE-32218 - BP Profiler: Clear "inclusive" time entries from "avg. time" row.
#Proj GraphEditor, Kismet, BlueprintProfiler,
Change 3108268 on 2016/08/31 by Ben.Cosh
Minor change from profiler review sessions to move macro timing to average stats.
#Jira UE-33706 - BP Profiler - Macro instances not colored or reporting time
#Proj Kismet
Change 3108991 on 2016/08/31 by Maciej.Mroz
UAT, CIS, Nativization: Test separate cooking and compiling
Change 3110097 on 2016/09/01 by Ben.Cosh
Minor update to the blueprint profiler mapping functionality to ignore disabled nodes and a fix for the max timing white glow bug.
#Jira UE-35377 - Blueprint macros highlighting white in profiler
#Jira UE-34973 - Remove Ghost Nodes
#Proj Kismet, BlueprintProfiler
Change 3114553 on 2016/09/06 by Dan.Oconnor
Support for TMap/TSet in blueprint variable editor panel
#jira UE-2114
Change 3116367 on 2016/09/07 by Dan.Oconnor
Fixed Function/Macro inputs/outputs list (had become cramped with my last change) + misc. fixes for new container types, fixes uninitialized members in FTerminalType
#jira UE-2114, UE-35676
Change 3116663 on 2016/09/07 by Dan.Oconnor
Fix for array functions showing up with TSet and TMap pins
#jira UE-2114
Change 3118259 on 2016/09/08 by Ryan.Rauschkolb
BP Profiler: Fixed Assert when profiling parent/child Blueprint
#jira UE-35487
Change 3119023 on 2016/09/09 by Maciej.Mroz
Manually integrated (from Odin branch) recent changes related to BP and nativization:
3115713 UE-35448
3117590 UE-35697
3117742 ODIN-577
Change 3119058 on 2016/09/09 by Maciej.Mroz
#jira UE-32841 GitHub 2574 : fix typos
#2574 https://github.com/EpicGames/UnrealEngine/pull/2574
Renamed function CustomNativeInitilize to InitializeNativeClassData and made it private.
Change 3119302 on 2016/09/09 by Maciej.Mroz
#jira UE-35584 Orion - nativized server crashes
Global variable for WITH_PERFCOUNTERS definition in UEBuildConfiguration.
Previously the same header could be compiled with the WITH_PERFCOUNTERS flag enadles and disabled (during a single compilation) .
Change 3119502 on 2016/09/09 by Mike.Beach
When building a deterministic UUID for latent nodes, we now use expanded nodes' origin (node) to avoid collisions (latent node in macros, etc.)
#jira UE-35609
Change 3119517 on 2016/09/09 by Ryan.Rauschkolb
Added blueprint editor settings option to display unique names for blueprint nodes
Change 3119602 on 2016/09/09 by Maciej.Mroz
#jira UEBP-214 Implement Solution for Nativized AnimBlueprints Size Reduction
Added stats about nativized AnimBP
Mechanism to exlcude reducible AnimBP
Editor config option:[BlueprintNativizationSettings] bNativizeAnimBPOnlyWhenNonReducibleFuncitons=false
Change 3119615 on 2016/09/09 by Maciej.Mroz
Missing change (should be part of cl#3119602)
Change 3119619 on 2016/09/09 by Maciej.Mroz
#jira UEBP-214 Implement Solution for Nativized AnimBlueprints Size Reduction
Excluding all AnimBP from Orion nativization.
Change 3120752 on 2016/09/12 by Maciej.Mroz
#jira UE-35051 [CrashReport] UE4Editor_BlueprintNativeCodeGen!FBlueprintNativeCodeGenModule::GenerateSingleAsset()
Removed unnecessary ensure
Change 3121354 on 2016/09/12 by Dan.Oconnor
Fixed variable type width, required for TMap's extra combobox.
Change 3121626 on 2016/09/12 by Phillip.Kavan
[UE-35456] Fix crash on right-click in components tree view after copying one or more BSP actors to clipboard.
Note: This applies to the components tree view in both the Blueprint editor and the Level editor's Actor details panel.
change summary:
- modified FComponentObjectTextFactory::CanCreateClass() to exclude Actor/Component subtypes that are not Blueprint-compatible (e.g. ABrush).
#jira UE-35456
Change 3122712 on 2016/09/13 by Maciej.Mroz
#jira UE-35714 [CrashReport] UE4Editor_BlueprintGraph!UK2Node_CallArrayFunction::GetArrayPins() [k2node_callarrayfunction.cpp:141]
Replaced "check" with "ensure".
Change 3124398 on 2016/09/14 by Maciej.Mroz
More strict BP validation in UBlueprintThumbnailRenderer::Draw
#jira UE-35705
Change 3124405 on 2016/09/14 by Maciej.Mroz
#jira UE-35110 Packaged project crashes when playing sound from blueprint library with enum input after nativizing blueprints
Function Libraries are properly added to dependencies list while nativization.
Change 3124667 on 2016/09/14 by Maciej.Mroz
#jira UE-35262 Incompatible pins give generate warning, when error is necessary.
Fixed incompatible pins validation.
Change 3125245 on 2016/09/14 by Phillip.Kavan
[UE-33674] Fix missing stats for the ForEachElementInEnum node type in the Blueprint profiler tree view.
change summary:
- modified FScriptEventPlayback::Process() to not allow intermediate node exit pins to pollute the current trace path
- modified FBlueprintFunctionContext::DetermineGraphNodeCharacteristics() to handle the UK2Node_ForEachElementInEnum type as a special case and account for extra loop iterations in the sample frequency computed at mapping time
- exported UK2Node_ForEachElementInEnum::InsideLoopPinName and EnumOutputPinName string constants
#jira UE-33674
Change 3126211 on 2016/09/15 by Maciej.Mroz
#jira UE-36016 Struct pin can be connected to Object pin without error
Change 3126393 on 2016/09/15 by Maciej.Mroz
#jira UE-35936
Replace "check" by "ensure".
Change 3126623 on 2016/09/15 by Maciej.Mroz
#jira UE-35816 User defined struct array resets to defaults in blueprint after updating the struct
STRUCT_SerializeFromMismatchedTag is not necessary to serialize structure when guids match. Anyway STRUCT_SerializeFromMismatchedTag sholud precede SerializeFromMismatchedTag().
Change 3127288 on 2016/09/15 by Mike.Beach
Making the script VM overhead and native time stats threadsafe (to account for threaded anim Blueprints in Orion).
Change 3127375 on 2016/09/15 by Mike.Beach
Making sure Blueprint classes inherit the super's ClassConfigName properly (inherit the ID instead of the filename).
Change 3127381 on 2016/09/15 by Mike.Beach
Removing an overzealous ensure that certain users were hitting when a loading array property wasn't fully filled out yet (confirmed that it was populated with the proper objects by the end of the load).
Change 3127476 on 2016/09/15 by Dan.Oconnor
Build fix
#jira UE-36073
Change 3128335 on 2016/09/16 by Maciej.Mroz
#jira UE-36075 Odin: BP_DefaultHand and BigBotCharacter blueprints fail to compile
Fixed broken BP assets.
Change 3128589 on 2016/09/16 by Mike.Beach
Fixing a static analysis CIS warning (duplicated condition).
Change 3128630 on 2016/09/16 by Dan.Oconnor
Re-fix with engine version set
Change 3129338 on 2016/09/16 by Dan.Oconnor
=FScriptSet/FScriptSetHelper fleshed out (Add, Remove, and Find implemented)
+SetParam implemented for marking up sets for primitive Set functions (to be checked in once completed as BlueprintSetLibrary)
#jira UE-2114
[CL 3131171 by Mike Beach in Main branch]
2016-09-19 16:14:06 -04:00
( * InClass - > ClassConstructor ) ( FObjectInitializer ( InClass - > ClassDefaultObject , ParentDefaultObject , bCopyTransientsFromClassDefaults , bShouldInitializeProperties ) ) ;
2014-09-17 04:34:40 -04:00
}
void FHotReloadClassReinstancer : : RecreateCDOAndSetupOldClassReinstancing ( UClass * InOldClass )
{
// Set base class members to valid values
ClassToReinstance = InOldClass ;
DuplicatedClass = InOldClass ;
OriginalCDO = InOldClass - > GetDefaultObject ( ) ;
bHasReinstanced = false ;
bSkipGarbageCollection = false ;
bNeedsReinstancing = false ;
2014-12-11 06:03:58 -05:00
NewClass = InOldClass ; // The class doesn't change in this case
2014-09-17 04:34:40 -04:00
// Collect the original property values
SerializeCDOProperties ( InOldClass - > GetDefaultObject ( ) , OriginalCDOProperties ) ;
2015-03-09 15:41:53 -04:00
2015-05-15 14:07:44 -04:00
// Remember all the basic info about the object before we rename it
EObjectFlags CDOFlags = OriginalCDO - > GetFlags ( ) ;
UObject * CDOOuter = OriginalCDO - > GetOuter ( ) ;
FName CDOName = OriginalCDO - > GetFName ( ) ;
// Rename original CDO, so we can store this one as OverridenArchetypeForCDO
// and create new one with the same name and outer.
OriginalCDO - > Rename (
* MakeUniqueObjectName (
GetTransientPackage ( ) ,
OriginalCDO - > GetClass ( ) ,
* FString : : Printf ( TEXT ( " BPGC_ARCH_FOR_CDO_%s " ) , * InOldClass - > GetName ( ) )
) . ToString ( ) ,
GetTransientPackage ( ) ,
REN_DoNotDirty | REN_DontCreateRedirectors | REN_NonTransactional | REN_SkipGeneratedClasses | REN_ForceNoResetLoaders ) ;
// Re-create the CDO, re-running its constructor
ReconstructClassDefaultObject ( InOldClass , CDOOuter , CDOName , CDOFlags ) ;
2014-09-17 04:34:40 -04:00
2015-07-13 07:30:06 -04:00
ReconstructedCDOsMap . Add ( OriginalCDO , InOldClass - > GetDefaultObject ( ) ) ;
2014-09-17 04:34:40 -04:00
// Collect the property values after re-constructing the CDO
SerializeCDOProperties ( InOldClass - > GetDefaultObject ( ) , ReconstructedCDOProperties ) ;
// We only want to re-instance the old class if its CDO's values have changed or any of its DSOs' property values have changed
2014-12-11 06:03:58 -05:00
if ( DefaultPropertiesHaveChanged ( ) )
2014-09-17 04:34:40 -04:00
{
bNeedsReinstancing = true ;
SaveClassFieldMapping ( InOldClass ) ;
TArray < UClass * > ChildrenOfClass ;
GetDerivedClasses ( InOldClass , ChildrenOfClass ) ;
for ( auto ClassIt = ChildrenOfClass . CreateConstIterator ( ) ; ClassIt ; + + ClassIt )
{
UClass * ChildClass = * ClassIt ;
UBlueprint * ChildBP = Cast < UBlueprint > ( ChildClass - > ClassGeneratedBy ) ;
if ( ChildBP & & ! ChildBP - > HasAnyFlags ( RF_BeingRegenerated ) )
{
if ( ! ChildBP - > HasAnyFlags ( RF_NeedLoad ) )
{
Children . AddUnique ( ChildBP ) ;
2015-03-09 15:41:53 -04:00
auto BPGC = Cast < UBlueprintGeneratedClass > ( ChildBP - > GeneratedClass ) ;
auto CurrentCDO = BPGC ? BPGC - > GetDefaultObject ( false ) : nullptr ;
if ( CurrentCDO & & ( OriginalCDO = = CurrentCDO - > GetArchetype ( ) ) )
{
2015-05-15 14:07:44 -04:00
BPGC - > OverridenArchetypeForCDO = OriginalCDO ;
2015-03-09 15:41:53 -04:00
}
2014-09-17 04:34:40 -04:00
}
}
}
}
}
2015-09-30 05:26:51 -04:00
FHotReloadClassReinstancer : : FHotReloadClassReinstancer ( UClass * InNewClass , UClass * InOldClass , const TMap < UClass * , UClass * > & InOldToNewClassesMap , TMap < UObject * , UObject * > & OutReconstructedCDOsMap , TSet < UBlueprint * > & InBPSetToRecompile , TSet < UBlueprint * > & InBPSetToRecompileBytecodeOnly )
2014-12-11 06:03:58 -05:00
: NewClass ( nullptr )
, bNeedsReinstancing ( false )
2015-03-09 15:41:53 -04:00
, CopyOfPreviousCDO ( nullptr )
2015-07-13 07:30:06 -04:00
, ReconstructedCDOsMap ( OutReconstructedCDOsMap )
2015-07-21 10:33:15 -04:00
, BPSetToRecompile ( InBPSetToRecompile )
, BPSetToRecompileBytecodeOnly ( InBPSetToRecompileBytecodeOnly )
2015-09-30 05:26:51 -04:00
, OldToNewClassesMap ( InOldToNewClassesMap )
2014-09-17 04:34:40 -04:00
{
2015-04-25 16:18:36 -04:00
ensure ( InOldClass ) ;
ensure ( ! HotReloadedOldClass & & ! HotReloadedNewClass ) ;
HotReloadedOldClass = InOldClass ;
HotReloadedNewClass = InNewClass ? InNewClass : InOldClass ;
2015-09-30 05:26:51 -04:00
for ( const TPair < UClass * , UClass * > & OldToNewClass : OldToNewClassesMap )
{
ObjectsThatShouldUseOldStuff . Add ( OldToNewClass . Key ) ;
}
2014-09-17 04:34:40 -04:00
// If InNewClass is NULL, then the old class has not changed after hot-reload.
// However, we still need to check for changes to its constructor code (CDO values).
if ( InNewClass )
{
SetupNewClassReinstancing ( InNewClass , InOldClass ) ;
2015-03-12 22:05:56 -04:00
TMap < UObject * , UObject * > ClassRedirects ;
ClassRedirects . Add ( InOldClass , InNewClass ) ;
for ( TObjectIterator < UBlueprint > BlueprintIt ; BlueprintIt ; + + BlueprintIt )
{
2015-04-25 16:18:36 -04:00
FArchiveReplaceObjectRef < UObject > ReplaceObjectArch ( * BlueprintIt , ClassRedirects , false , true , true ) ;
if ( ReplaceObjectArch . GetCount ( ) )
{
2015-09-30 05:26:51 -04:00
EnlistDependentBlueprintToRecompile ( * BlueprintIt , false ) ;
2015-04-25 16:18:36 -04:00
}
2015-03-12 22:05:56 -04:00
}
2014-09-17 04:34:40 -04:00
}
else
{
RecreateCDOAndSetupOldClassReinstancing ( InOldClass ) ;
}
}
FHotReloadClassReinstancer : : ~ FHotReloadClassReinstancer ( )
{
// Make sure the base class does not remove the DuplicatedClass from root, we not always want it.
// For example when we're just reconstructing CDOs. Other cases are handled by HotReloadClassReinstancer.
2015-01-23 08:34:49 -05:00
DuplicatedClass = nullptr ;
2015-04-25 16:18:36 -04:00
ensure ( HotReloadedOldClass ) ;
HotReloadedOldClass = nullptr ;
HotReloadedNewClass = nullptr ;
2015-01-23 08:34:49 -05:00
}
/** Helper for finding subobject in an array. Usually there's not that many subobjects on a class to justify a TMap */
FORCEINLINE static UObject * FindDefaultSubobject ( TArray < UObject * > & InDefaultSubobjects , FName SubobjectName )
{
for ( auto Subobject : InDefaultSubobjects )
{
if ( Subobject - > GetFName ( ) = = SubobjectName )
{
return Subobject ;
}
}
return nullptr ;
2014-09-17 04:34:40 -04:00
}
2014-12-11 06:03:58 -05:00
void FHotReloadClassReinstancer : : UpdateDefaultProperties ( )
{
struct FPropertyToUpdate
{
UProperty * Property ;
2015-01-23 08:34:49 -05:00
FName SubobjectName ;
2014-12-11 06:03:58 -05:00
uint8 * OldSerializedValuePtr ;
uint8 * NewValuePtr ;
int64 OldSerializedSize ;
} ;
2015-02-06 02:46:08 -05:00
/** Memory writer archive that supports UObject values the same way as FCDOWriter. */
class FPropertyValueMemoryWriter : public FMemoryWriter
{
public :
FPropertyValueMemoryWriter ( TArray < uint8 > & OutData )
: FMemoryWriter ( OutData )
{ }
virtual FArchive & operator < < ( class UObject * & InObj ) override
{
FArchive & Ar = * this ;
if ( InObj )
{
FName ClassName = InObj - > GetClass ( ) - > GetFName ( ) ;
FName ObjectName = InObj - > GetFName ( ) ;
Ar < < ClassName ;
Ar < < ObjectName ;
}
else
{
FName UnusedName = NAME_None ;
Ar < < UnusedName ;
Ar < < UnusedName ;
}
return * this ;
}
2015-03-12 09:27:03 -04:00
virtual FArchive & operator < < ( FName & InName ) override
{
FArchive & Ar = * this ;
NAME_INDEX ComparisonIndex = InName . GetComparisonIndex ( ) ;
NAME_INDEX DisplayIndex = InName . GetDisplayIndex ( ) ;
int32 Number = InName . GetNumber ( ) ;
Ar < < ComparisonIndex ;
Ar < < DisplayIndex ;
Ar < < Number ;
return Ar ;
}
virtual FArchive & operator < < ( FLazyObjectPtr & LazyObjectPtr ) override
{
FArchive & Ar = * this ;
auto UniqueID = LazyObjectPtr . GetUniqueID ( ) ;
Ar < < UniqueID ;
return * this ;
}
virtual FArchive & operator < < ( FAssetPtr & AssetPtr ) override
{
FArchive & Ar = * this ;
auto UniqueID = AssetPtr . GetUniqueID ( ) ;
Ar < < UniqueID ;
return Ar ;
}
virtual FArchive & operator < < ( FStringAssetReference & Value ) override
{
FArchive & Ar = * this ;
2015-07-23 10:49:29 -04:00
FString Path = Value . ToString ( ) ;
Ar < < Path ;
if ( IsLoading ( ) )
{
Value . SetPath ( MoveTemp ( Path ) ) ;
}
2015-03-12 09:27:03 -04:00
return Ar ;
}
2015-02-06 02:46:08 -05:00
} ;
2015-01-23 08:34:49 -05:00
// Collect default subobjects to update their properties too
const int32 DefaultSubobjectArrayCapacity = 16 ;
TArray < UObject * > DefaultSubobjectArray ;
DefaultSubobjectArray . Empty ( DefaultSubobjectArrayCapacity ) ;
NewClass - > GetDefaultObject ( ) - > CollectDefaultSubobjects ( DefaultSubobjectArray ) ;
2014-12-11 06:03:58 -05:00
TArray < FPropertyToUpdate > PropertiesToUpdate ;
// Collect all properties that have actually changed
for ( auto & Pair : ReconstructedCDOProperties . Properties )
{
auto OldPropertyInfo = OriginalCDOProperties . Properties . Find ( Pair . Key ) ;
if ( OldPropertyInfo )
{
auto & NewPropertyInfo = Pair . Value ;
2015-01-23 08:34:49 -05:00
uint8 * OldSerializedValuePtr = OriginalCDOProperties . Bytes . GetData ( ) + OldPropertyInfo - > SerializedValueOffset ;
uint8 * NewSerializedValuePtr = ReconstructedCDOProperties . Bytes . GetData ( ) + NewPropertyInfo . SerializedValueOffset ;
if ( OldPropertyInfo - > SerializedValueSize ! = NewPropertyInfo . SerializedValueSize | |
FMemory : : Memcmp ( OldSerializedValuePtr , NewSerializedValuePtr , OldPropertyInfo - > SerializedValueSize ) ! = 0 )
2014-12-11 06:03:58 -05:00
{
2015-01-23 08:34:49 -05:00
// Property value has changed so add it to the list of properties that need updating on instances
FPropertyToUpdate PropertyToUpdate ;
PropertyToUpdate . Property = NewPropertyInfo . Property ;
PropertyToUpdate . NewValuePtr = nullptr ;
PropertyToUpdate . SubobjectName = NewPropertyInfo . SubobjectName ;
if ( NewPropertyInfo . Property - > GetOuter ( ) = = NewClass )
2014-12-11 06:03:58 -05:00
{
PropertyToUpdate . NewValuePtr = PropertyToUpdate . Property - > ContainerPtrToValuePtr < uint8 > ( NewClass - > GetDefaultObject ( ) ) ;
}
2015-01-23 08:34:49 -05:00
else if ( NewPropertyInfo . SubobjectName ! = NAME_None )
{
UObject * DefaultSubobjectPtr = FindDefaultSubobject ( DefaultSubobjectArray , NewPropertyInfo . SubobjectName ) ;
if ( DefaultSubobjectPtr & & NewPropertyInfo . Property - > GetOuter ( ) = = DefaultSubobjectPtr - > GetClass ( ) )
{
PropertyToUpdate . NewValuePtr = PropertyToUpdate . Property - > ContainerPtrToValuePtr < uint8 > ( DefaultSubobjectPtr ) ;
}
}
if ( PropertyToUpdate . NewValuePtr )
{
PropertyToUpdate . OldSerializedValuePtr = OldSerializedValuePtr ;
PropertyToUpdate . OldSerializedSize = OldPropertyInfo - > SerializedValueSize ;
PropertiesToUpdate . Add ( PropertyToUpdate ) ;
}
2014-12-11 06:03:58 -05:00
}
}
}
if ( PropertiesToUpdate . Num ( ) )
{
TArray < uint8 > CurrentValueSerializedData ;
// Update properties on all existing instances of the class
for ( FObjectIterator It ( NewClass ) ; It ; + + It )
{
UObject * ObjectPtr = * It ;
2015-01-23 08:34:49 -05:00
DefaultSubobjectArray . Empty ( DefaultSubobjectArrayCapacity ) ;
ObjectPtr - > CollectDefaultSubobjects ( DefaultSubobjectArray ) ;
2014-12-11 06:03:58 -05:00
for ( auto & PropertyToUpdate : PropertiesToUpdate )
{
2015-01-23 08:34:49 -05:00
uint8 * InstanceValuePtr = nullptr ;
if ( PropertyToUpdate . SubobjectName = = NAME_None )
2014-12-11 06:03:58 -05:00
{
2015-01-23 08:34:49 -05:00
InstanceValuePtr = PropertyToUpdate . Property - > ContainerPtrToValuePtr < uint8 > ( ObjectPtr ) ;
}
else
{
UObject * DefaultSubobjectPtr = FindDefaultSubobject ( DefaultSubobjectArray , PropertyToUpdate . SubobjectName ) ;
if ( DefaultSubobjectPtr & & PropertyToUpdate . Property - > GetOuter ( ) = = DefaultSubobjectPtr - > GetClass ( ) )
{
InstanceValuePtr = PropertyToUpdate . Property - > ContainerPtrToValuePtr < uint8 > ( DefaultSubobjectPtr ) ;
}
}
if ( InstanceValuePtr )
{
// Serialize current value to a byte array as we don't have the previous CDO to compare against, we only have its serialized property data
CurrentValueSerializedData . Empty ( CurrentValueSerializedData . Num ( ) + CurrentValueSerializedData . GetSlack ( ) ) ;
2015-02-06 02:46:08 -05:00
FPropertyValueMemoryWriter CurrentValueWriter ( CurrentValueSerializedData ) ;
2015-01-23 08:34:49 -05:00
PropertyToUpdate . Property - > SerializeItem ( CurrentValueWriter , InstanceValuePtr ) ;
// Update only when the current value on the instance is identical to the original CDO
if ( CurrentValueSerializedData . Num ( ) = = PropertyToUpdate . OldSerializedSize & &
FMemory : : Memcmp ( CurrentValueSerializedData . GetData ( ) , PropertyToUpdate . OldSerializedValuePtr , CurrentValueSerializedData . Num ( ) ) = = 0 )
{
// Update with the new value
PropertyToUpdate . Property - > CopyCompleteValue ( InstanceValuePtr , PropertyToUpdate . NewValuePtr ) ;
}
2014-12-11 06:03:58 -05:00
}
}
}
}
}
void FHotReloadClassReinstancer : : ReinstanceObjectsAndUpdateDefaults ( )
{
2015-02-19 13:32:52 -05:00
ReinstanceObjects ( true ) ;
2014-12-11 06:03:58 -05:00
UpdateDefaultProperties ( ) ;
}
2015-03-09 15:41:53 -04:00
void FHotReloadClassReinstancer : : AddReferencedObjects ( FReferenceCollector & Collector )
{
FBlueprintCompileReinstancer : : AddReferencedObjects ( Collector ) ;
Copying //UE4/Dev-Core to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2783106 on 2015/11/30 by Robert.Manuszewski@Robert.Manuszewski_NCL_Stream2
Introduced GC UObject clusters. GC clusters provide means to create disregard for GC subsets at load time (e.g. Materials with material expressions and their textures).
- Saves about 25ms in reachability analysis (58ms -> 33ms)
- UObject classes/instances can now be marked as cluster root objects with CanBeClusterRoot() function override.
- Cluster creation is automatic. Clusters don't require any manual handling for GC to collect them when nothing is referencing them.
- Moved token stream processing to a new class FFastReferenceFinder to make it more generic and re-usable by other code
- Removed REFERENCE_INFO macro from GC code and replaced it with a local variable (saves about ~1.9ms: 33.2ms -> 31.3ms)
Change 2773094 on 2015/11/19 by Steve.Robb@Dev-Core
Multicast script delegate check for existing bindings replaced with ensure.
Multicast native delegate no longer checks for existing bindings.
Removal of old delegate code.
Some FORCEINLINEing to improve debugging experience of stepping into delegate code.
Change 2782180 on 2015/11/27 by Graeme.Thornton@GThornton_DesktopMaster
Make scoped seconds timer class available outside of stats build. Normal usage macros still remain guarded
Added SCOPE_SECONDS_COUNTER_RECURSION_SAFE which only times during the outmost instance of a recursive function
Added SCOPE_SECONDS_COUNTER_RECURSION_SAFE_BASE and SCOPE_SECONDS_COUNTER_BASE which are defined in all build types, for easy temporary timing in Test/Shipping builds.
Added a boolean parameter to the timer class which can be used to disable it without having to mess around with scoping the calling code
Change 2782635 on 2015/11/30 by Graeme.Thornton@GThornton_DesktopMaster
Added GetTimeStampPair() to the filemanager and platformfile interfaces. Requests timestamps for a pair of files where we assume that both files would always exist at the same wrapper level. Allows us to skip file system queries for localization package lookups where the native file is in a pak but the localized file doesn't exist.
Change 2775153 on 2015/11/20 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
CrashReportServer moved out of the not for licencees, a few fixes, removed RegisterPII
Change 2775560 on 2015/11/20 by Steve.Robb@Dev-Core
FDelegateBase::GetDelegateInstance deprecated and replaced with FDelegateBase::GetDelegateInstanceProtected.
Change 2781138 on 2015/11/25 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
Stats - Converted is using a new stats reader, a few more optimizations, should be 10x times faster
Change 2772990 on 2015/11/19 by Robert.Manuszewski@Robert.Manuszewski_NCL_Stream2
Fixing potential dead lock when suspending and resuming async loading multiple times
Change 2773023 on 2015/11/19 by Robert.Manuszewski@Robert.Manuszewski_NCL_Stream2
Support for references added through AddReferencedObjects in FArchiveReplaceObjectRef
Change 2781055 on 2015/11/25 by Steve.Robb@Dev-Core
Changes to IDelegateInstance reverted to allow licensees an easier time when upgrading their use of the now-deprecated GetDelegateInstance() code path.
New TryGetBoundFunctionName() to aid the debugging of delegate bindings in non-shipping configs.
Change 2773114 on 2015/11/19 by Steve.Robb@Dev-Core
FMath::IsPowerOfTwo is now templated to take any type.
Change 2773643 on 2015/11/19 by Steve.Robb@Dev-Core
GetDelegateInstance() calls replaced - delegate instances never compare equal unless you are comparing two unbound delegates (both null) or comparing a delegate with itself.
Change 2777686 on 2015/11/23 by Steve.Robb@Dev-Core
GitHub #1793 - File write flags argument
Change 2780590 on 2015/11/25 by Steve.Robb@Dev-Core
Fix for FArchiveProxy::operator<< overloads.
Change 2780845 on 2015/11/25 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
#jira UE-23358 - MDD relies on hard-coded P4 depot paths (fixed source context for streams)
Change 2780962 on 2015/11/25 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
Stats - Added FStatsWriteStream for basic saving stat messages into a stream, initial support for reading a regular stats file, minor performance optimization, coding standard fixes
#jira UECORE-170 - Improve profiler loading performance (wip)
Change 2781887 on 2015/11/26 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
Profiler/ProfilerClient - Removed unneeded synchronization points, replaces with task graph SendTo jobs, removed PROFILER_THREADED_LOAD, replaced with new stats loading mechanism, should be around 2x times faster (4x since the optimization pass)
#jira UECORE-170 - Improve profiler loading performance (wip)
Change 2781893 on 2015/11/26 by Steve.Robb@Dev-Core
TCachedOSPageAllocator abstracted from MallocBinned2.
Misc tidy-ups.
Change 2782198 on 2015/11/27 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
Profiler - Better indication of the loading progress, should no longer freeze without a progress bar
#jira UECORE-170 - Improve profiler loading performance (wip)
Change 2782446 on 2015/11/29 by Steve.Robb@Dev-Core
Warn when calling delegates' Create* functions when they're not assigned to anything.
#codereview robert.manuszewski
Change 2782538 on 2015/11/30 by Robert.Manuszewski@Robert.Manuszewski_NCL_Stream1
#UE4 Removed DiskCachedAssetDataBuffer as it was not strictly necessary and was triggering a crash when loading the cached registry from disk. This data is now stored directly in DiskCachedAssetDataMap. It was already true that this map does not change outside of SerializeCache but now it is critical since NewCachedAssetDataMap keeps pointers directly to its values.
Asset registry fixes by Bob Tellez. Possible fix for UE-23783.
Change 2782564 on 2015/11/30 by Robert.Manuszewski@Robert.Manuszewski_NCL_Stream1
FReferenceCollector::AddReferenceObjects performance improvements for TArrays. ARO will no longer call HandleObjectReference multiple times but instead will call HandleObjectReferences just once (currently only implemented for FGCCollector). Reduces the number of virtual function calls while GC'ing.
Change 2782716 on 2015/11/30 by Steve.Robb@Dev-Core
UObject serial number array initialized for debug visualization.
Change 2782933 on 2015/11/30 by Steve.Robb@Dev-Core
Critical sections are no longer copyable.
Change 2783061 on 2015/11/30 by Steve.Robb@Dev-Core
2015-12-03 14:21:29 -05:00
Collector . AllowEliminatingReferences ( false ) ;
2015-03-09 15:41:53 -04:00
Collector . AddReferencedObject ( CopyOfPreviousCDO ) ;
Copying //UE4/Dev-Core to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2783106 on 2015/11/30 by Robert.Manuszewski@Robert.Manuszewski_NCL_Stream2
Introduced GC UObject clusters. GC clusters provide means to create disregard for GC subsets at load time (e.g. Materials with material expressions and their textures).
- Saves about 25ms in reachability analysis (58ms -> 33ms)
- UObject classes/instances can now be marked as cluster root objects with CanBeClusterRoot() function override.
- Cluster creation is automatic. Clusters don't require any manual handling for GC to collect them when nothing is referencing them.
- Moved token stream processing to a new class FFastReferenceFinder to make it more generic and re-usable by other code
- Removed REFERENCE_INFO macro from GC code and replaced it with a local variable (saves about ~1.9ms: 33.2ms -> 31.3ms)
Change 2773094 on 2015/11/19 by Steve.Robb@Dev-Core
Multicast script delegate check for existing bindings replaced with ensure.
Multicast native delegate no longer checks for existing bindings.
Removal of old delegate code.
Some FORCEINLINEing to improve debugging experience of stepping into delegate code.
Change 2782180 on 2015/11/27 by Graeme.Thornton@GThornton_DesktopMaster
Make scoped seconds timer class available outside of stats build. Normal usage macros still remain guarded
Added SCOPE_SECONDS_COUNTER_RECURSION_SAFE which only times during the outmost instance of a recursive function
Added SCOPE_SECONDS_COUNTER_RECURSION_SAFE_BASE and SCOPE_SECONDS_COUNTER_BASE which are defined in all build types, for easy temporary timing in Test/Shipping builds.
Added a boolean parameter to the timer class which can be used to disable it without having to mess around with scoping the calling code
Change 2782635 on 2015/11/30 by Graeme.Thornton@GThornton_DesktopMaster
Added GetTimeStampPair() to the filemanager and platformfile interfaces. Requests timestamps for a pair of files where we assume that both files would always exist at the same wrapper level. Allows us to skip file system queries for localization package lookups where the native file is in a pak but the localized file doesn't exist.
Change 2775153 on 2015/11/20 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
CrashReportServer moved out of the not for licencees, a few fixes, removed RegisterPII
Change 2775560 on 2015/11/20 by Steve.Robb@Dev-Core
FDelegateBase::GetDelegateInstance deprecated and replaced with FDelegateBase::GetDelegateInstanceProtected.
Change 2781138 on 2015/11/25 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
Stats - Converted is using a new stats reader, a few more optimizations, should be 10x times faster
Change 2772990 on 2015/11/19 by Robert.Manuszewski@Robert.Manuszewski_NCL_Stream2
Fixing potential dead lock when suspending and resuming async loading multiple times
Change 2773023 on 2015/11/19 by Robert.Manuszewski@Robert.Manuszewski_NCL_Stream2
Support for references added through AddReferencedObjects in FArchiveReplaceObjectRef
Change 2781055 on 2015/11/25 by Steve.Robb@Dev-Core
Changes to IDelegateInstance reverted to allow licensees an easier time when upgrading their use of the now-deprecated GetDelegateInstance() code path.
New TryGetBoundFunctionName() to aid the debugging of delegate bindings in non-shipping configs.
Change 2773114 on 2015/11/19 by Steve.Robb@Dev-Core
FMath::IsPowerOfTwo is now templated to take any type.
Change 2773643 on 2015/11/19 by Steve.Robb@Dev-Core
GetDelegateInstance() calls replaced - delegate instances never compare equal unless you are comparing two unbound delegates (both null) or comparing a delegate with itself.
Change 2777686 on 2015/11/23 by Steve.Robb@Dev-Core
GitHub #1793 - File write flags argument
Change 2780590 on 2015/11/25 by Steve.Robb@Dev-Core
Fix for FArchiveProxy::operator<< overloads.
Change 2780845 on 2015/11/25 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
#jira UE-23358 - MDD relies on hard-coded P4 depot paths (fixed source context for streams)
Change 2780962 on 2015/11/25 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
Stats - Added FStatsWriteStream for basic saving stat messages into a stream, initial support for reading a regular stats file, minor performance optimization, coding standard fixes
#jira UECORE-170 - Improve profiler loading performance (wip)
Change 2781887 on 2015/11/26 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
Profiler/ProfilerClient - Removed unneeded synchronization points, replaces with task graph SendTo jobs, removed PROFILER_THREADED_LOAD, replaced with new stats loading mechanism, should be around 2x times faster (4x since the optimization pass)
#jira UECORE-170 - Improve profiler loading performance (wip)
Change 2781893 on 2015/11/26 by Steve.Robb@Dev-Core
TCachedOSPageAllocator abstracted from MallocBinned2.
Misc tidy-ups.
Change 2782198 on 2015/11/27 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec
Profiler - Better indication of the loading progress, should no longer freeze without a progress bar
#jira UECORE-170 - Improve profiler loading performance (wip)
Change 2782446 on 2015/11/29 by Steve.Robb@Dev-Core
Warn when calling delegates' Create* functions when they're not assigned to anything.
#codereview robert.manuszewski
Change 2782538 on 2015/11/30 by Robert.Manuszewski@Robert.Manuszewski_NCL_Stream1
#UE4 Removed DiskCachedAssetDataBuffer as it was not strictly necessary and was triggering a crash when loading the cached registry from disk. This data is now stored directly in DiskCachedAssetDataMap. It was already true that this map does not change outside of SerializeCache but now it is critical since NewCachedAssetDataMap keeps pointers directly to its values.
Asset registry fixes by Bob Tellez. Possible fix for UE-23783.
Change 2782564 on 2015/11/30 by Robert.Manuszewski@Robert.Manuszewski_NCL_Stream1
FReferenceCollector::AddReferenceObjects performance improvements for TArrays. ARO will no longer call HandleObjectReference multiple times but instead will call HandleObjectReferences just once (currently only implemented for FGCCollector). Reduces the number of virtual function calls while GC'ing.
Change 2782716 on 2015/11/30 by Steve.Robb@Dev-Core
UObject serial number array initialized for debug visualization.
Change 2782933 on 2015/11/30 by Steve.Robb@Dev-Core
Critical sections are no longer copyable.
Change 2783061 on 2015/11/30 by Steve.Robb@Dev-Core
2015-12-03 14:21:29 -05:00
Collector . AllowEliminatingReferences ( true ) ;
2015-03-09 15:41:53 -04:00
}
2015-07-21 10:33:15 -04:00
void FHotReloadClassReinstancer : : EnlistDependentBlueprintToRecompile ( UBlueprint * BP , bool bBytecodeOnly )
{
if ( IsValid ( BP ) )
{
if ( bBytecodeOnly )
{
if ( ! BPSetToRecompile . Contains ( BP ) & & ! BPSetToRecompileBytecodeOnly . Contains ( BP ) )
{
BPSetToRecompileBytecodeOnly . Add ( BP ) ;
}
}
else
{
if ( ! BPSetToRecompile . Contains ( BP ) )
{
if ( BPSetToRecompileBytecodeOnly . Contains ( BP ) )
{
BPSetToRecompileBytecodeOnly . Remove ( BP ) ;
}
BPSetToRecompile . Add ( BP ) ;
}
}
}
}
void FHotReloadClassReinstancer : : BlueprintWasRecompiled ( UBlueprint * BP , bool bBytecodeOnly )
{
BPSetToRecompile . Remove ( BP ) ;
BPSetToRecompileBytecodeOnly . Remove ( BP ) ;
FBlueprintCompileReinstancer : : BlueprintWasRecompiled ( BP , bBytecodeOnly ) ;
}
2015-04-10 03:30:54 -04:00
# endif