I'm creating a shader using Arnold SDK, I have instances of a polymesh in a scene and I need to access some polymesh properties through the code.
I've been digging in the API looking for a way to retrieve the polymesh node given the the ginstance pointer, but I haven't been able to get it done.
Some things I have tried:
auto parent = AiNodeGetParent(sg->Op); if (parent != nullptr) {...} //it always returns null
auto it = AiUniverseGetNodeEntryIterator(AI_NODE_ALL);
while (!AiNodeEntryIteratorFinished(it)) {...} //doesn't seem to be in there
Update: more background.
This seems to return the polymesh as a NodeEntry:
auto nodeEntry = AiNodeGetNodeEntry(sg->Op);
const char * entryName = AiNodeEntryGetName(nodeEntry);
But I see parameters inside the polymesh in the .ass file I can't find here. I have looped through the params and metadata using the given iterators without any luck:
auto paramIt = AiNodeEntryGetParamIterator(nodeEntry); while(!AiParamIteratorFinished(paramIt)) { auto paramEntry = AiParamIteratorGetNext(paramIt); auto paramname = AiParamGetName(paramEntry); printf("%s", paramname); } AiParamIteratorDestroy(paramIt); auto metadataIt = AiNodeEntryGetMetaDataIterator(nodeEntry); while(!AiMetaDataIteratorFinished(metadataIt)) { auto metadataEntry = AiMetaDataIteratorGetNext(metadataIt); printf("%s", metadataEntry->name); } AiMetaDataIteratorDestroy(metadataIt);
I guess if it is shown in the ass file should be somewhere...
AiNodeGetPtr(instance_node, 'node')
This is returning null:
AiNodeGetPtr(sg->Op, "node");
I'm using MaxToA, and according to the ass file "node" is a string, but this is returning null as well
AiNodeGetStr(sg->Op, "node");
ginstance {
...
node "/iTooArnold_Mesh_000001E28ABACF90"
...
node is not a string
bin\kick -info ginstance.node node: ginstance param: node type: NODE default: (null)