The MDL compiler allows to import and export .mdl files, to examine their contents, to create a compiled representation of these via a backend, and to export image canvases, light profiles and measured BSDF data.
More...
Public Member Functions | |
General configuration | |
virtual void | set_logger (base::ILogger *logger)=0 |
Sets the logger. More... | |
virtual base::ILogger * | get_logger ()=0 |
Returns the used logger. More... | |
virtual Sint32 | load_plugin_library (const char *path)=0 |
Loads a plugin library. More... | |
Module paths | |
virtual Sint32 | add_module_path (const char *path)=0 |
Adds a path to the list of paths to search for MDL modules. More... | |
virtual Sint32 | remove_module_path (const char *path)=0 |
Removes a path from the list of paths to search for MDL modules. More... | |
virtual void | clear_module_paths ()=0 |
Clears the list of paths to search for MDL modules. More... | |
virtual Size | get_module_paths_length () const =0 |
Returns the number of paths to search for MDL modules. More... | |
virtual const IString * | get_module_path (Size index) const =0 |
Returns the index -th path to search for MDL modules. More... | |
Resource paths | |
virtual Sint32 | add_resource_path (const char *path)=0 |
Adds a path to the list of paths to search for resources, i.e., textures, light profiles, and BSDF measurements. More... | |
virtual Sint32 | remove_resource_path (const char *path)=0 |
Removes a path from the list of paths to search for resources, i.e., textures, light profiles, and BSDF measurements. More... | |
virtual void | clear_resource_paths ()=0 |
Clears the list of paths to search for resources, i.e., textures, light profiles, and BSDF measurements. More... | |
virtual Size | get_resource_paths_length () const =0 |
Returns the number of paths to search for resources, i.e., textures, light profiles, and BSDF measurements. More... | |
virtual const IString * | get_resource_path (Size index) const =0 |
Returns the index -th path to search for resources, i.e., textures, light profiles, and BSDF measurements. More... | |
Import/export | |
virtual Sint32 | deprecated_load_module (ITransaction *transaction, const char *module_name, const IMap *options)=0 |
Loads an MDL module from disk (or a builtin module) into the database. More... | |
virtual Sint32 | load_module (ITransaction *transaction, const char *module_name, IMdl_execution_context *context=0)=0 |
Loads an MDL module from disk (or a builtin module) into the database. More... | |
virtual Sint32 | deprecated_load_module_from_string (ITransaction *transaction, const char *module_name, const char *module_source, const IMap *options)=0 |
Loads an MDL module from memory into the database. More... | |
virtual Sint32 | load_module_from_string (ITransaction *transaction, const char *module_name, const char *module_source, IMdl_execution_context *context=0)=0 |
Loads an MDL module from memory into the database. More... | |
virtual Sint32 | add_builtin_module (const char *module_name, const char *module_source)=0 |
Adds a builtin MDL module. More... | |
virtual Sint32 | deprecated_export_module (ITransaction *transaction, const char *module_name, const char *filename, const IMap *options)=0 |
Exports an MDL module from the database to disk. More... | |
virtual Sint32 | export_module (ITransaction *transaction, const char *module_name, const char *filename, IMdl_execution_context *context=0)=0 |
Exports an MDL module from the database to disk. More... | |
virtual Sint32 | deprecated_export_module_to_string (ITransaction *transaction, const char *module_name, IString *exported_module, const IMap *options)=0 |
Exports an MDL module from the database to string. More... | |
virtual Sint32 | export_module_to_string (ITransaction *transaction, const char *module_name, IString *exported_module, IMdl_execution_context *context=0)=0 |
Exports an MDL module from the database to string. More... | |
virtual Sint32 | export_canvas (const char *filename, const ICanvas *canvas, Uint32 quality=100) const =0 |
Exports a canvas to a file on disk. More... | |
virtual Sint32 | export_lightprofile (const char *filename, const ILightprofile *lightprofile) const =0 |
Exports a light profile to disk. More... | |
virtual Sint32 | export_bsdf_data (const char *filename, const IBsdf_isotropic_data *reflection, const IBsdf_isotropic_data *transmission) const =0 |
Exports BSDF data to a file on disk. More... | |
Convenience | |
virtual const IString * | uvtile_marker_to_string (const char *marker, Sint32 u, Sint32 v) const =0 |
Resolves a string containing a UDIM/uv-tile marker and a corresponding u,v pair to a pattern as used in the filename of a UDIM/uv-tile sequence. More... | |
virtual const IString * | uvtile_string_to_marker (const char *str, const char *marker) const =0 |
Replaces the pattern describing the tile index of a UDIM/uv-tile image sequence by the given marker, if the pattern exists in the string. More... | |
Backends | |
enum | Mdl_backend_kind { MB_CUDA_PTX, MB_LLVM_IR, MB_GLSL, MB_NATIVE } |
Currently available MDL backends. More... | |
virtual IMdl_backend * | get_backend (Mdl_backend_kind kind)=0 |
Returns an MDL backend generator. More... | |
Additional Inherited Members | |
![]() | |
typedef Interface_declare< id1, id2, id3, id4, id5, id6, id7, id8, id9, id10, id11, IInterface > | Self |
Own type. More... | |
typedef Uuid_t< id1, id2, id3, id4, id5, id6, id7, id8, id9, id10, id11 > | IID |
Declares the interface ID (IID) of this interface. More... | |
![]() | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface and of its ancestors. More... | |
The MDL compiler allows to import and export .mdl files, to examine their contents, to create a compiled representation of these via a backend, and to export image canvases, light profiles and measured BSDF data.
It also allows to load plugins to add support for loading and exporting images and videos.
|
pure virtual |
Adds a builtin MDL module.
Builtin modules allow to use the native()
annotation which is not possible for regular modules. Builtin modules can only be added before the first regular module has been loaded.
module_name | The fully-qualified MDL name of the MDL module (including package names, starting with "::"). |
module_source | The MDL source code of the module. |
NULL
pointer), module_name
is not a valid module name, failure to compile the module, or a regular module has already been loaded.
|
pure virtual |
Adds a path to the list of paths to search for MDL modules.
This search path is also used for resources referenced in MDL modules. By default, the list of MDL paths contains "." as sole entry.
path | The path to be added. |
NULL
pointer).
|
pure virtual |
Adds a path to the list of paths to search for resources, i.e., textures, light profiles, and BSDF measurements.
Note that for MDL resources referenced in .mdl
files the MDL search paths are considered, not the resource search paths. By default, the list of resource paths contains "." as sole entry.
path | The path to be added. |
NULL
pointer).
|
pure virtual |
Clears the list of paths to search for MDL modules.
This search path is also used for resources referenced in MDL modules. By default, the list of MDL paths contains "." as sole entry.
|
pure virtual |
Clears the list of paths to search for resources, i.e., textures, light profiles, and BSDF measurements.
Note that for MDL resources referenced in .mdl
files the MDL search paths are considered, not the resource search paths. By default, the list of resource paths contains "." as sole entry.
|
pure virtual |
Exports an MDL module from the database to disk.
The following options are supported:
"bundle_resources"
of type mi::IBoolean: If true
, referenced resources are exported into the same directory as the module, even if they can be found via the module search path.transaction | The transaction to be used. |
module_name | The DB name of the MDL module to export. |
filename | The name of the file to be used for the export. |
options | Options to control the behavior of the exporter, or NULL . |
NULL
pointer).filename
for write operations.filename
does not result in a valid MDL identifier.
|
pure virtual |
Exports an MDL module from the database to string.
transaction | The transaction to be used. |
module_name | The DB name of the MDL module to export. |
exported_module | The exported module source code is written to this string. |
options | Options to control the behavior of the exporter, or NULL . |
NULL
pointer).bundle_resources
is not supported for string-based exports.
|
pure virtual |
Loads an MDL module from disk (or a builtin module) into the database.
The module is located on disk according to the module search paths (see add_module_path()), loaded, and compiled. If successful, the method creates DB elements for the module and all its imported modules, as well as for all material and function definitions contained in these modules.
The method can also be for builtin modules for which the first step, locating the module on disk, is skipped.
transaction | The transaction to be used. |
module_name | The fully-qualified MDL name of the MDL module (including package names, starting with "::"). |
options | Options to control the behavior of the importer, or NULL . |
module_name
is invalid or a NULL
pointer.module_name
.
|
pure virtual |
Loads an MDL module from memory into the database.
The provided module source is compiled. If successful, the method creates DB elements for the module and all its imported modules, as well as for all material and function definitions contained in these modules.
transaction | The transaction to be used. |
module_name | The fully-qualified MDL name of the MDL module (including package names, starting with "::"). |
module_source | The MDL source code of the module. |
options | Options to control the behavior of the importer, or NULL . |
module_source
was skipped).module_source
).module_name
is invalid, or module_name
or module_source
is a NULL
pointer.module_name
.
|
pure virtual |
Exports BSDF data to a file on disk.
filename | The file name of the resource to export the BSDF measurement to. |
reflection | The BSDF data for reflection to export. Can be NULL . |
transmission | The BSDF data for transmission to export. Can be NULL . |
|
pure virtual |
Exports a canvas to a file on disk.
If the image plugin that is selected for the export based on the filename
parameter is not capable of handling the pixel type of canvas
, the canvas is internally converted into one of the pixel types supported by that image plugin for export. If the image plugin supports multiple pixel types for export, the "best" of them (w.r.t. the pixel type of the canvas) is chosen.
The "best" pixel type is determined by attempting to apply the following conversions in the given order to the pixel type of the canvas:
"Color"
instead of "Float32<4>"
and vice versa, similar for "Rgb_fp"
/ "Float32<3>"
and "Rgba"
/ "Sint32"
),filename | The file name of the resource to export the canvas to. The ending of the file name determines the image format, e.g., ".jpg" . Note that support for a given image format requires an image plugin capable of handling that format. |
canvas | The canvas to export. |
quality | The compression quality is an integer in the range from 0 to 100, where 0 is the lowest quality, and 100 is the highest quality. |
|
pure virtual |
Exports a light profile to disk.
filename | The file name of the resource to export the light profile to. |
lightprofile | The light profile to export. |
|
pure virtual |
Exports an MDL module from the database to disk.
The following options are supported:
"bundle_resources"
of type mi::IBoolean: If true
, referenced resources are exported into the same directory as the module, even if they can be found via the module search path.transaction | The transaction to be used. |
module_name | The DB name of the MDL module to export. |
filename | The name of the file to be used for the export. |
context | The execution context can be used to pass options to control the behavior of the MDL compiler. During module loading, compiler messages like errors or warnings are stored in the context. Can be NULL . |
NULL
pointer).filename
for write operations.filename
does not result in a valid MDL identifier.
|
pure virtual |
Exports an MDL module from the database to string.
transaction | The transaction to be used. |
module_name | The DB name of the MDL module to export. |
exported_module | The exported module source code is written to this string. |
context | The execution context can be used to pass options to control the behavior of the MDL compiler. During module loading, compiler messages like errors or warnings are stored in the context. Can be NULL . |
NULL
pointer).bundle_resources
is not supported for string-based exports.
|
pure virtual |
Returns an MDL backend generator.
kind | The desired backend generator. |
NULL
if the requested backend is not available.
|
pure virtual |
Returns the used logger.
NULL
.
|
pure virtual |
Returns the index
-th path to search for MDL modules.
This search path is also used for resources referenced in MDL modules. By default, the list of MDL paths contains "." as sole entry.
index
-th path, or NULL
if index
is out of bounds.
|
pure virtual |
Returns the number of paths to search for MDL modules.
This search path is also used for resources referenced in MDL modules. By default, the list of MDL paths contains "." as sole entry.
|
pure virtual |
Returns the index
-th path to search for resources, i.e., textures, light profiles, and BSDF measurements.
Note that for MDL resources referenced in .mdl
files the MDL search paths are considered, not the resource search paths. By default, the list of resource paths contains "." as sole entry.
index
-th path, or NULL
if index
is out of bounds.
|
pure virtual |
Returns the number of paths to search for resources, i.e., textures, light profiles, and BSDF measurements.
Note that for MDL resources referenced in .mdl
files the MDL search paths are considered, not the resource search paths. By default, the list of resource paths contains "." as sole entry.
|
pure virtual |
Loads an MDL module from disk (or a builtin module) into the database.
The module is located on disk according to the module search paths (see add_module_path()), loaded, and compiled. If successful, the method creates DB elements for the module and all its imported modules, as well as for all material and function definitions contained in these modules.
The method can also be for builtin modules for which the first step, locating the module on disk, is skipped.
transaction | The transaction to be used. |
module_name | The fully-qualified MDL name of the MDL module (including package names, starting with "::"). |
context | The execution context can be used to pass options to control the behavior of the MDL compiler. The following options are supported by this operation:
|
module_name
is invalid or a NULL
pointer.module_name
.
|
pure virtual |
Loads an MDL module from memory into the database.
The provided module source is compiled. If successful, the method creates DB elements for the module and all its imported modules, as well as for all material and function definitions contained in these modules.
transaction | The transaction to be used. |
module_name | The fully-qualified MDL name of the MDL module (including package names, starting with "::"). |
module_source | The MDL source code of the module. |
context | The execution context can be used to pass options to control the behavior of the MDL compiler. The following options are supported by this operation:
|
module_source
was skipped).module_source
).module_name
is invalid, or module_name
or module_source
is a NULL
pointer.module_name
.
|
pure virtual |
Loads a plugin library.
This function loads the specified shared library, enumerates all plugin classes in the specified shared library, and adds them to the system.
This function can only be called before the MDL API has been started.
path | The path of the shared library to be loaded. |
|
pure virtual |
Removes a path from the list of paths to search for MDL modules.
This search path is also used for resources referenced in MDL modules. By default, the list of MDL paths contains "." as sole entry.
path | The path to be removed. |
NULL
pointer).
|
pure virtual |
Removes a path from the list of paths to search for resources, i.e., textures, light profiles, and BSDF measurements.
Note that for MDL resources referenced in .mdl
files the MDL search paths are considered, not the resource search paths. By default, the list of resource paths contains "." as sole entry.
path | The path to be removed. |
NULL
pointer).
|
pure virtual |
Sets the logger.
Installs a custom logger, and deinstalls the previously installed logger. By default, an internal logger is installed that prints all messages of severity mi::base::MESSAGE_SEVERITY_INFO or higher to stderr.
logger | The new logger that receives all log messages. Passing NULL is allowed to reinstall the default logger. |
|
pure virtual |
Resolves a string containing a UDIM/uv-tile marker and a corresponding u,v pair to a pattern as used in the filename of a UDIM/uv-tile sequence.
marker | string containing a valid MDL UDIM/uv-tile marker. |
u | uv-tile position in u-direction |
v | uv-tile position in v-direction |
|
pure virtual |
Replaces the pattern describing the tile index of a UDIM/uv-tile image sequence by the given marker, if the pattern exists in the string.
str | string containing the pattern, e.g. _u1_v1 |
marker | the marker to replace the pattern with |
NULL
, if a corresponding pattern could not be found.