NDEVR
API Documentation

IOFactory for writing to files using the ASSIMP 3rd party library. More...

Inheritance diagram for AssimpFactory:
[legend]
Collaboration diagram for AssimpFactory:
[legend]

Public Member Functions

FactoryOptions defaultReadOptions (const FactoryParameters &file) const override
 Returns the default read options for the given factory parameters.
FactoryOptions defaultWriteOptions (const FactoryParameters &file) const override
 Returns the default write options for the given factory parameters.
virtual FactoryFeatures factoryFeatures (const FactoryParameters &file, bool is_read) const override
 Returns the features and configurable options for this factory given the parameters.
Buffer< UUIDfilterModelsToExport (Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const FileFormat &export_format) const override
 Filters a list of model UUIDs to only those that can be exported in the given format.
virtual String getIcon (const File &file) override
 Returns the icon name associated with the given file type.
virtual void getSupportedFormats (Buffer< FileFormat > &formats, bool is_read) override
 Populates the given buffer with supported file formats for reading or writing.
virtual void getSupportedFormats (Buffer< FileFormat > &formats, DesignObjectLookup *lookup, const Buffer< UUID > &models) override
 Populates the given buffer with formats supported for writing the specified models.
virtual bool readFile (FactoryParameters &file) override
 Reads data from a file into the design object hierarchy.
virtual bool writeFile (FactoryParameters &file) override
 Writes data from the design object hierarchy to a file.
Public Member Functions inherited from IOFactory
 IOFactory (const StringView &factory_name)
 Constructs an IOFactory with the given factory name.
virtual ~IOFactory ()
 Virtual destructor.
virtual bool canRead (const FactoryParameters &file)
 Checks whether this factory can read using the given FactoryParameters.
virtual bool canRead (const File &file)
 Checks whether this factory can read the given file.
virtual bool canRead (const FileFormat &file)
 Checks whether this factory can read the given file format.
virtual bool canWrite (const FactoryParameters &file)
 Checks whether this factory can write using the given FactoryParameters.
virtual bool canWrite (const File &file)
 Checks whether this factory can write the given file.
virtual bool canWrite (const FileFormat &file)
 Checks whether this factory can write the given file format.
virtual bool determineExtension (const File &file, String &extension)
 Attempts to determine the file extension for the given file.
String factoryReadAppFeature () const
 Returns the application feature string required for read operations.
String factoryWriteAppFeature () const
 Returns the application feature string required for write operations.
void getSupportedFormats (Buffer< FileFormat > &formats)
 Populates the given buffer with all supported file formats (both read and write).
virtual void getSupportedFormats (Buffer< FileFormat > &formats, const File &file)
 Populates the given buffer with formats supported for the specified file.
virtual void getSupportedFormatsByModelType (Buffer< FileFormat > &formats, bool is_read, const StringView &model_type)
 Populates the given buffer with formats matching a specific model type.
virtual void getSupportedFormatsForExtension (Buffer< FileFormat > &formats, bool is_read, const StringView &extension)
 Populates the given buffer with formats matching a specific file extension.
virtual bool isAutoEnabled () const
 Checks whether this factory is automatically enabled without requiring a password.
virtual bool isFactoryEnabled (bool is_read) const
 Checks whether this factory is enabled for reading or writing.
const Stringname () const
 Returns the name of this factory.
Buffer< UUIDreadFileWithDefaultSettings (const File &file, DesignObjectLookup *lookup)
 Reads a file using default settings and returns the UUIDs of the created models.
Buffer< ScenereadScenesFromFile (const File &file)
 Reads scenes from a file and returns them as a buffer of Scene objects.
void throwIfNotEnabled (bool is_read)
 Throws an exception if the factory is not enabled for the given operation direction.
virtual bool updateFromFile (const FactoryParameters &file, const FactoryOptions &old_options)
 Updates the factory parameters from a file, comparing against old options.
bool writeScenesToFile (const File &file, const Buffer< Scene > &scene)
 Writes a buffer of scenes to a file.

Static Public Member Functions

static bool ConvertFromAiScene (const aiScene *scene, FactoryParameters &params)
 Converts an imported Assimp scene into NDEVR design objects.
static bool ConvertToAiScene (AssimpSceneMemory &scene, FactoryParameters &params)
 Converts NDEVR design objects into an Assimp scene for export.
static AssimpFactory * DefaultFactory ()
 Returns the singleton AssimpFactory instance.
static constexpr StringView FactoryID ()
 Returns the unique identifier string for this factory.
Static Public Member Functions inherited from IOFactory
static void EnableExtension (const StringView &extension, const StringView &read_password, const StringView &write_password)
 Enables a specific file extension with the given read and write passwords.
static void EnableFactory (const StringView &factory, const StringView &read_password, const StringView &write_password)
 Enables a factory by name with the given read and write passwords.
static void EnableFactory (IOFactory *factory, const StringView &read_password, const StringView &write_password)
 Registers an IOFactory instance with the system, enabling it for read and/or write.

Detailed Description

IOFactory for writing to files using the ASSIMP 3rd party library.


Class: AssimpFactory

Assimp supports many file types. For more information see: https://assimp.org/

Definition at line 80 of file AssimpFactory.h.

Member Function Documentation

◆ ConvertFromAiScene()

bool AssimpFactory::ConvertFromAiScene ( const aiScene * scene,
FactoryParameters & params )
static

Converts an imported Assimp scene into NDEVR design objects.

Parameters
[in]sceneThe Assimp scene to import from.
[in,out]paramsFactory parameters to populate with imported data.
Returns
true on success.

◆ ConvertToAiScene()

bool AssimpFactory::ConvertToAiScene ( AssimpSceneMemory & scene,
FactoryParameters & params )
static

Converts NDEVR design objects into an Assimp scene for export.

Parameters
[in,out]sceneThe scene memory container to populate.
[in,out]paramsFactory parameters describing what to convert.
Returns
true on success.

◆ DefaultFactory()

AssimpFactory * AssimpFactory::DefaultFactory ( )
static

Returns the singleton AssimpFactory instance.

Returns
Pointer to the default factory.

◆ defaultReadOptions()

FactoryOptions AssimpFactory::defaultReadOptions ( const FactoryParameters & file) const
overridevirtual

Returns the default read options for the given factory parameters.


Parameters
[in]fileThe FactoryParameters describing the read operation.
Returns
The default FactoryOptions for reading.

Reimplemented from IOFactory.

◆ defaultWriteOptions()

FactoryOptions AssimpFactory::defaultWriteOptions ( const FactoryParameters & file) const
overridevirtual

Returns the default write options for the given factory parameters.


Parameters
[in]fileThe FactoryParameters describing the write operation.
Returns
The default FactoryOptions for writing.

Reimplemented from IOFactory.

◆ factoryFeatures()

virtual FactoryFeatures AssimpFactory::factoryFeatures ( const FactoryParameters & file,
bool is_import ) const
overridevirtual

Returns the features and configurable options for this factory given the parameters.


Parameters
[in]fileThe FactoryParameters describing the operation.
[in]is_importTrue for import operations, false for export operations.
Returns
A FactoryFeatures object describing available options and capabilities.

Implements IOFactory.

◆ FactoryID()

constexpr StringView AssimpFactory::FactoryID ( )
inlinestaticconstexpr

Returns the unique identifier string for this factory.

Returns
The factory ID string view.

Definition at line 110 of file AssimpFactory.h.

◆ filterModelsToExport()

Buffer< UUID > AssimpFactory::filterModelsToExport ( Buffer< UUID > models_to_check,
const DesignObjectLookup * lookup,
const FileFormat & export_format ) const
overridevirtual

Filters a list of model UUIDs to only those that can be exported in the given format.


Parameters
[in]models_to_checkThe candidate model UUIDs to filter.
[in]lookupThe DesignObjectLookup used to resolve the models.
[in]export_formatThe target export format.
Returns
A buffer containing only the UUIDs of models that can be exported.

Reimplemented from IOFactory.

◆ getIcon()

virtual String AssimpFactory::getIcon ( const File & file)
overridevirtual

Returns the icon name associated with the given file type.


Parameters
[in]fileThe file to get the icon for.
Returns
A String containing the icon name.

Reimplemented from IOFactory.

◆ getSupportedFormats() [1/2]

virtual void AssimpFactory::getSupportedFormats ( Buffer< FileFormat > & formats,
bool is_read )
overridevirtual

Populates the given buffer with supported file formats for reading or writing.


Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.
[in]is_readTrue to get read formats, false to get write formats.

Implements IOFactory.

◆ getSupportedFormats() [2/2]

virtual void AssimpFactory::getSupportedFormats ( Buffer< FileFormat > & formats,
DesignObjectLookup * lookup,
const Buffer< UUID > & models )
overridevirtual

Populates the given buffer with formats supported for writing the specified models.


Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.
[in]lookupThe DesignObjectLookup used to resolve the models.
[in]modelsThe UUIDs of the models to check for export support.

Reimplemented from IOFactory.

◆ readFile()

virtual bool AssimpFactory::readFile ( FactoryParameters & file)
overridevirtual

Reads data from a file into the design object hierarchy.


Parameters
[in]fileThe FactoryParameters describing the read operation and receiving results.
Returns
True if the read succeeded, false otherwise.

Implements IOFactory.

◆ writeFile()

virtual bool AssimpFactory::writeFile ( FactoryParameters & file)
overridevirtual

Writes data from the design object hierarchy to a file.


Parameters
[in]fileThe FactoryParameters describing the write operation.
Returns
True if the write succeeded, false otherwise.

Implements IOFactory.


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