Files
UnrealEngineUWP/Engine/Source/Developer/HotReload/Private/HotReloadClassReinstancer.h
Robert Manuszewski 0de4660aee Hot-reload: all CDOs will now get re-constructed after hot-reload. If a CDO has changed, the class will be re-instanced.
#change Moved hot-reload-only code from FBlueprintCompileReinstancer to FHotReloadClassReinstancer
#change It's not possible to derive classes from FBlueprintCompileReinstancer
#change Added code to handle re-creating CDOs after hot-reload even if the class hasn't changed.

[CL 2300696 by Robert Manuszewski in Main branch]
2014-09-17 04:34:40 -04:00

61 lines
1.6 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once
#if WITH_ENGINE
#include "Editor/UnrealEd/Public/Kismet2/KismetReinstanceUtilities.h"
/**
* Helper class used for re-instancing native and blueprint classes after hot-reload
*/
class FHotReloadClassReinstancer : public FBlueprintCompileReinstancer
{
/** True if the provided native class needs re-instancing */
bool bNeedsReinstancing;
/**
* Sets the re-instancer up for new class re-instancing
*
* @param InNewClass Class that has changed after hot-reload
* @param InOldClass Class before it was hot-reloaded
*/
void SetupNewClassReinstancing(UClass* InNewClass, UClass* InOldClass);
/**
* Sets the re-instancer up for old class re-instancing. Always re-creates the CDO.
*
* @param InOldClass Class that has NOT changed after hot-reload
*/
void RecreateCDOAndSetupOldClassReinstancing(UClass* InOldClass);
/**
* Creates a mem-comparable array of data containing CDO property values.
*
* @param InObject CDO
* @param OutData Data containing all of the CDO property values
*/
void SerializeCDOProperties(UObject* InObject, TArray<uint8>& OutData);
/**
* Re-creates class default object
*
* @param InOldClass Class that has NOT changed after hot-reload
*/
void ReconstructClassDefaultObject(UClass* InOldClass);
public:
/** Sets the re-instancer up to re-instance native classes */
FHotReloadClassReinstancer(UClass* InNewClass, UClass* InOldClass);
/** Destructor */
virtual ~FHotReloadClassReinstancer();
/** If true, the class needs re-instancing */
FORCEINLINE bool ClassNeedsReinstancing() const
{
return bNeedsReinstancing;
}
};
#endif // WITH_ENGINE