ezEngine  Release 25.03
ezAssetDocumentGenerator Class Referenceabstract

Provides functionality for importing files as asset documents. More...

#include <AssetDocumentGenerator.h>

Inheritance diagram for ezAssetDocumentGenerator:

Classes

struct  ImportMode
 Describes one option to import an asset. More...
 

Public Member Functions

ezStatus Import (ezStringView sInputFileAbs, ezStringView sMode, bool bOpenDocument)
 Imports the given file with the mode. Must be a mode that the generator supports.
 
virtual void GetImportModes (ezStringView sAbsInputFile, ezDynamicArray< ImportMode > &out_modes) const =0
 Used to fill out which import modes may be available for the given asset. More...
 
virtual ezStringView GetDocumentExtension () const =0
 Returns the target asset document file extension.
 
virtual ezStringView GetGeneratorGroup () const =0
 Allows to merge the import modes of multiple generators in the UI in one group.
 
virtual ezStatus Generate (ezStringView sInputFileAbs, ezStringView sMode, ezDynamicArray< ezDocument * > &out_generatedDocuments)=0
 Tells the generator to create a new asset document with the chosen mode.
 
bool SupportsFileType (ezStringView sFile) const
 Returns whether this generator supports the given file type for import.
 
- Public Member Functions inherited from ezReflectedClass
virtual const ezRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const ezRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T >
EZ_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 

Static Public Member Functions

static void GetSupportsFileTypes (ezSet< ezString > &out_extensions)
 Creates a list of all importable file extensions. Note that this is an expensive function so the the result should be cached. More...
 
static void ImportAssets ()
 Opens a file browse dialog to let the user choose which files to import. More...
 
static void ImportAssets (const ezDynamicArray< ezString > &filesToImport)
 Opens the "Asset Import" dialog to let the user choose how to import the given files.
 
static void CreateGenerators (ezHybridArray< ezAssetDocumentGenerator *, 16 > &out_generators)
 Instantiates all currently available generators.
 
static void DestroyGenerators (const ezHybridArray< ezAssetDocumentGenerator *, 16 > &generators)
 Destroys the previously instantiated generators.
 
- Static Public Member Functions inherited from ezNoBase
static const ezRTTIGetStaticRTTI ()
 

Protected Member Functions

void AddSupportedFileType (ezStringView sExtension)
 

Friends

class ezQtAssetImportDlg
 

Detailed Description

Provides functionality for importing files as asset documents.

Derived from this class to add a custom importer (see existing derived classes for examples). Each importer typically handles one target asset type.

Member Function Documentation

◆ GetImportModes()

virtual void ezAssetDocumentGenerator::GetImportModes ( ezStringView  sAbsInputFile,
ezDynamicArray< ImportMode > &  out_modes 
) const
pure virtual

Used to fill out which import modes may be available for the given asset.

Note: sAbsInputFile may be empty, in this case it should fill out the array for "general purpose" import (any file of the supported types).

Implemented in ezSkeletonAssetDocumentGenerator, ezAnimationClipAssetDocumentGenerator, ezDecalAssetDocumentGenerator, ezTextureAssetDocumentGenerator, ezJoltConvexCollisionMeshAssetDocumentGenerator, ezJoltCollisionMeshAssetDocumentGenerator, ezTextureCubeAssetDocumentGenerator, ezKrautTreeAssetDocumentGenerator, ezMeshAssetDocumentGenerator, ezAnimatedMeshAssetDocumentGenerator, and ezLUTAssetDocumentGenerator.

◆ GetSupportsFileTypes()

void ezAssetDocumentGenerator::GetSupportsFileTypes ( ezSet< ezString > &  out_extensions)
static

Creates a list of all importable file extensions. Note that this is an expensive function so the the result should be cached.

Parameters
out_ExtensionsList of all file extensions that can be imported.

◆ ImportAssets()

void ezAssetDocumentGenerator::ImportAssets ( )
static

Opens a file browse dialog to let the user choose which files to import.

After the user chose one or multiple files, opens the "Asset Import" dialog to let them choose details.


The documentation for this class was generated from the following files: