neuray API Programmer's Manual

mi::neuraylib::IMdle_api Class Reference

[Miscellaneous MDL-related Interfaces]

Description

Provides access to functions related to the creation of encapsulated MDL modules (MDLE).

Public Member Functions

virtual Sint32 compare_mdle( const char* mdle_file_name_a, const char* mdle_file_name_b, IMdl_execution_context* context) const =0
Check if two MDLE are identical, meaning that they contain the same content independent of their file path. More...
virtual Sint32 export_mdle( ITransaction* transaction, const char* file_name, const IStructure* mdle_data, IMdl_execution_context* context) const =0
Exports a new MDLE file to disk. More...
virtual Sint32 get_hash( const char* mdle_file_name, base::​Uuid& hash, IMdl_execution_context* context) const =0
Extracts the hash of the MDLE archive. More...
virtual IReaderget_user_file( const char* mdle_file_name, const char* user_file_name, IMdl_execution_context* context) const =0
Get a user file that has been added to an MDLE during its creation. More...
virtual Sint32 validate_mdle( const char* file_name, IMdl_execution_context* context) const =0
Checks the integrity of an MDLE file based on MD5 hashes that are stored for the contained files. More...

Member Functions

virtual Sint32 mi::​neuraylib::​IMdle_api::compare_mdle( const char* mdle_file_name_a, const char* mdle_file_name_b, IMdl_execution_context* context) const [pure virtual]

Check if two MDLE are identical, meaning that they contain the same content independent of their file path.

Parameters

mdle_file_name_a
The file name of the first MDLE to compare.
mdle_file_name_b
The file name of the second MDLE to compare.
context
An execution context which can be queried for detailed error messages after the operation has finished. Can be NULL.

Returns

  • 0: Success
  • -1: The files are different or at least one is not existing. If provided, please check the context for details.

virtual Sint32 mi::​neuraylib::​IMdle_api::export_mdle( ITransaction* transaction, const char* file_name, const IStructure* mdle_data, IMdl_execution_context* context) const [pure virtual]

Exports a new MDLE file to disk.

Parameters

transaction
The transaction to be used.
file_name
The new filename (including the .mdle extension).
mdle_data
A structure of type Mdle_data. This structure has the following members:
  • mi::IString prototype_name The DB name of the prototype for the main material or function definition of the MDLE file. The prototype can be a material definition, a function definition, a material instance or a function call.
  • mi::neuraylib::IExpression_list* defaults The defaults of the main material or function definition of the MDLE file. The type of an argument in the expression list must match the type of the corresponding parameter of the prototype. If the list is empty, the resulting MDLE will have no parameters. If NULL is passed, the MDLE will inherit the defaults of the prototype.
  • mi::neuraylib::IAnnotation_block* annotations Annotations of the main material or function definition of the MDLE file. If the list is empty, the resulting MDLE will have no annotations. If NULL is passed, the MDLE will inherit the annotations of the prototype. Please note that parameter and return type annotations are always inherited from the prototype.
  • mi::IString thumbnail_path Path to a thumbnail image representing the exported material or function. Can be either an absolute MDL file path or a file system path.
  • mi::base::IInterface* user_files A static or dynamic array of structures of type Mdle_user_file pointing to additional user content (files) that should be added to the MDLE archive. Can be NULL. The structure has the two membersmi::IString source_path MDL file path or file system path pointing to the file.mi::IString target_path New path of the file in the archive.
context
An execution context which can be queried for detailed error messages after the operation has finished. Can be NULL.

Returns

  • 0: Success
  • -1: An error occurred. If provided, please check the context for details.

virtual Sint32 mi::​neuraylib::​IMdle_api::get_hash( const char* mdle_file_name, base::​Uuid& hash, IMdl_execution_context* context) const [pure virtual]

Extracts the hash of the MDLE archive.

Parameters

mdle_file_name
The file name of the MDLE.
hash
The returned hash value.
context
An execution context which can be queried for detailed error messages after the operation has finished. Can be NULL.

Returns

  • 0: Success
  • -1: An error occurred. If provided, please check the context for details.

virtual IReader* mi::​neuraylib::​IMdle_api::get_user_file( const char* mdle_file_name, const char* user_file_name, IMdl_execution_context* context) const [pure virtual]

Get a user file that has been added to an MDLE during its creation.

Parameters

mdle_file_name
The file name of the MDLE that contains the user file.
user_file_name
The path and name of the file to read inside the MDLE. This equals the target_path during the creation.
context
An execution context which can be queried for detailed error messages after the operation has finished. Can be NULL.

Returns

A reader with access to the user file content or NULL in case of errors. Check the context for details in that case.

virtual Sint32 mi::​neuraylib::​IMdle_api::validate_mdle( const char* file_name, IMdl_execution_context* context) const [pure virtual]

Checks the integrity of an MDLE file based on MD5 hashes that are stored for the contained files.

Parameters

file_name
The file name of the MDLE to check.
context
An execution context which can be queried for detailed error messages after the operation has finished. Can be NULL.

Returns

  • 0: Success
  • -1: The MDLE file is invalid. If provided, please check the context for details.