You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
LIMITATIONS: 1) Re-instancing will only update UClass instance data. 2) Adding and removing properties should only be done towards the end of a class or structure and can not be followed by complex data types. 3) Adding and removing properties from a base class should not be done if a derived class contains complex data types. KNOWN ISSUES: 1) Changes to enumerations and structures will not be reflected in existing blueprints. However, adding new nodes to the blueprint will show the updated enumeration or structure. 2) If a class contains an enumeration or structure as a member, the class will not be re-instanced if enumeration or structure is changed. CHANGES: 1) LiveCodingServer 1a) Modified to always execute certain static instances during load. 1b) Modified to exclude the _Statics static structures to avoid patching to old copies. 2) Added support for LiveCoding reinstancing 2a) Refactored deferred registration system for UClass, UEnum, and UScriptStruct to use a common system that works for normal game, hot reload and live coding. 2b) Type specific version check data is possible (i.e. enum doesn't have a size) 2c) Single registration static for UClass 2d) Single registration class for all types that is just a blind forward to API. 2e) Static and dynamic registrations use different API entry points to avoid having overloaded argument lists that just apply to one or the other. 2f) Shims for older API 3) New common "Reload" system to avoid using HotReload code. 3a) Support common delegates regardless of who is reloading/reinstancing. 3b) Re-instancing code moved from HotReload to Kismet2 (where the bulk of the re-instance code already existed). 3c) Modified PyWrapper to use new helper class instead of depending on HotRelaod 3d) Added WITH_RELOAD which is defined if HotReload or LiveCoding is enabled. 3e) Modifed existing code to use new #define and delegates. Robert did the review on the changes covered by Part 2. Remaining changes are all straightforward. #rb robert.manuszewski #jira UE-74493 [CL 15736777 by Tim Smith in ue5-main branch]
213 lines
7.2 KiB
C++
213 lines
7.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Stats/Stats.h"
|
|
#include "UObject/Object.h"
|
|
#include "UObject/ObjectKey.h"
|
|
#include "UObject/GCObject.h"
|
|
#include "TickableEditorObject.h"
|
|
|
|
class FBlueprintActionDatabaseRegistrar;
|
|
class UBlueprint;
|
|
class UBlueprintNodeSpawner;
|
|
|
|
/**
|
|
* Serves as a container for all available blueprint actions (no matter the
|
|
* type of blueprint/graph they belong in). The actions stored here are not tied
|
|
* to a specific ui menu; each action is a UBlueprintNodeSpawner which is
|
|
* charged with spawning a specific node type. Should be set up in a way where
|
|
* class specific actions are refreshed when the associated class is regenerated.
|
|
*
|
|
* @TODO: Hook up to handle class recompile events, along with enum/struct asset creation events.
|
|
*/
|
|
class BLUEPRINTGRAPH_API FBlueprintActionDatabase : public FGCObject, public FTickableEditorObject
|
|
{
|
|
public:
|
|
DECLARE_MULTICAST_DELEGATE_OneParam(FOnDatabaseEntryUpdated, UObject*);
|
|
|
|
typedef TMap<FObjectKey, int32> FPrimingQueue;
|
|
typedef TArray<UBlueprintNodeSpawner*> FActionList;
|
|
typedef TMap<FObjectKey, FActionList> FActionRegistry;
|
|
typedef TMap<FName, TArray<UBlueprintNodeSpawner*>> FUnloadedActionRegistry;
|
|
|
|
public:
|
|
/** Destructor */
|
|
virtual ~FBlueprintActionDatabase();
|
|
|
|
/**
|
|
* Getter to access the database singleton. Will populate the database first
|
|
* if this is the first time accessing it.
|
|
*
|
|
* @return The singleton instance of FBlueprintActionDatabase.
|
|
*/
|
|
static FBlueprintActionDatabase& Get();
|
|
|
|
/** Getter to access the datbase singleton, will return null if the database has not been initialized */
|
|
static FBlueprintActionDatabase* TryGet();
|
|
|
|
// FTickableEditorObject interface
|
|
virtual void Tick(float DeltaTime) override;
|
|
virtual ETickableTickType GetTickableTickType() const override { return ETickableTickType::Always; }
|
|
virtual TStatId GetStatId() const override;
|
|
// End FTickableEditorObject interface
|
|
|
|
// FGCObject interface
|
|
virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
|
|
virtual FString GetReferencerName() const override;
|
|
// End FGCObject interface
|
|
|
|
/**
|
|
* Will populate the database first if it hasn't been created yet, and then
|
|
* returns it in its entirety.
|
|
*
|
|
* Each node spawner is categorized by a class orasset. A spawner that
|
|
* corresponds to a specific class field (like a function, property, enum,
|
|
* etc.) will be listed under that field's class owner. Remaining spawners
|
|
* that can't be categorized this way will be registered by asset or node
|
|
* type.
|
|
*
|
|
* @return The entire action database, which maps specific objects to arrays of associated node-spawners.
|
|
*/
|
|
FActionRegistry const& GetAllActions();
|
|
|
|
/**
|
|
* Populates the action database from scratch. Loops over every known class
|
|
* and records a set of node-spawners associated with each.
|
|
*/
|
|
void RefreshAll();
|
|
|
|
/**
|
|
* Populates the action database with all level script actions from all active editor worlds.
|
|
*/
|
|
void RefreshWorlds();
|
|
|
|
/**
|
|
* Removes the entry with the given key on the next tick.
|
|
*/
|
|
void DeferredRemoveEntry(FObjectKey const& InKey);
|
|
|
|
/**
|
|
* Finds the database entry for the specified class and wipes it,
|
|
* repopulating it with a fresh set of associated node-spawners.
|
|
*
|
|
* @param Class The class entry you want rebuilt.
|
|
*/
|
|
void RefreshClassActions(UClass* const Class);
|
|
|
|
/**
|
|
* Finds the database entry for the specified asset and wipes it,
|
|
* repopulating it with a fresh set of associated node-spawners.
|
|
*
|
|
* @param AssetObject The asset entry you want rebuilt.
|
|
*/
|
|
void RefreshAssetActions(UObject* const AssetObject);
|
|
|
|
/**
|
|
* Updates all component related actions
|
|
*/
|
|
void RefreshComponentActions();
|
|
|
|
/**
|
|
* Finds the database entry for the specified object and wipes it. The entry
|
|
* won't be rebuilt, unless RefreshAssetActions() is explicitly called after.
|
|
*
|
|
* @param AssetObject
|
|
* @return True if an entry was found and removed.
|
|
*/
|
|
bool ClearAssetActions(UObject* const AssetObject);
|
|
|
|
/**
|
|
* Finds the database entry for the specified object and wipes it. The entry
|
|
* won't be rebuilt, unless RefreshAssetActions() is explicitly called after.
|
|
*
|
|
* @param AssetObjectKey
|
|
* @return True if an entry was found and removed.
|
|
*/
|
|
bool ClearAssetActions(const FObjectKey& AssetObjectKey);
|
|
|
|
/**
|
|
* Finds the database entry for the specified unloaded asset and wipes it.
|
|
* The entry won't be rebuilt, unless RefreshAssetActions() is explicitly called after.
|
|
*
|
|
* @param ObjectPath Object's path to lookup into the database
|
|
*/
|
|
void ClearUnloadedAssetActions(FName ObjectPath);
|
|
|
|
/**
|
|
* Moves the unloaded asset actions from one location to another
|
|
*
|
|
* @param SourceObjectPath The object path that the data can currently be found under
|
|
* @param TargetObjectPath The object path that the data should be moved to
|
|
*/
|
|
void MoveUnloadedAssetActions(FName SourceObjectPath, FName TargetObjectPath);
|
|
|
|
/** */
|
|
FOnDatabaseEntryUpdated& OnEntryUpdated() { return EntryRefreshDelegate; }
|
|
/** */
|
|
FOnDatabaseEntryUpdated& OnEntryRemoved() { return EntryRemovedDelegate; }
|
|
|
|
private:
|
|
/** Private constructor for singleton purposes. */
|
|
FBlueprintActionDatabase();
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @param Registrar
|
|
*/
|
|
void RegisterAllNodeActions(FBlueprintActionDatabaseRegistrar& Registrar);
|
|
|
|
/**
|
|
* This exists only because we need a pointer to associate our delegates with
|
|
*/
|
|
void OnBlueprintChanged( UBlueprint* );
|
|
private:
|
|
/**
|
|
* A map of associated node-spawners for each class/asset. A spawner that
|
|
* corresponds to a specific class field (like a function, property, enum,
|
|
* etc.) will be mapped under that field's class outer. Other spawners (that
|
|
* can't be associated with a class outer), will be filed under the desired
|
|
* node's type, or an associated asset.
|
|
*/
|
|
FActionRegistry ActionRegistry;
|
|
|
|
/**
|
|
* A map of associated object paths for each node-class that is associated
|
|
* with it. This is used for unloaded assets that will need to be replaced
|
|
* after the asset is loaded with the final (and more complete) nodespawner.
|
|
*/
|
|
FUnloadedActionRegistry UnloadedActionRegistry;
|
|
|
|
/**
|
|
* References newly allocated actions that need to be "primed". Priming is
|
|
* something we do on Tick() aimed at speeding up performance (like pre-
|
|
* caching each spawner's template-node, etc.).
|
|
*/
|
|
FPrimingQueue ActionPrimingQueue;
|
|
|
|
/** List of action keys to be removed on the next tick. */
|
|
TArray<FObjectKey> ActionRemoveQueue;
|
|
|
|
/** */
|
|
FOnDatabaseEntryUpdated EntryRefreshDelegate;
|
|
FOnDatabaseEntryUpdated EntryRemovedDelegate;
|
|
|
|
/** Handles to registered delegates. */
|
|
FDelegateHandle OnAssetLoadedDelegateHandle;
|
|
FDelegateHandle OnAssetAddedDelegateHandle;
|
|
FDelegateHandle OnAssetRemovedDelegateHandle;
|
|
FDelegateHandle OnAssetRenamedDelegateHandle;
|
|
FDelegateHandle OnAssetsPreDeleteDelegateHandle;
|
|
FDelegateHandle OnBlueprintUnloadedDelegateHandle;
|
|
FDelegateHandle OnWorldAddedDelegateHandle;
|
|
FDelegateHandle OnWorldDestroyedDelegateHandle;
|
|
FDelegateHandle RefreshLevelScriptActionsDelegateHandle;
|
|
FDelegateHandle OnModulesChangedDelegateHandle;
|
|
FDelegateHandle OnReloadCompleteDelegateHandle;
|
|
|
|
/** Pointer to the shared list of currently existing component types */
|
|
const TArray<struct FComponentTypeEntry>* ComponentTypes;
|
|
};
|