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

Manages the generation, compilation, and asset creation for Articy-imported data. More...

#include <CodeGenerator.h>

Static Public Member Functions

static bool GenerateCode (UArticyImportData *Data)
 Generates code files based on the provided import data.
static void CacheCodeFiles ()
 Caches the content of code files in the source folder.
static bool RestoreCachedFiles ()
 Restores cached files from previous import sessions.
static void GenerateAssets (UArticyImportData *Data)
 Generates assets based on the provided import data.
static void Recompile (UArticyImportData *Data)
 Initiates the recompilation process for the generated code.
static FString GetSourceFolder ()
 Returns the main source folder for all the generated code.
static FString GetGeneratedInterfacesFilename (const UArticyImportData *Data)
 Helper methods for generated class/struct names.
static FString GetGeneratedTypesFilename (const UArticyImportData *Data)
 Gets the filename for the generated types based on import data.
static FString GetGeneratedTypeInformationFilename (const UArticyImportData *Data)
static FString GetGlobalVarsClassname (const UArticyImportData *Data, const bool bOmittPrefix=false)
 Gets the class name for global variables based on import data.
static FString GetGVNamespaceClassname (const UArticyImportData *Data, const FString &Namespace)
 Gets the class name for a global variable namespace based on import data.
static FString GetDatabaseClassname (const UArticyImportData *Data, const bool bOmittPrefix=false)
 Gets the class name for the database based on import data.
static FString GetArticyTypeClassname (const UArticyImportData *Data, const bool bOmittPrefix=false)
 Gets the class name for the Articy type system based on import data.
static FString GetArticyLocalizerClassname (const UArticyImportData *Data, const bool bOmittPrefix=false)
 Gets the class name for the Articy localizer system based on import data.
static FString GetMethodsProviderClassname (const UArticyImportData *Data, const bool bOmittPrefix=false)
 Gets the class name for the methods provider based on import data.
static FString GetExpressoScriptsClassname (const UArticyImportData *Data, const bool bOmittPrefix=false)
 Gets the class name for expresso scripts based on import data.
static FString GetFeatureInterfaceClassName (const UArticyImportData *Data, const FArticyTemplateFeatureDef &Feature, const bool bOmittPrefix=false)
 Gets the class name for a feature interface based on import data.
static bool DeleteGeneratedCode (const FString &Filename="")
 Deletes a file inside the source folder (empty Filename deletes the whole folder).
static bool DeleteExtraCode (const TArray< FString > &GeneratedFiles)
 Deletes extra generated code files that are not in the provided list.
static bool DeleteGeneratedAssets (const FArticyPackageDefs &PackageDefs)
 Deletes generated assets based on package definitions.
static bool RenameGeneratedAssets (const FArticyPackageDefs &PackageDefs)
 Renames generated assets based on package definitions.

Detailed Description

Manages the generation, compilation, and asset creation for Articy-imported data.

Member Function Documentation

◆ CacheCodeFiles()

void CodeGenerator::CacheCodeFiles ( )
static

Caches the content of code files in the source folder.

Loads the content of each file into memory for later restoration if needed.

◆ DeleteExtraCode()

bool CodeGenerator::DeleteExtraCode ( const TArray< FString > & GeneratedFiles)
static

Deletes extra generated code files that are not in the provided list.

Iterates through the source folder and deletes files not matching any prefix from the generated files list.

Parameters
GeneratedFilesA list of prefixes for the generated files to keep.
Returns
true if all non-matching files were successfully deleted, false otherwise.

◆ DeleteGeneratedAssets()

bool CodeGenerator::DeleteGeneratedAssets ( const FArticyPackageDefs & PackageDefs)
static

Deletes generated assets based on package definitions.

Removes assets not included in the import, handling invalid assets appropriately.

Parameters
PackageDefsThe package definitions used to determine which assets to delete.
Returns
true if all invalid assets were successfully deleted, false otherwise.

◆ DeleteGeneratedCode()

bool CodeGenerator::DeleteGeneratedCode ( const FString & Filename = "")
static

Deletes a file inside the source folder (empty Filename deletes the whole folder).

Deletes generated code files in the source folder.

Parameters
FilenameThe name of the file to delete, or empty to delete the whole folder.
Returns
true if the deletion was successful, false otherwise.

If the filename is empty, deletes the entire folder recursively.

Parameters
FilenameThe name of the file to delete, or empty to delete the whole folder.
Returns
true if the deletion was successful, false otherwise.

◆ GenerateAssets()

void CodeGenerator::GenerateAssets ( UArticyImportData * Data)
static

Generates assets based on the provided import data.

Handles asset generation, including handling renaming and deletion of generated assets.

Parameters
DataThe import data used for asset generation.

This function handles asset generation, including handling renaming and deletion of generated assets.

Parameters
DataThe import data used for asset generation.

◆ GenerateCode()

bool CodeGenerator::GenerateCode ( UArticyImportData * Data)
static

Generates code files based on the provided import data.

Parameters
DataThe import data used for code generation.
Returns
true if code was generated successfully, false otherwise.

This function manages the code generation process for various components such as global variables, databases, and scripts.

Parameters
DataThe import data used for code generation.
Returns
true if code was generated successfully, false otherwise.

◆ GetArticyLocalizerClassname()

FString CodeGenerator::GetArticyLocalizerClassname ( const UArticyImportData * Data,
const bool bOmittPrefix = false )
static

Gets the class name for the Articy localizer system based on import data.

Parameters
DataThe import data containing project details.
bOmittPrefixWhether to omit the "U" prefix.
Returns
The class name for the Articy localizer system.

◆ GetArticyTypeClassname()

FString CodeGenerator::GetArticyTypeClassname ( const UArticyImportData * Data,
const bool bOmittPrefix = false )
static

Gets the class name for the Articy type system based on import data.

Parameters
DataThe import data containing project details.
bOmittPrefixWhether to omit the "U" prefix.
Returns
The class name for the Articy type system.

◆ GetDatabaseClassname()

FString CodeGenerator::GetDatabaseClassname ( const UArticyImportData * Data,
const bool bOmittPrefix = false )
static

Gets the class name for the database based on import data.

Parameters
DataThe import data containing project details.
bOmittPrefixWhether to omit the "U" prefix.
Returns
The class name for the database.

◆ GetExpressoScriptsClassname()

FString CodeGenerator::GetExpressoScriptsClassname ( const UArticyImportData * Data,
const bool bOmittPrefix = false )
static

Gets the class name for expresso scripts based on import data.

Parameters
DataThe import data containing project details.
bOmittPrefixWhether to omit the "U" prefix.
Returns
The class name for expresso scripts.

◆ GetFeatureInterfaceClassName()

FString CodeGenerator::GetFeatureInterfaceClassName ( const UArticyImportData * Data,
const FArticyTemplateFeatureDef & Feature,
const bool bOmittPrefix = false )
static

Gets the class name for a feature interface based on import data.

Parameters
DataThe import data containing project details.
FeatureThe feature definition.
bOmittPrefixWhether to omit the "I" prefix.
Returns
The class name for the feature interface.

◆ GetGeneratedInterfacesFilename()

FString CodeGenerator::GetGeneratedInterfacesFilename ( const UArticyImportData * Data)
static

Helper methods for generated class/struct names.

Gets the filename for the generated interfaces based on import data.

Parameters
DataThe import data containing project details.
Returns
The filename for the generated interfaces.

◆ GetGeneratedTypesFilename()

FString CodeGenerator::GetGeneratedTypesFilename ( const UArticyImportData * Data)
static

Gets the filename for the generated types based on import data.

Parameters
DataThe import data containing project details.
Returns
The filename for the generated types.

◆ GetGlobalVarsClassname()

FString CodeGenerator::GetGlobalVarsClassname ( const UArticyImportData * Data,
const bool bOmittPrefix = false )
static

Gets the class name for global variables based on import data.

Parameters
DataThe import data containing project details.
bOmittPrefixWhether to omit the "U" prefix.
Returns
The class name for global variables.

◆ GetGVNamespaceClassname()

FString CodeGenerator::GetGVNamespaceClassname ( const UArticyImportData * Data,
const FString & Namespace )
static

Gets the class name for a global variable namespace based on import data.

Parameters
DataThe import data containing project details.
NamespaceThe namespace for the global variables.
Returns
The class name for the global variable namespace.

◆ GetMethodsProviderClassname()

FString CodeGenerator::GetMethodsProviderClassname ( const UArticyImportData * Data,
const bool bOmittPrefix = false )
static

Gets the class name for the methods provider based on import data.

Parameters
DataThe import data containing project details.
bOmittPrefixWhether to omit the "U" prefix.
Returns
The class name for the methods provider.

◆ GetSourceFolder()

FString CodeGenerator::GetSourceFolder ( )
static

Returns the main source folder for all the generated code.

Retrieves the main source folder for all generated code.

Returns
The path to the source folder.

The source folder is determined based on the game's source directory and project name.

Returns
The path to the source folder.

◆ Recompile()

void CodeGenerator::Recompile ( UArticyImportData * Data)
static

Initiates the recompilation process for the generated code.

Parameters
DataThe import data used for recompilation.

◆ RenameGeneratedAssets()

bool CodeGenerator::RenameGeneratedAssets ( const FArticyPackageDefs & PackageDefs)
static

Renames generated assets based on package definitions.

This function handles renaming of package assets when their names have changed.

Parameters
PackageDefsThe package definitions containing the new asset names.
Returns
true if all renaming operations succeeded, false otherwise.

◆ RestoreCachedFiles()

bool CodeGenerator::RestoreCachedFiles ( )
static

Restores cached files from previous import sessions.

Attempts to write the cached file content back to disk.

Returns
true if all files were restored successfully, false otherwise.

This function attempts to write the cached file content back to disk.

Returns
true if all files were restored successfully, false otherwise.

The documentation for this class was generated from the following files:
  • Source/ArticyEditor/Private/CodeGeneration/CodeGenerator.h
  • Source/ArticyEditor/Private/CodeGeneration/CodeGenerator.cpp