Scene file loading and writing using multiple formats.
More...
|
AI_API bool | AiSceneLoad (AtUniverse *universe, const char *filename, const AtParamValueMap *params) |
| Load all nodes from a scene file into a specific Arnold universe. More...
|
|
AI_API bool | AiSceneWrite (AtUniverse *universe, const char *filename, const AtParamValueMap *params, const AtMetadataStore *mds=NULL) |
| Write all nodes in the given universe to a scene file. More...
|
|
AI_API bool | AiSceneFormatSupported (const char *extension) |
| Check if the scene format corresponding to a given filename extension is supported. More...
|
|
Scene file loading and writing using multiple formats.
The implementation of each specific scene format will determine how to load nodes into an Arnold universe or how to store the contents of an Arnold universe into a scene file.
◆ AiSceneLoad()
AI_API bool AiSceneLoad |
( |
AtUniverse * |
universe, |
|
|
const char * |
filename, |
|
|
const AtParamValueMap * |
params |
|
) |
| |
Load all nodes from a scene file into a specific Arnold universe.
If the filename is "-", it reads data from stdin (assuming ASS format)
This example code loads all node types from a scene file:
Arnold String allows for fast string comparisons.
Definition: ai_string.h:54
AI_API AtParamValueMap * AiParamValueMap()
Creates a new map.
Definition: ai_map.cpp:46
AI_API void AiParamValueMapDestroy(AtParamValueMap *map)
Destroys a map object.
Definition: ai_map.cpp:55
#define AI_NODE_ALL
Bitmask including all node types, used by AiASSWrite()
Definition: ai_node_entry.h:49
AI_API bool AiSceneLoad(AtUniverse *universe, const char *filename, const AtParamValueMap *params)
Load all nodes from a scene file into a specific Arnold universe.
Definition: ai_scene.cpp:6
Supported format specific params:
Scene format | Supported load parameters |
ASS | mask | INTEGER | Only node types matching this mask will be loaded |
USD | mask | INTEGER | Only node types matching this mask will be loaded |
frame | FLOAT | Load a given frame from the USD file |
- Parameters
-
universe | universe where the nodes will be created (NULL for default universe) |
filename | input filename (extension will be used to determine scene format) |
params | list of arbitrary params which will be interpreted by the specific scene format |
- Returns
- true if the file was loaded succesfully, false otherwise
◆ AiSceneWrite()
AI_API bool AiSceneWrite |
( |
AtUniverse * |
universe, |
|
|
const char * |
filename, |
|
|
const AtParamValueMap * |
params, |
|
|
const AtMetadataStore * |
mds = NULL |
|
) |
| |
Write all nodes in the given universe to a scene file.
This function can selectively write all nodes in a given universe to a scene file, which format will be determined from the filename extension.
An arbitrary list of attributes can be passed, and these attributes can be used by specific file formats. For example, the .ass file format supports "mask", "binary" and "open_procs" attributes, which are equivalent to the parameters on AiASSWrite. Note these attributes might not work on other file formats.
For example, to write light nodes and camera nodes only, use:
#define AI_NODE_CAMERA
Camera nodes (persp_camera, fisheye_camera, etc)
Definition: ai_node_entry.h:39
#define AI_NODE_LIGHT
Light source nodes (spot_light, etc)
Definition: ai_node_entry.h:40
AI_API bool AiSceneWrite(AtUniverse *universe, const char *filename, const AtParamValueMap *params, const AtMetadataStore *mds=NULL)
Write all nodes in the given universe to a scene file.
Definition: ai_scene.cpp:18
To write all nodes of all types, use:
Supported format specific params:
Scene format | Supported write parameters |
ASS | mask | INTEGER | Only node types matching this mask will be written |
binary | BOOLEAN | Allow binary encoding in .ass files |
open_procs | BOOLEAN | Procedurals will be expanded before writing |
USD | mask | INTEGER | Only node types matching this mask will be written |
- Parameters
-
universe | universe whose contents will be written to the scene file (NULL for default universe) |
filename | output filename (extension will be used to select scene format) |
params | list of arbitrary params which will be interpreted by the specific scene format |
mds | optional metadata store for writing metadata into the file |
- Returns
- true if the file was written succesfully, false otherwise
◆ AiSceneFormatSupported()
AI_API bool AiSceneFormatSupported |
( |
const char * |
extension | ) |
|
Check if the scene format corresponding to a given filename extension is supported.
- Parameters
-
extension | scene file extension to check for support (should start with ".") |
- Returns
- true if the format is supported, false otherwise
◆ AiSceneFormatIterator()
Get new scene format iterator.
- Returns
- New scene format iterator
◆ AiSceneFormatIteratorDestroy()
Destroys scene format iterator and releases any allocated memory.
- Parameters
-
iter | Scene format iterator to destroy |
◆ AiSceneFormatIteratorGetNext()
Gets the next supported scene format.
- Parameters
-
iter | Scene format iterator |
- Returns
- Information about the next supported scene format
◆ AiSceneFormatIteratorFinished()
Check if there are more scene formats to iterate over.
- Parameters
-
iter | Scene format iterator |
- Returns
- true if the iterator reached the last supported scene format
◆ AiSceneFormatGetExtensionIterator()
Get an iterator over all supported extensions for this scene format.
- Parameters
-
format_data | Scene format data returned by AiSceneFormatIteratorGetNext |
- Returns
- Iterator
◆ AiSceneFormatExtensionIteratorDestroy()
Destroys scene format extension iterator and releases any allocated memory.
- Parameters
-
iter | Scene format extension iterator to destroy |
◆ AiSceneFormatExtensionIteratorGetNext()
Gets the next supported scene format extension.
- Parameters
-
iter | Scene format extension iterator |
- Returns
- Next supported extension
◆ AiSceneFormatExtensionIteratorFinished()
Check if there are more scene formats extensions to iterate over.
- Parameters
-
iter | Scene format extension iterator |
- Returns
- true if the iterator reached the last supported scene format extension
◆ AiSceneFormatGetName()
AI_API AI_PURE const char * AiSceneFormatGetName |
( |
const AtSceneFormatData * |
format_data | ) |
|
Get the name of the scene format.
- Parameters
-
format_data | Scene format data returned by AiSceneFormatIteratorGetNext |
- Returns
- Name of the scene format
◆ AiSceneFormatGetDescription()
AI_API AI_PURE const char * AiSceneFormatGetDescription |
( |
const AtSceneFormatData * |
format_data | ) |
|
Get a description of the scene format.
- Parameters
-
format_data | Scene format data returned by AiSceneFormatIteratorGetNext |
- Returns
- Description of the scene format
◆ AiSceneFormatSupportsReading()
AI_API AI_PURE bool AiSceneFormatSupportsReading |
( |
const AtSceneFormatData * |
format_data | ) |
|
True if the scene format supports reading from file.
- Parameters
-
format_data | Scene format data returned by AiSceneFormatIteratorGetNext |
- Returns
- true if it can be read from file, false otherwise
◆ AiSceneFormatSupportsWriting()
AI_API AI_PURE bool AiSceneFormatSupportsWriting |
( |
const AtSceneFormatData * |
format_data | ) |
|
True if the scene format supports writing to a file.
- Parameters
-
format_data | Scene format data returned by AiSceneFormatIteratorGetNext |
- Returns
- true if it can be written to a file, false otherwise
◆ AiSceneFormatGetMetadataStore()
Get metadata for the scene format and its optional parameters.
- Parameters
-
format_data | Scene format data returned by AiSceneFormatIteratorGetNext |
- Returns
- Metadata store with all metadata for the scene format and its optional parameters