This interface is used to export files. More...
Public Member Functions | |
Export operations | |
virtual const IExport_result * | export_scene (ITransaction *transaction, const char *uri, const char *rootgroup, const char *caminst=0, const char *options=0, const IMap *exporter_options=0) const =0 |
Exports a scene. More... |
|
virtual const IExport_result * | export_elements (ITransaction *transaction, const char *uri, const IArray *elements, const IMap *exporter_options=0) const =0 |
Exports scene elements. More... |
|
virtual const IExport_result * | export_elements_to_string (ITransaction *transaction, const IArray *elements, const char *file_extension, IString *result_string, const IMap *exporter_options=0) const =0 |
Exports scene elements to string. More... |
|
virtual Sint32 | export_canvas (const char *uri, const ICanvas *canvas, Uint32 quality=100) const =0 |
Exports a canvas to a file on disk. More... |
|
virtual Sint32 | export_bsdf_data (const char *uri, const IBsdf_isotropic_data *reflection, const IBsdf_isotropic_data *transmission) const =0 |
Exports BSDF data to a file on disk. More... |
|
Exporter introspection | |
virtual Size | get_exporter_length () const =0 |
Returns the number of registered exporters. More... |
|
virtual const IExporter * | get_exporter (Size index) const =0 |
Returns a registered exporter. More... |
|
virtual const IExporter * | select_exporter_by_extension (const char *extension) const =0 |
Returns the exporter that would be used for a particular file name extension. More... |
|
virtual IWriter * | get_writer (const char *uri) const =0 |
Returns a writer that can be used to export to the given resource. More... |
|
Utility methods | |
virtual const IString * | convert_filename_to_uri (const char *filename) const =0 |
Converts a filename into a URI. More... |
|
virtual const IString * | convert_uri_to_filename (const char *uri) const =0 |
Converts a URI into a filename. More... |
|
Additional Inherited Members | |
Public Types inherited from mi::base::Interface_declare< 0xe254f559, 0x4056, 0x4166, 0x83, 0x6a, 0x4c, 0x00, 0x90, 0x0a, 0xdb, 0x22 > | |
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 Public Member Functions inherited from mi::base::Interface_declare< 0xe254f559, 0x4056, 0x4166, 0x83, 0x6a, 0x4c, 0x00, 0x90, 0x0a, 0xdb, 0x22 > | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface and of its ancestors. More... |
|
This interface is used to export files.
|
pure virtual |
Converts a filename into a URI.
Returns NULL
if filename
is NULL
. Otherwise returns a URI without URI scheme and URI authority. The URI path is constructed from the filename according to the following rules.
On Linux and MacOS X, the URI path equals the filename. On Windows, slashes in relative URI paths are replaced by backslashes to obtain the filename. Absolute URI paths are mapped to file system paths according to the following table.
Filename | URI path | Comment |
---|---|---|
C:\dir1\dir2\file | /C:/dir1/dir2/file | - |
\dir1\dir2\file | /dir1/dir2/file | - |
\\share\dir1\dir2\file | //share/dir1/dir2/file | Note that an empty URI authority (// ) is prepended since otherwise the share name is interpreted as URI authority. |
filename
identifies an existing file, or whether that file is readable. The filename is simply converted to a URI according to some fixed rules."${shader}"
.
|
pure virtual |
Converts a URI into a filename.
Returns NULL
if
uri
is NULL
,"file"
,In all other cases the URI path is converted into a filename according to the following rules.
On Linux and MacOS X, the filename equals the URI path. On Windows, backslashes in relative filenames are converted to slashes to obtain the URI path. Absolute filenames are mapped to URI paths according to the following table.
URI path | Filename | Comment |
---|---|---|
/C:/dir1/dir2/file | C:\dir1\dir2\file | - |
/C/dir1/dir2/file | C:\dir1\dir2\file | This mapping is supported in addition to the first one since a colon is a reserved character in URIs. |
/dir1/dir2/file | \dir1\dir2\file | This mapping is only supported for top-level directory names not consisting of a single letter. |
//share/dir1/dir2/file | \\share\dir1\dir2\file | This mapping requires an (otherwise optional) empty URI authority (// ) since otherwise the share name is interpreted as URI authority. |
uri
identifies an existing file, or whether that file is readable. The URI is simply converted to a filename according to some fixed rules."${shader}"
.
|
pure virtual |
Exports BSDF data to a file on disk.
See Importer and Exporter for the URI naming conventions supported for the uri
parameter.
uri | The URI of the resource to export the BSDF data 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.
See Importer and Exporter for the URI naming conventions supported for the uri
parameter.
If the image plugin that is selected for the export based on the uri
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"
),uri | The URI of the resource to export the canvas to. The ending of the URI 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 scene elements.
This method is equivalent to export_scene(), except that all named elements in the string array elements
are written to the file. If the recurse
option is true
, any elements referenced by those elements are written as well.
In addition to exporter specific options, every exporter supports the following standard options:
"strip_prefix"
of type mi::IString: This prefix is stripped from the names of all exported elements if they have the same prefix. This option can be used to undo the effect of the "prefix"
option for import operations. Default: the empty string."recurse"
of type mi::IBoolean: If true
, any elements referenced by the elements in the elements
array are exported as well, similar to the automatic recursion applied by export_scene(). Default: true."time_stamp"
of type mi::IString: If not empty only the passed list of elements along with elements referenced by those that have been changed or added since the time identified by the time stamp are written. Other elements are omitted from the file, but not from recursion: an old element referencing an edited sub-element is not written, but the sub-element is. You can use the method mi::neuraylib::ITransaction::get_time_stamp() to get a time stamp. Default: the empty string.You can use export_elements() to write incremental changes to be appended to an existing file, which is for example supported with the .mi
file format. The elements listed in the elements array are supposed to be independent entry points into the scene graph that need to be visited for the export. In the case that the "recurse"
option is true
, the export can handle duplicate entries and possible dependencies correctly. If the "recurse"
option is false
, the export cannot detect duplicates or dependencies automatically, in which case you should avoid duplicates and list in the elements
array elements that are referenced before the elements that reference them.
If the file cannot be created or any of the elements cannot be found or written, an error code is set in the mi::neuraylib::IExport_result return value and the file is deleted if it was created.
mi
, the exported file will not contain a render statement.mib
file format is not supported.The export result uses the following error codes.
elements
is empty, contains elements that are not strings, or for at least one of the given names there is no DB element with that name.The severity of all listed errors (excluding the exporter specific error codes) is mi::base::MESSAGE_SEVERITY_ERROR. There might be other undocumented error codes.
|
pure virtual |
Exports scene elements to string.
This method is equivalent to export_elements(), except that the exported elements are not written to a file, but to a string in memory. Since there is no URI the additional parameter file_extension
is used to select the exporter (e.g. ".mdl"
to export MDL modules containing presets). The result will be stored in the non-const parameter result_string
.
|
pure virtual |
Exports a scene.
Writes the scene identified by the root group rootgroup
, the camera instance caminst
(if present), and the options options
(if present), to the given file uri
.
See Importer and Exporter for the URI naming conventions supported for the uri
parameter.
If the file cannot be created or any of the elements cannot be found or written, an error code is set in the mi::neuraylib::IExport_result return value and the file is deleted if it was created.
Any elements referenced by the three argument elements are written as well, recursively, in an order that allows re-importing (for example, in the .mi
file format, a referenced element must precede the reference).
In addition to exporter specific options, every exporter supports the following standard option:
"strip_prefix"
of type mi::IString: This prefix is stripped from the names of all exported elements if they have the same prefix. This option can be used to undo the effect of the "prefix"
option for import operations. Default: the empty string.mi
and binary file format .mib
, you have to provide valid caminst
and options
parameters. They are used in the render statement in the .mi
and .mib
file format, respectively.The export result uses the following error codes.
The severity of all listed errors (excluding the exporter specific error codes) is mi::base::MESSAGE_SEVERITY_ERROR. There might be other undocumented error codes.
Returns a registered exporter.
index | The index of the requested exporter. |
NULL
if index
is out of bounds.
|
pure virtual |
Returns the number of registered exporters.
|
pure virtual |
Returns a writer that can be used to export to the given resource.
uri | The URI of the resource to get the writer for. |
NULL
in case of failures.
|
pure virtual |
Returns the exporter that would be used for a particular file name extension.
This method needs a writable directory for temporary files (see mi::neuraylib::IGeneral_configuration::set_temp_path()).
extension | The file name extension of the resource to return an exporter for. |
NULL
in case of failures (e.g. there is no exporter that is able to export files with the given file name extension, or the user data directory is not writable).