Metadata Writing | |||||||||
These functions let the author of a node attach auxiliary information about parameters or the node to the node itself. These methods may only be called inside of the Note that Arnold currently supports one special case for metadata. If you attach a string named "synonym" to a parameter or to a node (by passing NULL for param), Arnold will accept the alternative name when creating nodes or setting parameters. This can be helpful for backwards compatibility. Here is an example: {
AiParameterFlt("Kd", 0.7f);
// create a lower-case synonym for parameter Kd
AiMetaDataSetStr(mds, "Kd", "synonym", "kd");
// describe the parameter
AiMetaDataSetStr(mds, "Kd", "description",
"Diffuse coefficient");
// describe the node itself
AiMetaDataSetStr(mds, NULL, "description",
"This is a simple lambert shader for illustration purposes");
}
Note that you should never pass allocated strings, as they will not be freed.
| |||||||||
AI_API void | AiMetaDataSetBool (AtMetaDataStore *mds, const char *param, const char *name, bool value) | ||||||||
AI_API void | AiMetaDataSetInt (AtMetaDataStore *mds, const char *param, const char *name, int value) | ||||||||
AI_API void | AiMetaDataSetFlt (AtMetaDataStore *mds, const char *param, const char *name, float value) | ||||||||
AI_API void | AiMetaDataSetPnt (AtMetaDataStore *mds, const char *param, const char *name, AtPoint value) | ||||||||
AI_API void | AiMetaDataSetVec (AtMetaDataStore *mds, const char *param, const char *name, AtVector value) | ||||||||
AI_API void | AiMetaDataSetPnt2 (AtMetaDataStore *mds, const char *param, const char *name, AtPoint2 value) | ||||||||
AI_API void | AiMetaDataSetRGB (AtMetaDataStore *mds, const char *param, const char *name, AtColor value) | ||||||||
AI_API void | AiMetaDataSetStr (AtMetaDataStore *mds, const char *param, const char *name, const char *value) | ||||||||
Metadata Retrieval | |||||||||||||
These functions allow client code to examine metadata attached to specific parameters or to a node. Following on the example above: char* desc;
bool success = AiMetaDataGetStr(entry, "Kd", "description", &desc)
if (success)
printf("\nDescription for parameter Kd: %s", desc);
| |||||||||||||
AI_API bool | AiMetaDataGetBool (const AtNodeEntry *entry, const char *param, const char *name, bool *value) | ||||||||||||
AI_API bool | AiMetaDataGetInt (const AtNodeEntry *entry, const char *param, const char *name, int *value) | ||||||||||||
AI_API bool | AiMetaDataGetFlt (const AtNodeEntry *entry, const char *param, const char *name, float *value) | ||||||||||||
AI_API bool | AiMetaDataGetPnt (const AtNodeEntry *entry, const char *param, const char *name, AtPoint *value) | ||||||||||||
AI_API bool | AiMetaDataGetVec (const AtNodeEntry *entry, const char *param, const char *name, AtVector *value) | ||||||||||||
AI_API bool | AiMetaDataGetPnt2 (const AtNodeEntry *entry, const char *param, const char *name, AtPoint2 *value) | ||||||||||||
AI_API bool | AiMetaDataGetRGB (const AtNodeEntry *entry, const char *param, const char *name, AtColor *value) | ||||||||||||
AI_API bool | AiMetaDataGetStr (const AtNodeEntry *entry, const char *param, const char *name, const char **value) | ||||||||||||
This API allows the user to attach and retrieve extra information about nodes and their parameters. This can be helpful to maintain extra annotations about parameters for GUI tools for example.