ai_metadata.h
Go to the documentation of this file.
1 // Copyright 2020 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 #include "ai_node_entry.h"
14 #include "ai_vector.h"
15 #include "ai_color.h"
16 #include "ai_api.h"
17 #include "ai_string.h"
18 #ifdef AI_CPU_COMPILER
19 
69 struct AtMetadataStore;
70 
108 #define AiCreateFuncs(_name, _type) \
109 AI_API void AiMetaDataSet##_name (AtNodeEntry* nentry, const AtString param, const AtString name, _type value); \
110 inline void AiMetaDataSet##_name (AtNodeEntry* nentry, const char* param, const char* name, _type value) \
111 { \
112  AiMetaDataSet##_name(nentry, AtString(param), AtString(name), value); \
113 } \
114 
115 AiCreateFuncs(Bool, bool)
116 AiCreateFuncs(Int, int)
117 AiCreateFuncs(Flt, float)
118 AiCreateFuncs(RGB, AtRGB)
119 AiCreateFuncs(RGBA, AtRGBA)
120 AiCreateFuncs(Vec, AtVector)
121 AiCreateFuncs(Vec2, AtVector2)
122 AiCreateFuncs(Str, AtString)
123 #undef AiCreateFuncs
124 
125 inline void AiMetaDataSetStr(AtNodeEntry* nentry, const char* param, const char* name, const char* value)
126 {
127  AiMetaDataSetStr(nentry, param, name, AtString(value));
128 }
129 
130 /* \} */
131 
158 #define AiCreateFuncs(_name, _type) \
159 AI_API bool AiMetaDataGet##_name(const AtNodeEntry* nentry, const AtString param, const AtString name, _type* value);\
160 inline AI_DEPRECATED bool AiMetaDataGet##_name(const AtNodeEntry* nentry, const char* param, const char* name, _type* value) \
161 { \
162  return AiMetaDataGet##_name(nentry, AtString(param), AtString(name), value); \
163 }
164 
165 AiCreateFuncs(Bool, bool)
166 AiCreateFuncs(Int, int)
167 AiCreateFuncs(Flt, float)
168 AiCreateFuncs(RGB, AtRGB)
169 AiCreateFuncs(RGBA, AtRGBA)
170 AiCreateFuncs(Vec, AtVector)
171 AiCreateFuncs(Vec2, AtVector2)
172 AiCreateFuncs(Str, AtString)
173 #undef AiCreateFuncs
174 
175 /* \} */
176 
198 #define AiCreateFuncs(_name, _type) \
199 AI_API void AiMetadataStoreSet##_name(AtMetadataStore* mds, const AtString name, _type value); \
200 AI_API void AiMetadataStoreParamSet##_name(AtMetadataStore* mds, const AtString param, const AtString name, _type value);
201 
202 AiCreateFuncs(Bool, bool)
203 AiCreateFuncs(Int, int)
204 AiCreateFuncs(Flt, float)
205 AiCreateFuncs(RGB, AtRGB)
206 AiCreateFuncs(Vec, AtVector)
207 AiCreateFuncs(Vec2, AtVector2)
208 AiCreateFuncs(Str, AtString)
209 #undef AiCreateFuncs
210 
211 inline void AiMetadataStoreSetStr(AtMetadataStore* mds, const AtString name, const char* value)
212 {
213  AiMetadataStoreSetStr(mds, name, AtString(value));
214 }
215 
216 inline void AiMetadataStoreParamSetStr(AtMetadataStore* mds, const AtString param, const AtString name, const char* value)
217 {
218  AiMetadataStoreParamSetStr(mds, param, name, AtString(value));
219 }
220 
221 /* \} */
222 
245 #define AiCreateFuncs(_name, _type) \
246 AI_API bool AiMetadataStoreGet##_name(const AtMetadataStore* mds, const AtString name, _type* value); \
247 AI_API bool AiMetadataStoreParamGet##_name(const AtMetadataStore* mds, const AtString param, const AtString name, _type* value);
248 
249 AiCreateFuncs(Bool, bool)
250 AiCreateFuncs(Int, int)
251 AiCreateFuncs(Flt, float)
252 AiCreateFuncs(RGB, AtRGB)
253 AiCreateFuncs(Vec, AtVector)
254 AiCreateFuncs(Vec2, AtVector2)
255 AiCreateFuncs(Str, AtString)
256 #undef AiCreateFuncs
257 
258 /* \} */
259 
266 
272 AI_API void AiMetadataStoreDestroy(AtMetadataStore* mds);
273 
280 AI_API bool AiMetadataStoreLoadFromASS(AtMetadataStore* mds, const char* file);
281 
288 AI_API AtMetaDataIterator* AiMetadataStoreGetIterator(const AtMetadataStore* mds);
289 
298 AI_API AtMetaDataIterator* AiMetadataStoreGetIteratorRecursive(const AtMetadataStore* mds, const char* param, bool recursive);
299 
318 AI_API bool AiMetaDataLoadFile(const char* filename);
319 
320 /* \} */
321 
322 #endif // AI_CPU_COMPILER
RGB color.
Definition: ai_color.h:31
AI_API bool AiMetadataStoreLoadFromASS(AtMetadataStore *mds, const char *file)
Load embedded metadata from an .ass file into a metadata store.
Definition: ai_metadata.cpp:127
Vector math types, operators and utilities.
Arnold String allows for fast string comparisons.
Definition: ai_string.h:46
3D point (single precision)
Definition: ai_vector.h:29
This structure holds a generic list of metadata items, each of which could optionally be associated t...
Color types and utilities.
DLL export prefix for API functions (necessary for multi-platform development)
2D point
Definition: ai_vector.h:254
AI_API void AiMetadataStoreDestroy(AtMetadataStore *mds)
Destroys a metadata store object.
Definition: ai_metadata.cpp:106
AI_API AtMetaDataIterator * AiMetadataStoreGetIteratorRecursive(const AtMetadataStore *mds, const char *param, bool recursive)
Creates a new metadata iterator pointing at the first matching entry.
Definition: ai_metadata.cpp:119
This represents a node type in Arnold.
AI_API bool AiMetaDataLoadFile(const char *filename)
Load a metadata file.
Definition: ai_metadata.cpp:44
RGB color + alpha.
Definition: ai_color.h:266
AI_API AtMetadataStore * AiMetadataStore()
Creates a new metadata store.
Definition: ai_metadata.cpp:101
AtNodeEntry type and methods.
AI_API AtMetaDataIterator * AiMetadataStoreGetIterator(const AtMetadataStore *mds)
Creates a new metadata iterator that traverses all global metadata.
Definition: ai_metadata.cpp:111
AtString class for fast comparisons.

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