This interface is used to import files. More...
Public Member Functions | |
Import operations | |
virtual const IImport_result * | import_elements (ITransaction *transaction, const char *uri, const IMap *importer_options=0, const IImpexp_state *parent_state=0) const =0 |
Imports scene elements. More... |
|
virtual const IImport_result * | import_elements_from_string (ITransaction *transaction, const char *data, const char *file_extension=0, const IMap *importer_options=0, const IImpexp_state *parent_state=0) const =0 |
Imports scene data from the string data into the database. More... |
|
virtual ICanvas * | import_canvas (const char *uri) const =0 |
Imports a canvas from a file on disk. More... |
|
virtual Sint32 | import_bsdf_data (const char *uri, IBsdf_isotropic_data **reflection, IBsdf_isotropic_data **transmission) const =0 |
Imports BSDF data from a file on disk. More... |
|
Importer introspection | |
virtual Size | get_importer_length () const =0 |
Returns the number of registered importers. More... |
|
virtual const IImporter * | get_importer (Size index) const =0 |
Returns a registered importer. More... |
|
virtual const IImporter * | select_importer_by_uri (const char *uri) const =0 |
Returns the importer that would be used for a particular resource. More... |
|
virtual IReader * | get_reader (const char *uri) const =0 |
Returns the reader that would be used to import the given resource. More... |
|
Utility methods | |
virtual const IString * | get_absolute_path (ITransaction *transaction, const char *path) const =0 |
Returns the absolute path corresponding to the given path. More... |
|
virtual const IString * | create_importer_directory (ITransaction *transaction) const =0 |
Creates a unique directory that can be used by importers for temporary files. More... |
|
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< 0x13fc124d, 0x2525, 0x473f, 0xb1, 0x9e, 0xef, 0x63, 0x80, 0x5a, 0x2c, 0x68 > | |
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< 0x13fc124d, 0x2525, 0x473f, 0xb1, 0x9e, 0xef, 0x63, 0x80, 0x5a, 0x2c, 0x68 > | |
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 import 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, 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.
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 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, 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.
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 |
Creates a unique directory that can be used by importers for temporary files.
Note that multiple calls to this function will return different results even when called from the same importer. The created directory is in the directory for temporary files, see mi::neuraylib::IGeneral_configuration::set_temp_path().
transaction | The transaction. |
NULL
in case of failure.
|
pure virtual |
Returns the absolute path corresponding to the given path.
Relative paths are resolved to absolute paths w.r.t. to the current working directory.
path
exists or not.transaction | The transaction. |
path | An absolute or relative path. |
path
in a normalized representation. Returns a registered importer.
index | The index of the requested importer. |
NULL
if index
is out of bounds.
|
pure virtual |
Returns the number of registered importers.
|
pure virtual |
Returns the reader that would be used to import the given resource.
uri | The URI of the resource to get the reader for. |
NULL
in case of failures (e.g, the URI denotes a non-existing file).
|
pure virtual |
Imports BSDF data from a file on disk.
See Importer and Exporter for the URI naming conventions supported for the uri
parameter.
uri | The URI of the BSDF data to import. | |
[out] | reflection | The imported BSDF data for the reflection. The incoming value of *reflection must be NULL . The reference count of the outgoing value of *reflection has already been increased for the caller (similar as for return values). Note that *reflection is NULL if there is no BSDF data for the reflection. |
[out] | transmission | The imported BSDF data for the transmission. The incoming value of *transmission must be NULL . The reference count of the outgoing value of *transmission has already been increased for the caller (similar as for return values). Note that *transmission is NULL if there is no BSDF data for the transmission. |
NULL
pointer).*reflection
or *transmission
are not NULL
.
|
pure virtual |
Imports a canvas from a file on disk.
See Importer and Exporter for the URI naming conventions supported for the uri
parameter.
uri | The URI of the canvas to import. 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. |
NULL
in case of failure.
|
pure virtual |
Imports scene elements.
This method reads the named file from uri
and parses it with an importer. Importer selection is based on testing a file prefix (if available) or the uri
filename extension. Elements will be put into the database as if they had been stored with mi::neuraylib::ITransaction::store().
See Importer and Exporter for the URI naming conventions supported for the uri
parameter.
The parent_state
is not equal to NULL
if another importer recursively calls an importer. In this case a relative uri
will be interpreted relative to the URI of the parent importer and the resolved URI will be passed to the nested importer. If parent_state
is NULL
, a relative uri
will be passed unchanged to the importer and should be interpreted relative to the current working directory. In addition, a non-NULL
parent_state
can be used for better diagnostics in case of errors.
In addition to importer specific options, every importer supports the following standard options:
"prefix"
of type mi::IString: This prefix is prepended to the names of all imported elements. Default: the empty string."list_elements"
of type mi::IBoolean: If true
, the name of each imported element is stored in the returned instance of mi::IImport_result. All elements can be directly looked up using these names via mi::neuraylib::ITransaction::access() and mi::neuraylib::ITransaction::edit(). Default: false
.The method stores a non-zero status code in the returned instance of mi::IImport_result if an error occurred. The database and mi::IImport_result contain all elements read up to that point. The element that caused the error might be incomplete or inconsistent. If the "list_elements"
options is selected, every changed or added element, even if it caused an error, is reported in the elements array of mi::IImport_result. In case of error, the database can be returned to a safe state that does not contain incompletely defined elements by calling the mi::neuraylib::ITransaction::abort() method, which will return the database to the state it was in when the current transaction started. (This is not specific to scene importing, any operation that modifies the database can be reversed in this way.)
The import result uses the following error codes.
The severity of all listed errors (excluding the importer specific error codes) is mi::base::MESSAGE_SEVERITY_ERROR. There might be other undocumented error codes.
|
pure virtual |
Imports scene data from the string data
into the database.
In all other respects it behaves like the import_elements() method. However, this function can only handle non-binary data, since the data is passed in as a zero-terminated string.
This method supports following options:
"list_elements"
of type mi::IBoolean: If true
, the name of each imported element is stored in the returned instance of mi::IImport_result. All elements can be directly looked up using these names via mi::neuraylib::ITransaction::access() and mi::neuraylib::ITransaction::edit(). Default: false
."module_name"
of type mi::IString: The fully qualified MDL name of the module that is represented by data
(the fully qualified MDL name start with a double colon). Note that there must be no file-based MDL module of that name in the configured search path, otherwise the method will fail. That is, this method can not be used to shadow file-based MDL modules. It is also not possible to use this method to change already imported MDL modules. This option is mandatory if file_extension
is ".mdl"
.file_extension
set to ".mdl"
) and MetaSL shaders (file_extension
set to ".msl"
or ".xmsl"
) are supported by this method.The import result uses the following error codes.
data
is NULL
or the empty string).file_extension
is not supported).The severity of all listed errors (excluding the importer specific error codes) is mi::base::MESSAGE_SEVERITY_ERROR. There might be other undocumented error codes.
|
pure virtual |
Returns the importer that would be used for a particular resource.
uri | The URI of the resource to return an importer for. |
uri
, or NULL
in case of failures (e.g. there is no importer that is able to import the given resource).