ai_asset.h
1// Copyright 2026 Autodesk, Inc. All rights reserved.
2//
3// Use of this software is subject to the terms of the Autodesk license
4// agreement provided at the time of installation or download, or which
5// otherwise accompanies this software in either electronic or hard copy form.
6
12#pragma once
13
14#include <ai_file_utils.h>
15#include <ai_string.h>
16#include <stdint.h>
17
18// forward declarations
19struct AtAsset;
20
37struct AtAsset;
38struct AtNode;
39
55AI_API AtAsset* AiAsset(const char* filename, AtFileType type = AtFileType::Custom);
56
62AI_API void AiAssetDestroy(AtAsset* asset);
63
73AI_API void AiAssetAddReference(AtAsset* asset, const AtString reference,
74 const AtString node_name, const AtString parameter);
75
85AI_API AI_PURE AtString AiAssetGetFilename(const AtAsset* asset);
86
94AI_API AI_PURE AtFileType AiAssetGetFileType(const AtAsset* asset);
95
106AI_API AI_PURE bool AiAssetGetIgnoreMissing(const AtAsset* asset);
107
118AI_API void AiAssetSetIgnoreMissing(AtAsset* asset, bool ignore_missing);
119
131AI_API AI_PURE uint32_t AiAssetGetNumReferences(const AtAsset* asset);
132
147AI_API AI_PURE AtString AiAssetGetReference(const AtAsset* asset, uint32_t reference_idx);
148
157AI_API AI_PURE AtString AiAssetReferenceGetNodeName(const AtAsset* asset, uint32_t reference_idx);
158
167AI_API AI_PURE AtString AiAssetReferenceGetParameter(const AtAsset* asset, uint32_t reference_idx);
168
169struct AtAssetIterator;
170
175AI_API void AiAssetIteratorDestroy(AtAssetIterator* iter);
176AI_API const AtAsset* AiAssetIteratorGetNext(AtAssetIterator* iter);
177AI_API bool AiAssetIteratorFinished(const AtAssetIterator* iter);
178/* \}*/
179
180/*\}*/
API for file path processing.
AtString class for fast comparisons.
Arnold String allows for fast string comparisons.
Definition: ai_string.h:54
AI_API AI_PURE bool AiAssetGetIgnoreMissing(const AtAsset *asset)
Returns true if the asset should be ignored when the file does not exist.
Definition: ai_asset.cpp:43
AI_API void AiAssetDestroy(AtAsset *asset)
Destroys an asset instance.
Definition: ai_asset.cpp:13
AI_API void AiAssetAddReference(AtAsset *asset, const AtString reference, const AtString node_name, const AtString parameter)
Adds a scene reference to an asset.
Definition: ai_asset.cpp:21
AI_API AI_PURE AtString AiAssetGetFilename(const AtAsset *asset)
Returns the asset file path.
Definition: ai_asset.cpp:33
AI_API AI_PURE uint32_t AiAssetGetNumReferences(const AtAsset *asset)
Returns the number of references the given asset has in the scene.
Definition: ai_asset.cpp:55
AI_API AI_PURE AtFileType AiAssetGetFileType(const AtAsset *asset)
Returns the asset file type, such as Asset (texture, procedural), OSL, Plugin, etc.
Definition: ai_asset.cpp:38
AI_API bool AiAssetIteratorFinished(const AtAssetIterator *iter)
Returns true if there are no more assets to iterate over.
Definition: ai_asset.cpp:153
AI_API AI_PURE AtString AiAssetReferenceGetParameter(const AtAsset *asset, uint32_t reference_idx)
Returns the name of the Arnold node parameter that defines a given asset reference.
Definition: ai_asset.cpp:90
AI_API void AiAssetSetIgnoreMissing(AtAsset *asset, bool ignore_missing)
Sets the 'ignore missing' flag of the asset.
Definition: ai_asset.cpp:48
AI_API AI_PURE AtString AiAssetGetReference(const AtAsset *asset, uint32_t reference_idx)
Returns the string that represents the file in the scene description.
Definition: ai_asset.cpp:60
AI_API void AiAssetIteratorDestroy(AtAssetIterator *iter)
Destroys an asset iterator when it is no longer needed.
Definition: ai_asset.cpp:114
AI_API AtAsset * AiAsset(const char *filename, AtFileType type=AtFileType::Custom)
Creates a new asset instance.
Definition: ai_asset.cpp:8
AI_API const AtAsset * AiAssetIteratorGetNext(AtAssetIterator *iter)
Returns current asset and points the iterator to the next asset.
Definition: ai_asset.cpp:142
AI_API AI_PURE AtString AiAssetReferenceGetNodeName(const AtAsset *asset, uint32_t reference_idx)
Returns the name of the Arnold node that defines a given asset reference.
Definition: ai_asset.cpp:75
This represents a node in Arnold.

© 2023 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com