ArticyXImporter
ArticyXImporter for Unreal Engine
Loading...
Searching...
No Matches
UArticyDatabase Class Reference

#include <ArticyDatabase.h>

Inheritance diagram for UArticyDatabase:
IShadowStateManager

Public Member Functions

virtual FPrimaryAssetId GetPrimaryAssetId () const override
void Init ()
virtual UArticyGlobalVariablesGetGVs () const
virtual UArticyGlobalVariablesGetRuntimeGVs (UArticyAlternativeGlobalVariables *Asset) const
void UnloadDatabase ()
void SetDefaultUserMethodsProvider (UObject *MethodProvider)
bool IsInShadowState () const
TArray< FString > GetImportedPackageNames () const
bool IsPackageDefaultPackage (FString PackageName)
virtual void SetLoadedPackages (const TArray< UArticyPackage * > Packages)
virtual void LoadDefaultPackages ()
virtual void LoadAllPackages (bool bDefaultOnly=false)
virtual void LoadPackage (FString PackageName)
virtual bool UnloadPackage (const FString PackageName, const bool bQuickUnload)
UArticyObjectGetObject (FArticyId Id, int32 CloneId=0, TSubclassOf< class UArticyObject > CastTo=NULL) const
template<typename T>
T * GetObject (FArticyId Id, int32 CloneId=0) const
UArticyObjectGetObjectUnshadowed (FArticyId Id, int32 CloneId=0) const
UArticyObjectGetObjectByName (FName TechnicalName, int32 CloneId=0, TSubclassOf< class UArticyObject > CastTo=NULL) const
template<typename T>
T * GetObjectByName (FName TechnicalName, int32 CloneId=0) const
UArticyObjectGetObjectFromStringRepresentation (FString StringID_CloneID, TSubclassOf< class UArticyObject > CastTo=NULL) const
template<typename T>
T * GetObjectFromStringRepresentation (FString StringID_CloneID) const
template<typename T>
TArray< T * > GetObjects (FName TechnicalName, int32 CloneId=0) const
TArray< UArticyObject * > GetObjects (FName TechnicalName, int32 CloneId=0, TSubclassOf< class UArticyObject > CastTo=NULL) const
template<typename T>
TArray< T * > GetObjectsOfClass (int32 CloneId=0) const
TArray< UArticyObject * > GetObjectsOfClass (TSubclassOf< class UArticyObject > Class, int32 CloneId=0) const
TArray< UArticyObject * > GetAllObjects () const
template<typename T = UArticyObject>
void GetObjects (TArray< T * > &Array, FName TechnicalName, int32 CloneId=0) const
UArticyObjectCloneFrom (FArticyId Id, int32 NewCloneId=-1, TSubclassOf< class UArticyObject > CastTo=NULL)
template<typename T>
T * CloneFrom (FArticyId Id, int32 NewCloneId=-1)
UArticyObjectCloneFromByName (FName TechnicalName, int32 NewCloneId=-1, TSubclassOf< class UArticyObject > CastTo=NULL)
template<typename T>
T * CloneFrom (FName TechnicalName, int32 NewCloneId=-1)
UArticyObjectGetOrClone (FArticyId Id, int32 NewCloneId)
template<typename T>
T * GetOrClone (FArticyId Id, int32 NewCloneId)
UArticyObjectGetOrCloneByName (const FName &TechnicalName, int32 NewCloneId)
template<typename T>
T * GetOrClone (const FName &TechnicalName, int32 NewCloneId)
UArticyExpressoScriptsGetExpressoInstance () const
void ChangePackageDefault (FName PackageName, bool bIsDefaultPackage)
void SetExpressoScriptsClass (TSubclassOf< UArticyExpressoScripts > NewClass)
Public Member Functions inherited from IShadowStateManager
template<typename LambdaType>
FDelegateHandle RegisterOnPopState (LambdaType Lambda)
void UnregisterOnPopState (FDelegateHandle Delegate)
uint32 GetShadowLevel () const

Static Public Member Functions

static void Initialize (const UObject *WorldContext)
static void Deinitialize (const UObject *WorldContext)
static UArticyDatabaseGet (const UObject *WorldContext)
static void LoadAllObjects ()
static TWeakObjectPtr< UArticyDatabaseGetMutableOriginal ()

Protected Member Functions

void UnloadAllPackages ()

Protected Attributes

TMap< FString, UArticyPackage * > ImportedPackages
TArray< FString > LoadedPackages
TMap< FArticyId, UArticyCloneableObject * > LoadedObjectsById
TMap< FName, FArticyDatabaseObjectArrayLoadedObjectsByName
bool bIsInitialized = false

Detailed Description

The database is used for accessing or cloning any articy object.

Member Function Documentation

◆ ChangePackageDefault()

void UArticyDatabase::ChangePackageDefault ( FName PackageName,
bool bIsDefaultPackage )

Changes the default package setting for a specific package.

Parameters
PackageNameThe name of the package.
bIsDefaultPackageTrue to mark as default, false otherwise.

◆ CloneFrom()

UArticyObject * UArticyDatabase::CloneFrom ( FArticyId Id,
int32 NewCloneId = -1,
TSubclassOf< class UArticyObject > CastTo = NULL )

Clone an existing object, and assign the NewCloneId to it. If the clone already exists, nullptr is returned! If NewCloneId is -1, the next free clone Id will be used.

Parameters
IdThe ID of the object to clone.
NewCloneIdThe clone ID for the new instance.
CastToThe class to cast the clone to.
Returns
A pointer to the newly created clone, or nullptr if creation failed.

Clones an Articy object by its ID, creating a new instance with the specified clone ID.

Parameters
IdThe ID of the object to clone.
NewCloneIdThe clone ID for the new instance.
CastToThe class to cast the clone to.
Returns
A pointer to the newly created clone, or nullptr if creation failed.

◆ CloneFromByName()

UArticyObject * UArticyDatabase::CloneFromByName ( FName TechnicalName,
int32 NewCloneId = -1,
TSubclassOf< class UArticyObject > CastTo = NULL )

Clone an existing object, and assign the NewCloneId to it. If the clone already exists, nullptr is returned! If NewCloneId is -1, the next free clone Id will be used.

Parameters
TechnicalNameThe technical name of the object to clone.
NewCloneIdThe clone ID for the new instance.
CastToThe class to cast the clone to.
Returns
A pointer to the newly created clone, or nullptr if creation failed.

Clones an Articy object by its technical name, creating a new instance with the specified clone ID.

Parameters
TechnicalNameThe technical name of the object to clone.
NewCloneIdThe clone ID for the new instance.
CastToThe class to cast the clone to.
Returns
A pointer to the newly created clone, or nullptr if creation failed.

◆ Deinitialize()

void UArticyDatabase::Deinitialize ( const UObject * WorldContext)
static

Explicit deinitialize.

Parameters
WorldContextany UObject in the target world

◆ Get()

UArticyDatabase * UArticyDatabase::Get ( const UObject * WorldContext)
static

Get the static instance of the database.

Parameters
WorldContextThe context from which to retrieve the database.
Returns
A pointer to the Articy database instance.

Retrieves the Articy database instance for the given world context.

Parameters
WorldContextThe context from which to retrieve the database.
Returns
A pointer to the Articy database instance.

◆ GetAllObjects()

TArray< UArticyObject * > UArticyDatabase::GetAllObjects ( ) const

Get all objects.

Returns
An array of pointers to all Articy objects.

Retrieves all Articy objects currently loaded in the database.

Returns
An array of pointers to all Articy objects.

◆ GetExpressoInstance()

UArticyExpressoScripts * UArticyDatabase::GetExpressoInstance ( ) const

Gets a UArticyExpressoScripts instance, which can be used to execute instructions or evaluate conditions.

Returns
A pointer to the UArticyExpressoScripts instance.

Retrieves the Expresso scripts instance for script execution.

Returns
A pointer to the UArticyExpressoScripts instance.

◆ GetGVs()

UArticyGlobalVariables * UArticyDatabase::GetGVs ( ) const
virtual

Get the current GVs instance.

Returns
A pointer to the current UArticyGlobalVariables instance.

Retrieves the current global variables instance.

Returns
A pointer to the current UArticyGlobalVariables instance.

◆ GetImportedPackageNames()

TArray< FString > UArticyDatabase::GetImportedPackageNames ( ) const

Retrieves the names of all imported packages.

Returns
An array of strings representing the imported package names.

◆ GetMutableOriginal()

TWeakObjectPtr< UArticyDatabase > UArticyDatabase::GetMutableOriginal ( )
static

Retrieves a mutable original instance of the Articy database.

Returns
A weak pointer to the mutable UArticyDatabase instance.

◆ GetObject()

UArticyObject * UArticyDatabase::GetObject ( FArticyId Id,
int32 CloneId = 0,
TSubclassOf< class UArticyObject > CastTo = NULL ) const

Get an object by its Id. If a CloneId other than 0 is provided, a copy of the object with this index must exist. Otherwise a null-pointer is returned.

Parameters
IdThe ID of the object to retrieve.
CloneIdThe clone ID of the object.
CastToThe class to cast the object to.
Returns
A pointer to the Articy object, or nullptr if not found.

Retrieves an Articy object by its ID and clone ID.

Parameters
IdThe ID of the object to retrieve.
CloneIdThe clone ID of the object.
CastToThe class to cast the object to.
Returns
A pointer to the Articy object, or nullptr if not found.

◆ GetObjectByName()

UArticyObject * UArticyDatabase::GetObjectByName ( FName TechnicalName,
int32 CloneId = 0,
TSubclassOf< class UArticyObject > CastTo = NULL ) const

Get an object by its TechnicalName. If a CloneId other than 0 is provided, a copy of the object with this index must exist, otherwise a null-pointer is returned. Note that the TechnicalName is not unique! This will take the first matching object.

Parameters
TechnicalNameThe technical name of the object to retrieve.
CloneIdThe clone ID of the object.
CastToThe class to cast the object to.
Returns
A pointer to the Articy object, or nullptr if not found.

Retrieves an Articy object by its technical name and clone ID.

Parameters
TechnicalNameThe technical name of the object to retrieve.
CloneIdThe clone ID of the object.
CastToThe class to cast the object to.
Returns
A pointer to the Articy object, or nullptr if not found.

◆ GetObjectFromStringRepresentation()

UArticyObject * UArticyDatabase::GetObjectFromStringRepresentation ( FString StringID_CloneID,
TSubclassOf< class UArticyObject > CastTo = NULL ) const

Retrieves an Articy object from a string representation.

Parameters
StringID_CloneIDThe string representation of the object's ID and clone ID.
CastToThe class to cast the object to.
Returns
A pointer to the Articy object, or nullptr if not found.

◆ GetObjects() [1/3]

template<typename T>
TArray< T * > UArticyDatabase::GetObjects ( FName TechnicalName,
int32 CloneId = 0 ) const

Get all objects with a given TechnicalName. If a CloneId other than 0 is provided, copies of the objects with this index must exist, otherwise null-pointers are returned instead. Note: this allocates a new TArray, use the other variant if you already have an array to fill the objects with!

Parameters
TechnicalNameThe technical name of the objects to retrieve.
CloneIdThe clone ID of the objects.
Returns
An array of pointers to the Articy objects, or empty if none found.

◆ GetObjects() [2/3]

TArray< UArticyObject * > UArticyDatabase::GetObjects ( FName TechnicalName,
int32 CloneId = 0,
TSubclassOf< class UArticyObject > CastTo = NULL ) const

Get all objects with a given TechnicalName. If a CloneId other than 0 is provided, copies of the objects with this index must exist, otherwise null-pointers are returned instead.

Parameters
TechnicalNameThe technical name of the objects to retrieve.
CloneIdThe clone ID of the objects.
CastToThe class to cast the objects to.
Returns
An array of pointers to the Articy objects, or empty if none found.

Retrieves all Articy objects with a given technical name and clone ID.

Parameters
TechnicalNameThe technical name of the objects to retrieve.
CloneIdThe clone ID of the objects.
CastToThe class to cast the objects to.
Returns
An array of pointers to the Articy objects, or empty if none found.

◆ GetObjects() [3/3]

template<typename T>
void UArticyDatabase::GetObjects ( TArray< T * > & Array,
FName TechnicalName,
int32 CloneId = 0 ) const

Get all objects with a given TechnicalName. If a CloneId other than 0 is provided, copies of the objects with this index must exist, otherwise null-pointers are returned instead.

Parameters
ArrayThe array to fill with pointers to the Articy objects.
TechnicalNameThe technical name of the objects to retrieve.
CloneIdThe clone ID of the objects.

◆ GetObjectsOfClass() [1/2]

template<typename T>
TArray< T * > UArticyDatabase::GetObjectsOfClass ( int32 CloneId = 0) const

Get all objects with a given Type. If a CloneId other than 0 is provided, copies of the objects with this index must exist, otherwise they will be not added to the result.

Parameters
CloneIdThe clone ID of the objects.
Returns
An array of pointers to the Articy objects, or empty if none found.

◆ GetObjectsOfClass() [2/2]

TArray< UArticyObject * > UArticyDatabase::GetObjectsOfClass ( TSubclassOf< class UArticyObject > Type,
int32 CloneId = 0 ) const

Get all objects with a given Type. If a CloneId other than 0 is provided, copies of the objects with this index must exist, otherwise they will be not added to the result.

Parameters
ClassThe class type of the objects to retrieve.
CloneIdThe clone ID of the objects.
Returns
An array of pointers to the Articy objects, or empty if none found.

Retrieves all Articy objects of a specified class with a given clone ID.

Parameters
TypeThe class type of the objects to retrieve.
CloneIdThe clone ID of the objects.
Returns
An array of pointers to the Articy objects, or empty if none found.

◆ GetObjectUnshadowed()

UArticyObject * UArticyDatabase::GetObjectUnshadowed ( FArticyId Id,
int32 CloneId = 0 ) const

Get an unshadowed copy of an object. Internally used by the flow player to replace nodes with unshadowed ones before returning them via the flow player callbacks.

Parameters
IdThe ID of the object to retrieve.
CloneIdThe clone ID of the object.
Returns
A pointer to the unshadowed Articy object, or nullptr if not found.

Retrieves an unshadowed version of an Articy object.

Parameters
IdThe ID of the object to retrieve.
CloneIdThe clone ID of the object.
Returns
A pointer to the unshadowed Articy object, or nullptr if not found.

◆ GetOrClone()

UArticyObject * UArticyDatabase::GetOrClone ( FArticyId Id,
int32 NewCloneId )

Clone an existing object, and assign the NewCloneId to it.

Parameters
IdThe ID of the object to retrieve or clone.
NewCloneIdThe clone ID for the new instance.
Returns
A pointer to the retrieved or newly created clone, or nullptr if not found.

Retrieves or clones an Articy object by its ID and clone ID.

Parameters
IdThe ID of the object to retrieve or clone.
NewCloneIdThe clone ID for the new instance.
Returns
A pointer to the retrieved or newly created clone, or nullptr if not found.

◆ GetOrCloneByName()

UArticyObject * UArticyDatabase::GetOrCloneByName ( const FName & TechnicalName,
int32 NewCloneId )

Clone an existing object, and assign the NewCloneId to it.

Parameters
TechnicalNameThe technical name of the object to retrieve or clone.
NewCloneIdThe clone ID for the new instance.
Returns
A pointer to the retrieved or newly created clone, or nullptr if not found.

Retrieves or clones an Articy object by its technical name and clone ID.

Parameters
TechnicalNameThe technical name of the object to retrieve or clone.
NewCloneIdThe clone ID for the new instance.
Returns
A pointer to the retrieved or newly created clone, or nullptr if not found.

◆ GetPrimaryAssetId()

virtual FPrimaryAssetId UArticyDatabase::GetPrimaryAssetId ( ) const
inlineoverridevirtual

Retrieves the primary asset ID for this database.

Returns
The primary asset ID.

◆ GetRuntimeGVs()

UArticyGlobalVariables * UArticyDatabase::GetRuntimeGVs ( UArticyAlternativeGlobalVariables * Asset) const
virtual

Gets the current runtime instance of a set of GVs.

Parameters
AssetThe alternative global variables asset.
Returns
A pointer to the runtime UArticyGlobalVariables instance.

Retrieves the runtime global variables associated with an alternative global variables asset.

Parameters
AssetThe alternative global variables asset.
Returns
A pointer to the runtime UArticyGlobalVariables instance.

◆ Init()

void UArticyDatabase::Init ( )

Initializes the Articy database, loading default packages.

◆ Initialize()

void UArticyDatabase::Initialize ( const UObject * WorldContext)
static

Explicit initialize.

Parameters
WorldContextany UObject in the target world

◆ IsInShadowState()

bool UArticyDatabase::IsInShadowState ( ) const
inline

Returns true if the database is in shadow state. Can be used in script methods to determine if the function is called during a flow player branch calculation.

Returns
True if the database is in shadow state, false otherwise.

◆ IsPackageDefaultPackage()

bool UArticyDatabase::IsPackageDefaultPackage ( FString PackageName)

Determines if a package is a default package.

Parameters
PackageNameThe name of the package to check.
Returns
True if the package is a default package, false otherwise.

◆ LoadAllObjects()

void UArticyDatabase::LoadAllObjects ( )
static

Load all objects imported from articy, so the UE4 packages are 'fully loaded'. Used internally, so ArticyRef can find the referenced object.

Loads all imported Articy objects, ensuring the packages are fully loaded.

◆ LoadAllPackages()

void UArticyDatabase::LoadAllPackages ( bool bDefaultOnly = false)
virtual

Load all imported packages.

Loads all imported packages, optionally only loading default packages.

Parameters
bDefaultOnlyIf true, only default packages are loaded.

◆ LoadDefaultPackages()

void UArticyDatabase::LoadDefaultPackages ( )
virtual

Load all packages which have the IsDefaultPackage flag set to true.

Loads all packages that are marked as default packages.

◆ LoadPackage()

void UArticyDatabase::LoadPackage ( FString PackageName)
virtual

Load a package of a given name.

Parameters
PackageNameThe name of the package to load.

Loads a specific package by name.

Parameters
PackageNameThe name of the package to load.

◆ SetDefaultUserMethodsProvider()

void UArticyDatabase::SetDefaultUserMethodsProvider ( UObject * MethodProvider)

Sets a default method provider, which will be always used whenever scripts get evaluated / executed without a valid method provider.

Parameters
MethodProviderThe method provider object.

Sets the default user methods provider for script execution.

Parameters
MethodProviderThe method provider object.

◆ SetExpressoScriptsClass()

void UArticyDatabase::SetExpressoScriptsClass ( TSubclassOf< UArticyExpressoScripts > NewClass)

Sets the Expresso scripts class used for script execution.

Parameters
NewClassThe new Expresso scripts class to use.

◆ SetLoadedPackages()

void UArticyDatabase::SetLoadedPackages ( const TArray< UArticyPackage * > Packages)
virtual

Sets the loaded packages from a provided list of packages.

Parameters
PackagesAn array of packages to set as loaded.

◆ UnloadAllPackages()

void UArticyDatabase::UnloadAllPackages ( )
protected

Unloads all currently loaded packages, clearing object maps.

◆ UnloadDatabase()

void UArticyDatabase::UnloadDatabase ( )

Unloads the database, which causes that all changes get removed.

Unloads the database, clearing changes and freeing resources.

◆ UnloadPackage()

bool UArticyDatabase::UnloadPackage ( const FString PackageName,
const bool bQuickUnload )
virtual

Load a package of a given name.

Parameters
PackageNameThe name of the package to unload.
bQuickUnloadIf true, perform a quick unload.
Returns
True if the package was successfully unloaded, false otherwise.

Unloads a specific package by name.

Parameters
PackageNameThe name of the package to unload.
bQuickUnloadIf true, perform a quick unload.
Returns
True if the package was successfully unloaded, false otherwise.

Member Data Documentation

◆ ImportedPackages

TMap<FString, UArticyPackage*> UArticyDatabase::ImportedPackages
protected

A list of all packages that were imported from articy:draft.


The documentation for this class was generated from the following files:
  • Source/ArticyRuntime/Public/ArticyDatabase.h
  • Source/ArticyRuntime/Private/ArticyDatabase.cpp